Skip to content

Commit

Permalink
Merge pull request #4 from ralphtheninja/TARGET_PLATFORM
Browse files Browse the repository at this point in the history
Target platform and tweaks to prebuildify arguments
  • Loading branch information
ahdinosaur committed Jan 30, 2019
2 parents c4748f7 + 13bcaf2 commit f389444
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
13 changes: 8 additions & 5 deletions build
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

ARGUMENTS="$@"
CWD=$(pwd)
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIRNAME="$(dirname "$(readlink -f "$0")")"
Expand Down Expand Up @@ -46,6 +45,7 @@ eval set -- "$PARSED"

HELP=n
ARCH=${ARCH:-} ARM_VERSION=${ARM_VERSION:-} PLATFORM=${PLATFORM:-}
ARGS=""
INPUT="${CWD}" OUTPUT=prebuilds
while true; do
case "$1" in
Expand Down Expand Up @@ -75,6 +75,7 @@ while true; do
;;
--)
shift
ARGS="$@"
break
;;
*)
Expand All @@ -87,9 +88,9 @@ done
if
[ "${HELP}" == "y" ] || \
[ "${ARCH}" == "" ] || \
!( [ "${ARCH}" != "x32" ] && [ "${ARCH}" != "x64" ] && [ "${ARCH}" != "arm" ] && [ "${ARCH}" != "arm64" ] ) || \
( [ "${ARCH}" != "x32" ] && [ "${ARCH}" != "x64" ] && [ "${ARCH}" != "arm" ] && [ "${ARCH}" != "arm64" ] ) || \
[ "${PLATFORM}" == "" ] || \
!( [ "${PLATFORM}" != "android" ] && [ "${PLATFORM}" != "linux" ] ) || \
( [ "${PLATFORM}" != "android" ] && [ "${PLATFORM}" != "linux" ] ) || \
[ "${ARCH}" == "arm" ] && [ "${ARM_VERSION}" == "" ]
then
cat >&2 <<EOF
Expand Down Expand Up @@ -192,6 +193,8 @@ case "${PLATFORM}" in
;;
esac

echo args $ARGS

IMAGE_NAME=${IMAGE_NAME:-prebuildify-cross}
CONTAINER_NAME=${CONTAINER_NAME:-prebuildify-cross-work-${TARGET}}

Expand Down Expand Up @@ -238,10 +241,10 @@ $DOCKER run \
-v "${INPUT}:/app/input" \
--env ARCH="${ARCH}" \
--env ARM_VERSION="${ARM_VERSION}" \
--env PLATFORM="${PLATFORM}" \
--env TARGET_PLATFORM="${PLATFORM}" \
${IMAGE_NAME}:${TARGET} \
bash -e -o errexit -o pipefail -o noclobber -o nounset -c "
cd /app; ./build-in-docker ${ARGUMENTS};
cd /app; ./build-in-docker ${ARGS};
"
time $DOCKER logs "${CONTAINER_NAME}" --follow || true &
wait "$!"
Expand Down
3 changes: 2 additions & 1 deletion build-in-docker
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

ARGUMENTS="$@"
CWD=$(pwd)

# saner programming env: these switches turn some bugs into errors
Expand All @@ -13,6 +14,6 @@ cd "${CWD}/work"

npm install --ignore-scripts

npm run prebuild
PATH="$(npm bin):$PATH" prebuildify $ARGUMENTS

cp -r "${CWD}/work/prebuilds" "${CWD}/output/"
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"directories": {
"example": "examples"
},
"scripts": {
"example:leveldown:linux-armv7": "./build --target linux-armv7 --input examples/leveldown --output output",
"example:sodium-native:arm": "./build --target linux-armv7 --input examples/sodium-native --output output"
},
"scripts": {},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/ahdinosaur/prebuildify-cross.git"
Expand Down

0 comments on commit f389444

Please sign in to comment.