forked from pact-foundation/pact-js-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
250 additions
and
159 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
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 |
---|---|---|
|
@@ -66,6 +66,7 @@ standalone/*.gz | |
standalone/README.md | ||
# FFI native bindings | ||
*.so | ||
*.a | ||
*.dll* | ||
*.dylib | ||
pact.h | ||
|
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,181 @@ | ||
{ | ||
"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": [ | ||
"<(module_root_dir)/ffi/linux-x86_64/libpact_ffi.a" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["./ffi/linux-x86_64/libpact_ffi.a"], | ||
"destination": "prebuilds/linux-x64" | ||
}], | ||
} | ||
], | ||
[ | ||
"OS==\"linux\" and target_arch ==\"arm64\" and is_alpine ==\"true\"", | ||
{ | ||
"link_settings": { | ||
"libraries": [ | ||
"<(module_root_dir)/ffi/linux-aarch64/libpact_ffi.a" | ||
] | ||
}, | ||
"copies": [{ | ||
"files": ["./ffi/linux-aarch64/libpact_ffi.a"], | ||
"destination": "prebuilds/linux-arm64" | ||
}], | ||
} | ||
], | ||
[ | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh -eu | ||
|
||
rm -rf node_modules | ||
docker run -v $PWD:/home --platform=linux/amd64 --rm -it node:alpine bin/sh -c 'apk add bash curl python3 make g++ && cd /home && /home/script/ci/prebuild-alpine.sh && npm run build && npm test' | ||
rm -rf node_modules | ||
docker run -v $PWD:/home --platform=linux/arm64 --rm -it node:alpine bin/sh -c 'apk add bash curl python3 make g++ && cd /home && /home/script/ci/prebuild-alpine.sh && npm run build && npm test' |
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,16 @@ | ||
#!/bin/bash -eu | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running | ||
|
||
node --version | ||
npm --version | ||
PREBUILDIFY_VERSION=5.0.1 | ||
|
||
cd /home | ||
|
||
. "${SCRIPT_DIR}/../lib/export-binary-versions.sh" | ||
"${SCRIPT_DIR}/../lib/download-ffi.sh" | ||
apk add bash curl python3 make g++ | ||
npm ci --ignore-scripts | ||
npx --yes prebuildify@${PREBUILDIFY_VERSION} --napi --libc musl --tag-libc | ||
ls prebuilds/**/* | ||
rm -rf ffi build |
Oops, something went wrong.