Configure cross-compilation for Apple Silicon (#6360)
Adds support for Apple Silicon binaries for NodeJS bindings.
This commit is contained in:
committed by
GitHub
parent
96f5780f06
commit
1c65ea2194
+27
-27
@@ -7,31 +7,31 @@ echo "node version is:"
|
||||
which node
|
||||
node -v
|
||||
|
||||
if [[ ${PUBLISH} == 'On' ]]; then
|
||||
echo "PUBLISH is set to '${PUBLISH}', publishing!"
|
||||
NPM_FLAGS=''
|
||||
if [[ ${BUILD_TYPE} == "Debug" ]]; then
|
||||
NPM_FLAGS='--debug'
|
||||
fi
|
||||
|
||||
echo "dumping binary meta..."
|
||||
./node_modules/.bin/node-pre-gyp reveal $NPM_FLAGS
|
||||
|
||||
# enforce that binary has proper ORIGIN flags so that
|
||||
# it can portably find libtbb.so in the same directory
|
||||
if [[ $(uname -s) == 'Linux' ]]; then
|
||||
readelf -d ./lib/binding/node_osrm.node > readelf-output.txt
|
||||
if grep -q 'Flags: ORIGIN' readelf-output.txt; then
|
||||
echo "Found ORIGIN flag in readelf output"
|
||||
cat readelf-output.txt
|
||||
else
|
||||
echo "*** Error: Could not found ORIGIN flag in readelf output"
|
||||
cat readelf-output.txt
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
./node_modules/.bin/node-pre-gyp package testpackage $NPM_FLAGS
|
||||
else
|
||||
echo "PUBLISH is set to '${PUBLISH}', skipping."
|
||||
NPM_FLAGS=''
|
||||
if [[ ${BUILD_TYPE} == "Debug" ]]; then
|
||||
NPM_FLAGS='--debug'
|
||||
fi
|
||||
|
||||
# append --target_arch in order to handle cross-compilation for Apple Silicon
|
||||
if [[ "$ENABLE_APPLE_SILICON" == "ON" ]]; then
|
||||
NPM_FLAGS="${NPM_FLAGS} --target_arch=arm64"
|
||||
fi
|
||||
|
||||
echo "dumping binary meta..."
|
||||
./node_modules/.bin/node-pre-gyp reveal $NPM_FLAGS
|
||||
|
||||
# enforce that binary has proper ORIGIN flags so that
|
||||
# it can portably find libtbb.so in the same directory
|
||||
if [[ $(uname -s) == 'Linux' ]]; then
|
||||
readelf -d ./lib/binding/node_osrm.node > readelf-output.txt
|
||||
if grep -q 'Flags: ORIGIN' readelf-output.txt; then
|
||||
echo "Found ORIGIN flag in readelf output"
|
||||
cat readelf-output.txt
|
||||
else
|
||||
echo "*** Error: Could not found ORIGIN flag in readelf output"
|
||||
cat readelf-output.txt
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
./node_modules/.bin/node-pre-gyp package testpackage $NPM_FLAGS
|
||||
|
||||
Reference in New Issue
Block a user