Skip to content

Commit

Permalink
update api to call prebuildify with specified args
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdinosaur committed Dec 28, 2018
1 parent c4748f7 commit e442f7b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
12 changes: 9 additions & 3 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 @@ -29,7 +28,7 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
fi

OPTIONS=hi:o:
LONGOPTS=help,input:,output:,arch:,arm-version:,platform:
LONGOPTS=help,input:,output:,arch:,arm-version:,platform:,args:

# -use ! and PIPESTATUS to get exit code with errexit set
# -temporarily store output to be able to check for errors
Expand All @@ -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 @@ -73,6 +73,10 @@ while true; do
PLATFORM="$2"
shift 2
;;
--args)
ARGS="$2"
shift 2
;;
--)
shift
break
Expand Down Expand Up @@ -192,6 +196,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 @@ -241,7 +247,7 @@ $DOCKER run \
--env 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/"
10 changes: 5 additions & 5 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 All @@ -20,5 +17,8 @@
"bugs": {
"url": "https://github.com/ahdinosaur/prebuildify-cross/issues"
},
"homepage": "https://github.com/ahdinosaur/prebuildify-cross#readme"
"homepage": "https://github.com/ahdinosaur/prebuildify-cross#readme",
"peerDependencies": {
"prebuildify": "*"
}
}

0 comments on commit e442f7b

Please sign in to comment.