-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide musl arm64/x86_64 prebuilds
Showing
4 changed files
with
239 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,150 +1,185 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "pact", | ||
"sources": [ | ||
"native/addon.cc", | ||
"native/ffi.cc", | ||
"native/consumer.cc", | ||
"native/provider.cc", | ||
"native/plugin.cc" | ||
], | ||
"include_dirs": [ | ||
"<!(node -p \"require('node-addon-api').include_dir\")", | ||
"<(module_root_dir)/native", | ||
"<(module_root_dir)/ffi", | ||
], | ||
"conditions": [ | ||
[ | ||
"OS=='win'", | ||
{ | ||
"libraries": [ | ||
"<(module_root_dir)/ffi/pact_ffi.dll.lib" | ||
"variables": { | ||
"is_alpine": "<!(grep -q Alpine /etc/os-release && echo true || echo false)" | ||
}, | ||
"targets": [ | ||
{ | ||
"target_name": "pact", | ||
"sources": [ | ||
"native/addon.cc", | ||
"native/ffi.cc", | ||
"native/consumer.cc", | ||
"native/provider.cc", | ||
"native/plugin.cc" | ||
], | ||
"defines": [ | ||
"_HAS_EXCEPTIONS=1" | ||
"include_dirs": [ | ||
"<!(node -p \"require('node-addon-api').include_dir\")", | ||
"<(module_root_dir)/native", | ||
"<(module_root_dir)/ffi", | ||
], | ||
"msvs_settings": { | ||
"VCCLCompilerTool": { | ||
"ExceptionHandling": 1 | ||
} | ||
}, | ||
"copies":[{ | ||
"files": [ "<(module_root_dir)/ffi/pact_ffi.dll"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"mac\" and target_arch ==\"x64\"", | ||
{ | ||
"xcode_settings": { | ||
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES", | ||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
"GCC_TREAT_WARNINGS_AS_ERRORS": "YES", | ||
"CLANG_CXX_LIBRARY": "libc++", | ||
"MACOSX_DEPLOYMENT_TARGET": "10.7" | ||
}, | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi", | ||
"-Wl,-rpath,@loader_path" | ||
] | ||
}, | ||
"copies":[{ | ||
"files": [ "<(module_root_dir)/ffi/libpact_ffi.dylib"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"mac\" and target_arch ==\"arm64\"", | ||
{ | ||
"xcode_settings": { | ||
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES", | ||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
"GCC_TREAT_WARNINGS_AS_ERRORS": "YES", | ||
"CLANG_CXX_LIBRARY": "libc++", | ||
"MACOSX_DEPLOYMENT_TARGET": "10.7" | ||
}, | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi", | ||
"-Wl,-rpath,@loader_path" | ||
] | ||
}, | ||
"copies":[{ | ||
"files": [ "<(module_root_dir)/ffi/osxaarch64/libpact_ffi.dylib"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"x64\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi", | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
] | ||
}, | ||
"copies":[{ | ||
"files": [ "<(module_root_dir)/ffi/libpact_ffi.so"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"arm64\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi/linuxaarch64", | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
] | ||
}, | ||
"copies":[{ | ||
"files": [ "<(module_root_dir)/ffi/linuxaarch64/libpact_ffi.so"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
] | ||
], | ||
"library_dirs": [ | ||
"<(module_root_dir)/native" | ||
], | ||
"cflags_cc!": [ | ||
"-fno-exceptions", | ||
], | ||
"cflags_cc": [ "-Werror" ], | ||
"defines": [ | ||
"NAPI_CPP_EXCEPTIONS" | ||
] | ||
}, | ||
# Need to set the library install name to enable the rpath settings to work on OSX | ||
{ | ||
"target_name": "set_osx_install_name", | ||
"dependencies": ["pact"], | ||
"type": "none", | ||
"target_conditions":[ | ||
[ | ||
"OS==\"mac\"", | ||
{ | ||
"actions": [ | ||
{ | ||
"action_name": "modify install_name on osx", | ||
"inputs": ["<(module_root_dir)/build/Release/pact.node"], | ||
"outputs": ["<(module_root_dir)/build/Release/pact.node"], | ||
'action': ['install_name_tool', '-change', 'libpact_ffi.dylib', '@rpath/libpact_ffi.dylib', '<(module_root_dir)/build/Release/pact.node'], | ||
} | ||
"conditions": [ | ||
[ | ||
"OS=='win'", | ||
{ | ||
"libraries": [ | ||
"<(module_root_dir)/ffi/windows-x86_64/pact_ffi.dll.lib" | ||
], | ||
"defines": [ | ||
"_HAS_EXCEPTIONS=1" | ||
], | ||
"msvs_settings": { | ||
"VCCLCompilerTool": { | ||
"ExceptionHandling": 1 | ||
} | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/windows-x86_64/pact_ffi.dll"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"mac\" and target_arch ==\"x64\"", | ||
{ | ||
"xcode_settings": { | ||
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES", | ||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
"GCC_TREAT_WARNINGS_AS_ERRORS": "YES", | ||
"CLANG_CXX_LIBRARY": "libc++", | ||
"MACOSX_DEPLOYMENT_TARGET": "10.7" | ||
}, | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi", | ||
"-Wl,-rpath,@loader_path" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/osx-x86_64/libpact_ffi.dylib"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"mac\" and target_arch ==\"arm64\"", | ||
{ | ||
"xcode_settings": { | ||
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES", | ||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
"GCC_TREAT_WARNINGS_AS_ERRORS": "YES", | ||
"CLANG_CXX_LIBRARY": "libc++", | ||
"MACOSX_DEPLOYMENT_TARGET": "10.7" | ||
}, | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi", | ||
"-Wl,-rpath,@loader_path" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/osx-aarch64/libpact_ffi.dylib"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"x64\" and is_alpine ==\"true\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi_musl", | ||
"-L<(module_root_dir)/ffi/linux-musl-x86_64/", | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/linux-musl-x86_64/libpact_ffi_musl.so"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"arm64\" and is_alpine ==\"true\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi_musl", | ||
"-L<(module_root_dir)/ffi/linux-musl-aarch64/", | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/linux-musl-aarch64/libpact_ffi_musl.so"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"x64\" and is_alpine ==\"false\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi/linux-x86_64/", | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/linux-x86_64/libpact_ffi.so"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"arm64\" and is_alpine ==\"false\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"-lpact_ffi", | ||
"-L<(module_root_dir)/ffi/linux-aarch64", | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["<(module_root_dir)/ffi/linux-aarch64/libpact_ffi.so"], | ||
"destination": "<(PRODUCT_DIR)" | ||
}], | ||
} | ||
], | ||
], | ||
"library_dirs": [ | ||
"<(module_root_dir)/native" | ||
], | ||
"cflags_cc!": [ | ||
"-fno-exceptions", | ||
], | ||
"cflags_cc": ["-Werror"], | ||
"defines": [ | ||
"NAPI_CPP_EXCEPTIONS" | ||
] | ||
}, | ||
# Need to set the library install name to enable the rpath settings to work on OSX | ||
{ | ||
"target_name": "set_osx_install_name", | ||
"dependencies": ["pact"], | ||
"type": "none", | ||
"target_conditions": [ | ||
[ | ||
"OS==\"mac\"", | ||
{ | ||
"actions": [ | ||
{ | ||
"action_name": "modify install_name on osx", | ||
"inputs": ["<(module_root_dir)/build/Release/pact.node"], | ||
"outputs": ["<(module_root_dir)/build/Release/pact.node"], | ||
'action': ['install_name_tool', '-change', 'libpact_ffi.dylib', '@rpath/libpact_ffi.dylib', '<(module_root_dir)/build/Release/pact.node'], | ||
} | ||
] | ||
} | ||
] | ||
] | ||
} | ||
] | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash -eu | ||
SCRIPT_DIR="$(cd "$(dirname "${0}")"; pwd)" # Figure out where the script is running | ||
|
||
node --version | ||
npm --version | ||
PREBUILDIFY_VERSION=6.0.1 | ||
NODE_VERSION=$(node -p process.version) | ||
PREBUILD_NAME="node.napi" | ||
|
||
apk add bash curl python3 make g++ | ||
|
||
. "${SCRIPT_DIR}/../lib/export-binary-versions.sh" | ||
"${SCRIPT_DIR}/../lib/download-ffi.sh" | ||
rm -rf build node_modules | ||
npm ci --ignore-scripts | ||
export npm_config_target=${NODE_VERSION} | ||
|
||
npx --yes prebuildify@${PREBUILDIFY_VERSION} --napi --libc musl --strip --tag-libc --name ${PREBUILD_NAME} | ||
ls prebuilds/**/* | ||
ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') | ||
case $ARCH in | ||
aarch64) | ||
echo "aarch64" | ||
tar -czf prebuilds/linux-arm64-musl.tar.gz prebuilds/linux-arm64 | ||
;; | ||
x86_64) | ||
tar -czf prebuilds/linux-x64-musl.tar.gz prebuilds/linux-x64 | ||
;; | ||
*) | ||
echo "Unsupported architecture: $ARCH" | ||
exit 1 | ||
;; | ||
esac | ||
rm -rf ffi build |
Oops, something went wrong.