Allow script to output to curr. dir

This commit is contained in:
Andrew Morgan 2019-07-15 15:54:10 +01:00
parent da69384772
commit 4a75b532d8

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# Builds and installs native node modules # Builds and installs native node modules. This script must be run from riot-web's
# root
# #
# Dependencies # Dependencies
# #
@ -19,7 +20,7 @@
# Windows: # Windows:
# - unsupported # - unsupported
set -ex set -e
usage() { usage() {
echo "Usage: $0 -e <electron_version> -a <electron_abi> [-i] [-I]" echo "Usage: $0 -e <electron_version> -a <electron_abi> [-i] [-I]"
@ -33,7 +34,7 @@ usage() {
echo "I: Same as -i, but just output the node module in the current directory" echo "I: Same as -i, but just output the node module in the current directory"
} }
while getopts "e:a:i" opt; do while getopts "e:a:i:I" opt; do
case $opt in case $opt in
e) e)
electron_version=$OPTARG electron_version=$OPTARG
@ -67,7 +68,7 @@ if [ -z ${electron_abi+x} ]; then
exit 1 exit 1
fi fi
if [ -z ${iohook+x} ] || [ -z ${iohook_export+x} ]; then if [ -z ${iohook+x} ] && [ -z ${iohook_export+x} ]; then
echo "Please specify a module to build" echo "Please specify a module to build"
usage usage
exit 1 exit 1
@ -80,7 +81,7 @@ case "$OSTYPE" in
ostype="darwin" ostype="darwin"
;; ;;
msys*) msys*)
if [ -z ${iohook+x} ] || [ -z ${iohook_export+x} ]; then if ! [ -z ${iohook+x} ] || ! [ -z ${iohook_export+x} ]; then
echo "Building iohook on Windows is unsupported at this time" echo "Building iohook on Windows is unsupported at this time"
exit 1 exit 1
fi fi
@ -102,6 +103,7 @@ else
osarch="32" osarch="32"
fi fi
if ! [ -z ${iohook+x} ] || ! [ -z ${iohook_export+x} ]; then
# Get dependencies # Get dependencies
echo "Getting dependencies..." echo "Getting dependencies..."
yarn yarn
@ -126,10 +128,16 @@ rm -rf builds/*
npm run build # This builds libuiohook npm run build # This builds libuiohook
node build.js --runtime electron --version $electron_version --abi $abi --no-upload # Builds the module for the current OS/node version node build.js --runtime electron --version $electron_version --abi $abi --no-upload # Builds the module for the current OS/node version
if [ -z ${iohook_export} ]; then
# Install # Install
echo "Installing built package" echo "Installing built package"
folder="electron-v$abi-$ostype-x$osarch" folder="electron-v$abi-$ostype-x$osarch"
mkdir -p builds/$folder/build/Release mkdir -p builds/$folder/build/Release
cp build/Release/iohook.node builds/$folder/build/Release/ cp build/Release/iohook.node builds/$folder/build/Release/
else
# Just export
cp build/Release/iohook.node ../../../iohook.node
fi
fi
echo "Done!" echo "Done!"