mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 05:29:08 +00:00
nodejs: add and fix windows (#6581)
* simplex-chat-nodejs: adjust binding.gyp for windows * simplex-chat-nodejs: different library linkage for windows * simplex-chat-nodejs: remove non-moving GC in Windows "non-moving GC is broken on windows with GHC 9.4-9.6.3" from: https://github.com/simplex-chat/simplex-chat/blob/master/apps/multiplatform/common/src/commonMain/cpp/desktop/simplex-api.c#L11-L17 * ci: add windows to release-nodejs-libs * simplex-chat-nodejs: same curl flags for dll.def download
This commit is contained in:
@@ -605,6 +605,9 @@ jobs:
|
||||
- name: Checkout current repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install packages for archiving
|
||||
run: sudo apt install -y msitools gcc-mingw-w64
|
||||
|
||||
- name: Build archives
|
||||
run: |
|
||||
INIT_DIR='${{ runner.temp }}/artifacts'
|
||||
@@ -612,6 +615,8 @@ jobs:
|
||||
TAG='${{ github.ref_name }}'
|
||||
URL='https://github.com/${{ github.repository }}/releases/download'
|
||||
PREFIX='${{ github.event.repository.name }}-libs'
|
||||
# Windows-specific
|
||||
FILE_URL='https://raw.githubusercontent.com/${{ github.repository }}/refs/tags/${{ github.ref_name }}'
|
||||
|
||||
# Setup directories
|
||||
mkdir "$INIT_DIR" "$RELEASE_DIR" && cd "$INIT_DIR"
|
||||
@@ -620,6 +625,7 @@ jobs:
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-ubuntu-22_04-x86_64.deb" -o linux.deb
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-macos-aarch64.dmg" -o macos-aarch64.dmg
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-macos-x86_64.dmg" -o macos-x86_64.dmg
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-windows-x86_64.msi" -o windows-x86_64.msi
|
||||
|
||||
# Linux
|
||||
# -----
|
||||
@@ -646,6 +652,18 @@ jobs:
|
||||
zip -r "${PREFIX}-macos-x86_64.zip" libs
|
||||
mv "${PREFIX}-macos-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
|
||||
|
||||
# Windows: x86_64
|
||||
# ---------------
|
||||
msiextract windows-x86_64.msi -C windows-out && cd windows-out/SimpleX/app/resources
|
||||
|
||||
# We need to generate library that exports symbols from Windows dll
|
||||
curl --proto '=https' --tlsv1.2 -sSf -LO "${FILE_URL}/libsimplex.dll.def"
|
||||
x86_64-w64-mingw32-dlltool -d libsimplex.dll.def -l libsimplex.lib -D libsimplex.dll
|
||||
|
||||
mkdir libs && cp *.dll *.lib libs/
|
||||
zip -r "${PREFIX}-windows-x86_64.zip" libs
|
||||
mv "${PREFIX}-windows-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
|
||||
|
||||
- name: Create release in libs repo and upload artifacts
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
"dependencies": [
|
||||
"<!(node -p \"require('node-addon-api').gyp\")"
|
||||
],
|
||||
"libraries": [
|
||||
"-L<(module_root_dir)/libs",
|
||||
"-lsimplex"
|
||||
],
|
||||
"cflags!": [ "-fno-exceptions" ],
|
||||
"cflags_cc!": [ "-fno-exceptions" ],
|
||||
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
|
||||
"conditions": [
|
||||
["OS=='mac'", {
|
||||
"libraries": [
|
||||
"-L<(module_root_dir)/libs",
|
||||
"-lsimplex"
|
||||
],
|
||||
"xcode_settings": {
|
||||
"OTHER_LDFLAGS": [
|
||||
"-Wl,-rpath,@loader_path/../../libs"
|
||||
@@ -25,9 +25,24 @@
|
||||
}
|
||||
}],
|
||||
["OS=='linux'", {
|
||||
"libraries": [
|
||||
"-L<(module_root_dir)/libs",
|
||||
"-lsimplex"
|
||||
],
|
||||
"ldflags": [
|
||||
"-Wl,-rpath,'$$ORIGIN'/../../libs"
|
||||
]
|
||||
}],
|
||||
["OS=='win'", {
|
||||
"libraries": [
|
||||
"<(module_root_dir)/libs/libsimplex.lib"
|
||||
],
|
||||
"copies": [{
|
||||
"destination": "<(PRODUCT_DIR)",
|
||||
"files": [
|
||||
"<(module_root_dir)/libs/*"
|
||||
]
|
||||
}]
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,6 +10,17 @@ namespace simplex {
|
||||
using namespace Napi;
|
||||
|
||||
void haskell_init() {
|
||||
#ifdef _WIN32
|
||||
// non-moving GC is broken on windows with GHC 9.4-9.6.3
|
||||
int argc = 5;
|
||||
const char *argv[] = {
|
||||
"simplex",
|
||||
"+RTS", // requires `hs_init_with_rtsopts`
|
||||
"-A64m", // chunk size for new allocations
|
||||
"-H64m", // initial heap size
|
||||
"--install-signal-handlers=no",
|
||||
nullptr};
|
||||
#else
|
||||
int argc = 6;
|
||||
const char *argv[] = {
|
||||
"simplex",
|
||||
@@ -19,6 +30,7 @@ void haskell_init() {
|
||||
"-xn", // non-moving GC
|
||||
"--install-signal-handlers=no",
|
||||
nullptr};
|
||||
#endif
|
||||
char **pargv = const_cast<char **>(argv);
|
||||
hs_init_with_rtsopts(&argc, &pargv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user