From a6922c33755f11d8ee8320a4fcbb8fcbd72229a1 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 00:39:19 +0200 Subject: [PATCH 01/16] fix build --- .github/workflows/linux.yml | 27 ++++++++++++++------------- .github/workflows/mac.yml | 25 +++++++++++++------------ .github/workflows/windows.yml | 25 +++++++++++++------------ node | 2 +- 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c178578..0944833 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,6 +1,7 @@ on: - release: - types: [created] + push: + branches: + - fix-build jobs: build: runs-on: ubuntu-16.04 @@ -13,7 +14,7 @@ jobs: with: python-version: 3.8 - name: Ubuntu dependencies - run: sudo apt-get install libgtk-3-dev + run: sudo apt-get install libgtk-3-dev g++ build-essential - uses: actions/checkout@v2 with: @@ -31,17 +32,17 @@ jobs: cwd: ./node/out/Release files: | ./qode - outPath: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz + outPath: qode-linux-x64-test.tar.gz - uses: actions/upload-artifact@v1 with: - name: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz - path: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz + name: qode-linux-x64-test.tar.gz + path: qode-linux-x64-test.tar.gz - - name: Release - uses: softprops/action-gh-release@master - with: - files: qode-linux-x64-${{github.event.release.tag_name}}.tar.gz - tag_name: ${{ github.event.release.tag_name }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Release + # uses: softprops/action-gh-release@master + # with: + # files: qode-linux-x64-test.tar.gz + # tag_name: ${{ github.event.release.tag_name }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index b5f69fc..34b9f42 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -1,6 +1,7 @@ on: - release: - types: [created] + push: + branches: + - fix-build jobs: build: runs-on: macos-latest @@ -32,17 +33,17 @@ jobs: cwd: ./node/out/Release files: | ./qode - outPath: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz + outPath: qode-darwin-${{ matrix.arch }}-test.tar.gz - uses: actions/upload-artifact@v1 with: - name: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz - path: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz + name: qode-darwin-${{ matrix.arch }}-test.tar.gz + path: qode-darwin-${{ matrix.arch }}-test.tar.gz - - name: Release - uses: softprops/action-gh-release@master - with: - files: qode-darwin-${{ matrix.arch }}-${{github.event.release.tag_name}}.tar.gz - tag_name: ${{ github.event.release.tag_name }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Release + # uses: softprops/action-gh-release@master + # with: + # files: qode-darwin-${{ matrix.arch }}-test.tar.gz + # tag_name: ${{ github.event.release.tag_name }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a0b3735..148141b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,6 +1,7 @@ on: - release: - types: [created] + push: + branches: + - fix-build jobs: build: runs-on: windows-2016 @@ -34,17 +35,17 @@ jobs: ./qode.exe ./qode.lib ./qode.exp - outPath: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz + outPath: qode-win32-x64-test.tar.gz - uses: actions/upload-artifact@v1 with: - name: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz - path: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz + name: qode-win32-x64-test.tar.gz + path: qode-win32-x64-test.tar.gz - - name: Release - uses: softprops/action-gh-release@master - with: - files: qode-win32-x64-${{github.event.release.tag_name}}.tar.gz - tag_name: ${{ github.event.release.tag_name }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Release + # uses: softprops/action-gh-release@master + # with: + # files: qode-win32-x64-test.tar.gz + # tag_name: ${{ github.event.release.tag_name }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/node b/node index af564e0..82bfe94 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit af564e0ab09f43cda3b4838a5e5d582241718269 +Subproject commit 82bfe94214e245a1a917aaa1eb1651c3d6dfaa29 From a3dcd357436630b264d2a0d53c241e174cbccd83 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 00:42:11 +0200 Subject: [PATCH 02/16] bump ubuntu --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0944833..c04ea9b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -4,7 +4,7 @@ on: - fix-build jobs: build: - runs-on: ubuntu-16.04 + runs-on: ubuntu-20.04 steps: - uses: actions/setup-node@master with: From c9d297eb1f2252235b6764a8fa534084d96eac93 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 00:42:38 +0200 Subject: [PATCH 03/16] bump --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c04ea9b..a96e2c3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -4,7 +4,7 @@ on: - fix-build jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 steps: - uses: actions/setup-node@master with: From 6fd7648a61e0bcc363ed5f7f5d14641709db8d95 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 00:43:50 +0200 Subject: [PATCH 04/16] bump --- .github/workflows/mac.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 34b9f42..3f435db 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -20,7 +20,10 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.ref }} - + + - name: Install dependencies + run: brew install ninja + - name: Build Qode binary run: TARGET_ARCH=${{ matrix.arch }} node build.js env: From 2b4bdec021acd7222587ec3669274861844169fb Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 00:45:53 +0200 Subject: [PATCH 05/16] fix build --- node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node b/node index 82bfe94..8ac914f 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit 82bfe94214e245a1a917aaa1eb1651c3d6dfaa29 +Subproject commit 8ac914faa570b59289b5648b005eebff9355a77e From c6e8d9bf75eb941a0e78ff6688a32fa7d02b6df7 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 00:48:42 +0200 Subject: [PATCH 06/16] adds ninja --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a96e2c3..6edc1c0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,7 +14,7 @@ jobs: with: python-version: 3.8 - name: Ubuntu dependencies - run: sudo apt-get install libgtk-3-dev g++ build-essential + run: sudo apt-get install libgtk-3-dev g++ build-essential ninja-build - uses: actions/checkout@v2 with: From f15c303366eb002f5205c0c1a9037966ea064d2b Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 08:29:52 +0200 Subject: [PATCH 07/16] install deps --- .github/workflows/linux.yml | 3 ++- .github/workflows/mac.yml | 4 ++-- .github/workflows/windows.yml | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6edc1c0..f0d7bb9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -13,6 +13,7 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.8 + - name: Ubuntu dependencies run: sudo apt-get install libgtk-3-dev g++ build-essential ninja-build @@ -29,7 +30,7 @@ jobs: uses: a7ul/tar-action@v1.0.2 with: command: c - cwd: ./node/out/Release + cwd: ./out/Release files: | ./qode outPath: qode-linux-x64-test.tar.gz diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 3f435db..05069d3 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -7,7 +7,7 @@ jobs: runs-on: macos-latest strategy: matrix: - arch: ['x64', 'arm64'] + arch: ['x64'] steps: - uses: actions/setup-node@master @@ -33,7 +33,7 @@ jobs: uses: a7ul/tar-action@v1.0.2 with: command: c - cwd: ./node/out/Release + cwd: ./out/Release files: | ./qode outPath: qode-darwin-${{ matrix.arch }}-test.tar.gz diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 148141b..5a559c4 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,6 +15,9 @@ jobs: python-version: 3.8 - name: "Setup NASM for windows" uses: ilammy/setup-nasm@v1 + + - name: "Install deps" + run: choco install ninja - uses: actions/checkout@v2 with: @@ -30,7 +33,7 @@ jobs: id: compress with: command: c - cwd: ./node/out/Release + cwd: ./out/Release files: | ./qode.exe ./qode.lib From a48fd3276fff570a3aca0bf0e75d5a7a19f97217 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 08:40:34 +0200 Subject: [PATCH 08/16] upgrades windows --- .github/workflows/linux.yml | 2 +- .github/workflows/mac.yml | 2 +- .github/workflows/windows.yml | 2 +- .gitignore | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f0d7bb9..550ce9f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,7 +1,7 @@ on: push: branches: - - fix-build + - fix-build2 jobs: build: runs-on: ubuntu-18.04 diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 05069d3..d787ab3 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -1,7 +1,7 @@ on: push: branches: - - fix-build + - fix-build2 jobs: build: runs-on: macos-latest diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5a559c4..3117cbb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -4,7 +4,7 @@ on: - fix-build jobs: build: - runs-on: windows-2016 + runs-on: windows-2019 steps: - uses: actions/setup-node@master with: diff --git a/.gitignore b/.gitignore index 47098e8..0526145 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.swp /out +/out2 .vscode *.vcproj arch.gypi \ No newline at end of file From 334b165705122493fd6be504a363eb8c5c07b9ec Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 08:50:46 +0200 Subject: [PATCH 09/16] bump --- node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node b/node index 8ac914f..4f492d4 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit 8ac914faa570b59289b5648b005eebff9355a77e +Subproject commit 4f492d4e8f22aae54e30ac2b26ee6805b6b66425 From 6aaa097b9949b77e09a0356b9784dddf541e209b Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 09:00:20 +0200 Subject: [PATCH 10/16] fix --- node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node b/node index 4f492d4..33eda05 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit 4f492d4e8f22aae54e30ac2b26ee6805b6b66425 +Subproject commit 33eda05d0fb6955be8a9e632f259bd5b0dfa8a4d From 1214be0a9f636a704a41c2a9fb395c1503105fd5 Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 23:20:07 +0200 Subject: [PATCH 11/16] adds cross compile for mac --- .github/workflows/mac.yml | 2 +- build.js | 23 ++++++++++++++++------- node | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index d787ab3..295b752 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -7,7 +7,7 @@ jobs: runs-on: macos-latest strategy: matrix: - arch: ['x64'] + arch: ['x64', 'arm64'] steps: - uses: actions/setup-node@master diff --git a/build.js b/build.js index 6cd5c4e..894f1dc 100755 --- a/build.js +++ b/build.js @@ -55,16 +55,25 @@ if (process.platform === 'win32') { process.env.GYP_MSVS_OVERRIDE_PATH = vs.installationPath } +function archConvert(arch = "arm64"){ + if(arch === "arm64"){ + return "arm64"; + } + return "x86_64"; +} + // Required for cross compilation on macOS. if (host_arch !== target_arch && process.platform === 'darwin') { process.env.GYP_CROSSCOMPILE = '1' - Object.assign(process.env, { - CC: `cc -arch ${target_arch}`, - CXX: `c++ -arch ${target_arch}`, - CC_target: `cc -arch ${target_arch}`, - CXX_target: `c++ -arch ${target_arch}`, - CC_host: 'cc -arch x86_64', - CXX_host: 'c++ -arch x86_64', + const compileTargetArch = archConvert(target_arch); + const compileHostArch = archConvert(host_arch); + Object.assign(process.env, { + CC: `cc -arch ${compileTargetArch}`, + CXX: `c++ -arch ${compileTargetArch}`, + CC_target: `cc -arch ${compileTargetArch}`, + CXX_target: `c++ -arch ${compileTargetArch}`, + CC_host: `cc -arch ${compileHostArch}`, + CXX_host: `c++ -arch ${compileHostArch}`, }) } diff --git a/node b/node index 33eda05..9aaac5c 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit 33eda05d0fb6955be8a9e632f259bd5b0dfa8a4d +Subproject commit 9aaac5c2c309cea8bec473178efdd1dcd6f77795 From e6ceffdae0ba39a9111781c8317bc7c2cf49f0bb Mon Sep 17 00:00:00 2001 From: Atul R Date: Mon, 2 Aug 2021 23:20:27 +0200 Subject: [PATCH 12/16] adds cross compile for mac --- .github/workflows/mac.yml | 2 +- .github/workflows/windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 295b752..a5cbb7d 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -1,7 +1,7 @@ on: push: branches: - - fix-build2 + - fix-build jobs: build: runs-on: macos-latest diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3117cbb..45c1870 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,7 +1,7 @@ on: push: branches: - - fix-build + - fix-build2 jobs: build: runs-on: windows-2019 From 2c4a6c08c960f189aac248e381846d58ddbea10d Mon Sep 17 00:00:00 2001 From: Atul R Date: Tue, 3 Aug 2021 09:27:02 +0200 Subject: [PATCH 13/16] test linux cross platform build --- .github/workflows/linux.yml | 15 +++++++++------ .github/workflows/mac.yml | 2 +- build.js | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 550ce9f..ff52f3c 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,10 +1,13 @@ on: push: branches: - - fix-build2 + - fix-build jobs: build: runs-on: ubuntu-18.04 + strategy: + matrix: + arch: ['x64', 'arm64'] steps: - uses: actions/setup-node@master with: @@ -22,7 +25,7 @@ jobs: ref: ${{ github.ref }} - name: Build Qode binary - run: node build.js + run: TARGET_ARCH=${{ matrix.arch }} node build.js env: SYNC_GIT_SUBMODULE: 1 @@ -33,17 +36,17 @@ jobs: cwd: ./out/Release files: | ./qode - outPath: qode-linux-x64-test.tar.gz + outPath: qode-linux-${{ matrix.arch }}-test.tar.gz - uses: actions/upload-artifact@v1 with: - name: qode-linux-x64-test.tar.gz - path: qode-linux-x64-test.tar.gz + name: qode-linux-${{ matrix.arch }}-test.tar.gz + path: qode-linux-${{ matrix.arch }}-test.tar.gz # - name: Release # uses: softprops/action-gh-release@master # with: - # files: qode-linux-x64-test.tar.gz + # files: qode-linux-${{ matrix.arch }}-test.tar.gz # tag_name: ${{ github.event.release.tag_name }} # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index a5cbb7d..295b752 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -1,7 +1,7 @@ on: push: branches: - - fix-build + - fix-build2 jobs: build: runs-on: macos-latest diff --git a/build.js b/build.js index 894f1dc..0ebbcad 100755 --- a/build.js +++ b/build.js @@ -63,7 +63,7 @@ function archConvert(arch = "arm64"){ } // Required for cross compilation on macOS. -if (host_arch !== target_arch && process.platform === 'darwin') { +if (host_arch !== target_arch && ['darwin', 'linux'].includes(process.platform)) { process.env.GYP_CROSSCOMPILE = '1' const compileTargetArch = archConvert(target_arch); const compileHostArch = archConvert(host_arch); From c9a3f6961a9fbb9ec13b5190b67d933859d3b864 Mon Sep 17 00:00:00 2001 From: Atul R Date: Tue, 3 Aug 2021 09:34:53 +0200 Subject: [PATCH 14/16] try cross compile linux --- .github/workflows/linux.yml | 2 +- build.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ff52f3c..d0be27a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -18,7 +18,7 @@ jobs: python-version: 3.8 - name: Ubuntu dependencies - run: sudo apt-get install libgtk-3-dev g++ build-essential ninja-build + run: sudo apt-get install libgtk-3-dev g++ build-essential ninja-build gcc-aarch64-linux-gnu g++-aarch64-linux-gnu build-essential autoconf libtool cmake pkg-config git python-dev swig3.0 libpcre3-dev nodejs-dev - uses: actions/checkout@v2 with: diff --git a/build.js b/build.js index 0ebbcad..7cac378 100755 --- a/build.js +++ b/build.js @@ -63,7 +63,7 @@ function archConvert(arch = "arm64"){ } // Required for cross compilation on macOS. -if (host_arch !== target_arch && ['darwin', 'linux'].includes(process.platform)) { +if (host_arch !== target_arch && ['darwin'].includes(process.platform)) { process.env.GYP_CROSSCOMPILE = '1' const compileTargetArch = archConvert(target_arch); const compileHostArch = archConvert(host_arch); @@ -77,6 +77,21 @@ if (host_arch !== target_arch && ['darwin', 'linux'].includes(process.platform)) }) } +// Required for cross compilation on linux. +if (host_arch !== target_arch && ['linux'].includes(process.platform)) { + process.env.GYP_CROSSCOMPILE = '1' + const compileTargetArch = archConvert(target_arch); + const compileHostArch = archConvert(host_arch); + Object.assign(process.env, { + CC: `aarch64-linux-gnu-gcc`, + CXX: `aarch64-linux-gnu-g++`, + CC_target: `aarch64-linux-gnu-gcc`, + CXX_target: `aarch64-linux-gnu-g++`, + CC_host: `gcc`, + CXX_host: `g++`, + }) +} + // Generate some dynamic gyp files. execSync(`python3 configure --with-intl=small-icu --openssl-no-asm --dest-cpu=${target_arch}`, { From 345e9adadaf27f6bc4cf29295e69cd016dbaf3ee Mon Sep 17 00:00:00 2001 From: Atul R Date: Tue, 3 Aug 2021 10:33:03 +0200 Subject: [PATCH 15/16] format --- build.js | 92 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/build.js b/build.js index 7cac378..1ba30fa 100755 --- a/build.js +++ b/build.js @@ -2,8 +2,8 @@ const path = require("path"); const os = require("os"); -const cp = require('child_process'); -const fs = require('fs'); +const cp = require("child_process"); +const fs = require("fs"); const HOST_ARCH = os.arch(); //================================== @@ -44,75 +44,83 @@ if (process.env.SYNC_GIT_SUBMODULE) { } // Find out where VS is installed. -if (process.platform === 'win32') { - const vswhere = path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio', 'Installer', 'vswhere.exe') - const args = ['-format', 'json'] - const result = JSON.parse(String(cp.execFileSync(vswhere, args))) - if (result.length == 0) - throw new Error('Unable to find Visual Studio') - const vs = result[0] - process.env.GYP_MSVS_VERSION = vs.displayName.match(/(\d+)$/)[1] - process.env.GYP_MSVS_OVERRIDE_PATH = vs.installationPath -} - -function archConvert(arch = "arm64"){ - if(arch === "arm64"){ - return "arm64"; - } - return "x86_64"; +if (process.platform === "win32") { + const vswhere = path.join( + process.env["ProgramFiles(x86)"], + "Microsoft Visual Studio", + "Installer", + "vswhere.exe" + ); + const args = ["-format", "json"]; + const result = JSON.parse(String(cp.execFileSync(vswhere, args))); + if (result.length == 0) throw new Error("Unable to find Visual Studio"); + const vs = result[0]; + process.env.GYP_MSVS_VERSION = vs.displayName.match(/(\d+)$/)[1]; + process.env.GYP_MSVS_OVERRIDE_PATH = vs.installationPath; } // Required for cross compilation on macOS. -if (host_arch !== target_arch && ['darwin'].includes(process.platform)) { - process.env.GYP_CROSSCOMPILE = '1' +if (host_arch !== target_arch && ["darwin"].includes(process.platform)) { + function archConvert(arch = "arm64") { + if (arch === "arm64") { + return "arm64"; + } + return "x86_64"; + } + process.env.GYP_CROSSCOMPILE = "1"; const compileTargetArch = archConvert(target_arch); const compileHostArch = archConvert(host_arch); - Object.assign(process.env, { + Object.assign(process.env, { CC: `cc -arch ${compileTargetArch}`, CXX: `c++ -arch ${compileTargetArch}`, CC_target: `cc -arch ${compileTargetArch}`, CXX_target: `c++ -arch ${compileTargetArch}`, CC_host: `cc -arch ${compileHostArch}`, CXX_host: `c++ -arch ${compileHostArch}`, - }) + }); } // Required for cross compilation on linux. -if (host_arch !== target_arch && ['linux'].includes(process.platform)) { - process.env.GYP_CROSSCOMPILE = '1' - const compileTargetArch = archConvert(target_arch); - const compileHostArch = archConvert(host_arch); - Object.assign(process.env, { +if (host_arch !== target_arch && ["linux"].includes(process.platform)) { + process.env.GYP_CROSSCOMPILE = "1"; + Object.assign(process.env, { CC: `aarch64-linux-gnu-gcc`, CXX: `aarch64-linux-gnu-g++`, CC_target: `aarch64-linux-gnu-gcc`, CXX_target: `aarch64-linux-gnu-g++`, CC_host: `gcc`, CXX_host: `g++`, - }) + }); } - // Generate some dynamic gyp files. -execSync(`python3 configure --with-intl=small-icu --openssl-no-asm --dest-cpu=${target_arch}`, { - cwd: "node" -}); +execSync( + `python3 configure --with-intl=small-icu --openssl-no-asm --dest-cpu=${target_arch}`, + { + cwd: "node", + } +); // Update the build configuration. const config = { variables: { target_arch, host_arch, - want_separate_host_toolset: host_arch === target_arch ? 0 : 1 - } -} -if (process.platform === 'darwin') { + want_separate_host_toolset: host_arch === target_arch ? 0 : 1, + }, +}; +if (process.platform === "darwin") { // Set SDK version to the latest installed. - const sdks = String(execSync('xcodebuild -showsdks', {stdio: null})).trim() - const SDKROOT = sdks.match(/-sdk (macosx\d+\.\d+)/)[1] - config.xcode_settings = {SDKROOT} + const sdks = String(execSync("xcodebuild -showsdks", { stdio: null })).trim(); + const SDKROOT = sdks.match(/-sdk (macosx\d+\.\d+)/)[1]; + config.xcode_settings = { SDKROOT }; } -fs.writeFileSync(path.join(__dirname, 'arch.gypi'), JSON.stringify(config, null, ' ')) -execSync('python3 node/tools/gyp/gyp_main.py qode.gyp --no-parallel -f ninja -Iarch.gypi -Icommon.gypi --depth .') +fs.writeFileSync( + path.join(__dirname, "arch.gypi"), + JSON.stringify(config, null, " ") +); +execSync( + "python3 node/tools/gyp/gyp_main.py qode.gyp --no-parallel -f ninja -Iarch.gypi -Icommon.gypi --depth ." +); // Build. const epath = `${path.join("..", "bin", "ninja")}${path.delimiter}${ @@ -120,5 +128,5 @@ const epath = `${path.join("..", "bin", "ninja")}${path.delimiter}${ }`; execSync(`ninja -j${os.cpus().length} -C out/Release qode`, { - env: { PATH: epath } + env: { PATH: epath }, }); From 7147084a5ab7ceff67895b469773b2257993a78e Mon Sep 17 00:00:00 2001 From: Atul R Date: Tue, 3 Aug 2021 22:24:41 +0200 Subject: [PATCH 16/16] switch to glib --- .github/workflows/linux.yml | 2 +- qode.gyp | 4 ++-- src/integration/node_integration_linux.cc | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d0be27a..9516d54 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-18.04 strategy: matrix: - arch: ['x64', 'arm64'] + arch: ['x64'] steps: - uses: actions/setup-node@master with: diff --git a/qode.gyp b/qode.gyp index 4a49d99..8ec4bfb 100644 --- a/qode.gyp +++ b/qode.gyp @@ -97,10 +97,10 @@ 'src/integration/node_integration_linux.cc', ], 'libraries': [ - ' +#include #include namespace qode {