From 851e9fbcafb12beb182ba1648286cc3cde9418a5 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Tue, 7 Jan 2025 13:28:19 -0700 Subject: [PATCH 01/28] add nodejs v22 and v23 to build matrix --- .github/workflows/build.yml | 2 +- README.md | 2 ++ package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 354520d..16d0e01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - { os: macos-latest, target: "macos", arch: "x64" } - { os: macos-latest, target: "macos", arch: "arm64" } - node_ver: [ 16, 18, 19, 20, 21] + node_ver: [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false steps: diff --git a/README.md b/README.md index d395a6e..1c7a665 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ The `@openziti/ziti-sdk-nodejs` module works with the following Node.js versions - v19.x - v20.x - v21.x +- v22.x +- v23.x The `@openziti/ziti-sdk-nodejs` module works with the following architectures: - amd64 diff --git a/package.json b/package.json index e2efabb..12c43e3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@openziti/ziti-sdk-nodejs", "description": "A NodeJS-based SDK for delivering secure applications over a Ziti Network", - "version": "0.17.0", + "version": "0.18.0", "main": "./lib/ziti", "scripts": { "build": "npm run build:init && npm run build:configure && npm run build:make", From 9448af2a9690a9ef75774f3ef16c34f08e5a0e90 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Tue, 7 Jan 2025 14:27:47 -0700 Subject: [PATCH 02/28] try 'macos-13' --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16d0e01..1b39e56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,8 +43,8 @@ jobs: - { os: windows-latest, target: "windows", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - - { os: macos-latest, target: "macos", arch: "x64" } - - { os: macos-latest, target: "macos", arch: "arm64" } + - { os: macos-13, target: "macos", arch: "x64" } + - { os: macos-13, target: "macos", arch: "arm64" } node_ver: [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false From 22f32edbcef59ffd4f21a8ff1238d9f0d1559280 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 09:03:17 -0700 Subject: [PATCH 03/28] Update c-sdk to latest commit --- deps/ziti-sdk-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/ziti-sdk-c b/deps/ziti-sdk-c index d336721..9a0c55e 160000 --- a/deps/ziti-sdk-c +++ b/deps/ziti-sdk-c @@ -1 +1 @@ -Subproject commit d336721a77f5ab4b50b031d592d581856524c6f3 +Subproject commit 9a0c55e089b4301f77c88417bdd1c8d7bff98834 From d6ae1e6570038b797aa1f5aaf0fa0bfa4f9b9d42 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 10:17:54 -0700 Subject: [PATCH 04/28] adjust for latest c-sdk code changes --- package-lock.json | 4 ++-- src/Ziti_https_request.c | 8 ++++---- src/ziti-nodejs.h | 2 +- src/ziti_enroll.c | 2 +- src/ziti_init.c | 44 ++++++++++++++++++++-------------------- vcpkg.json | 3 ++- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 258d1f4..f6c09b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@openziti/ziti-sdk-nodejs", - "version": "0.15.0", + "version": "0.18.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@openziti/ziti-sdk-nodejs", - "version": "0.15.0", + "version": "0.18.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/src/Ziti_https_request.c b/src/Ziti_https_request.c index 63a5957..07ff3a0 100644 --- a/src/Ziti_https_request.c +++ b/src/Ziti_https_request.c @@ -54,7 +54,7 @@ struct ListMap* newListMap() { uv_mutex_t client_pool_lock; -bool listMapInsert(struct ListMap* collection, char* key, void* value) { +bool listMapInsert(struct ListMap* collection, const char* key, void* value) { if (collection->count == listMapCapacity) { ZITI_NODEJS_LOG(ERROR, "collection->count already at capacity [%d], insert FAIL", listMapCapacity); @@ -214,7 +214,7 @@ static void allocate_client(uv_work_t* req) { } -struct hostname_port* getHostnamePortForService(char* key) { +struct hostname_port* getHostnamePortForService(const char* key) { ZITI_NODEJS_LOG(DEBUG, "getHostnamePortForService() entered, key: %s", key); @@ -239,7 +239,7 @@ struct hostname_port* getHostnamePortForService(char* key) { /** * */ -void track_service_to_hostname(char* service_name, char* hostname, int port) { +void track_service_to_hostname(const char* service_name, char* hostname, int port) { ZITI_NODEJS_LOG(DEBUG, "track_service_to_hostname() entered, service_name: %s hostname: %s port: %d", service_name, hostname, port); @@ -360,7 +360,7 @@ static void CallJs_on_resp_body(napi_env env, napi_value js_cb, void* context, v /** * */ -void on_resp_body(tlsuv_http_req_t *req, const char *body, ssize_t len) { +void on_resp_body(tlsuv_http_req_t *req, char *body, ssize_t len) { // ZITI_NODEJS_LOG(DEBUG, "len: %zd, body is: \n>>>>>%s<<<<<", len, body); ZITI_NODEJS_LOG(DEBUG, "body: %p", body); diff --git a/src/ziti-nodejs.h b/src/ziti-nodejs.h index 1f43f26..339c64a 100644 --- a/src/ziti-nodejs.h +++ b/src/ziti-nodejs.h @@ -228,7 +228,7 @@ extern void expose_ziti_websocket_write(napi_env env, napi_value exports); // extern int tlsuv_websocket_init_with_src (uv_loop_t *loop, tlsuv_websocket_t *ws, tlsuv_src_t *src); -extern void track_service_to_hostname(char* service_name, char* hostname, int port); +extern void track_service_to_hostname(const char* service_name, char* hostname, int port); #ifdef __cplusplus } diff --git a/src/ziti_enroll.c b/src/ziti_enroll.c index e068f1f..da273d6 100644 --- a/src/ziti_enroll.c +++ b/src/ziti_enroll.c @@ -217,7 +217,7 @@ napi_value _ziti_enroll(napi_env env, const napi_callback_info info) { // Initiate the enrollment ziti_enroll_opts opts = {0}; - opts.jwt = JWTFileName; + opts.token = JWTFileName; int rc = ziti_enroll(&opts, thread_loop, on_ziti_enroll, addon_data); status = napi_create_int32(env, rc, &jsRetval); diff --git a/src/ziti_init.c b/src/ziti_init.c index c990f18..02ac847 100644 --- a/src/ziti_init.c +++ b/src/ziti_init.c @@ -33,9 +33,9 @@ static const char *ALL_CONFIG_TYPES[] = { #define ZROK_PROXY_CFG_V1 "zrok.proxy.v1" #define ZROK_PROXY_CFG_V1_MODEL(XX, ...) \ -XX(auth_scheme, string, none, auth_scheme, __VA_ARGS__) \ -XX(basic_auth, string, none, basic_auth, __VA_ARGS__) \ -XX(oauth, string, none, oauth, __VA_ARGS__) +XX(auth_scheme, model_string, none, auth_scheme, __VA_ARGS__) \ +XX(basic_auth, model_string, none, basic_auth, __VA_ARGS__) \ +XX(oauth, model_string, none, oauth, __VA_ARGS__) DECLARE_MODEL(zrok_proxy_cfg_v1, ZROK_PROXY_CFG_V1_MODEL) /** @@ -118,46 +118,46 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) { switch (event->type) { case ZitiContextEvent: - if (event->event.ctx.ctrl_status == ZITI_OK) { + if (event->ctx.ctrl_status == ZITI_OK) { const ziti_version *ctrl_ver = ziti_get_controller_version(_ztx); const ziti_identity *proxy_id = ziti_get_identity(_ztx); ZITI_NODEJS_LOG(INFO, "controller version = %s(%s)[%s]", ctrl_ver->version, ctrl_ver->revision, ctrl_ver->build_date); ZITI_NODEJS_LOG(INFO, "identity = <%s>[%s]@%s", proxy_id->name, proxy_id->id, ziti_get_controller(_ztx)); } else { - ZITI_NODEJS_LOG(ERROR, "Failed to connect to controller: %s", event->event.ctx.err); + ZITI_NODEJS_LOG(ERROR, "Failed to connect to controller: %s", event->ctx.err); } - addon_data->zitiContextEventStatus = event->event.ctx.ctrl_status; + addon_data->zitiContextEventStatus = event->ctx.ctrl_status; break; case ZitiServiceEvent: - if (event->event.service.removed != NULL) { - for (ziti_service **sp = event->event.service.removed; *sp != NULL; sp++) { + if (event->service.removed != NULL) { + for (ziti_service **sp = event->service.removed; *sp != NULL; sp++) { // service_check_cb(ztx, *sp, ZITI_SERVICE_UNAVAILABLE, app_ctx); ZITI_NODEJS_LOG(INFO, "Service removed [%s]", (*sp)->name); } } - if (event->event.service.added != NULL) { - for (ziti_service **sp = event->event.service.added; *sp != NULL; sp++) { + if (event->service.added != NULL) { + for (ziti_service **sp = event->service.added; *sp != NULL; sp++) { // service_check_cb(ztx, *sp, ZITI_OK, app_ctx); ZITI_NODEJS_LOG(INFO, "Service added [%s]", (*sp)->name); } } - if (event->event.service.changed != NULL) { - for (ziti_service **sp = event->event.service.changed; *sp != NULL; sp++) { + if (event->service.changed != NULL) { + for (ziti_service **sp = event->service.changed; *sp != NULL; sp++) { // service_check_cb(ztx, *sp, ZITI_OK, app_ctx); ZITI_NODEJS_LOG(INFO, "Service changed [%s]", (*sp)->name); } } // - for (int i = 0; event->event.service.added && event->event.service.added[i] != NULL; i++) { + for (int i = 0; event->service.added && event->service.added[i] != NULL; i++) { - ziti_service *s = event->event.service.added[i]; + ziti_service *s = event->service.added[i]; ziti_intercept_cfg_v1 *intercept = alloc_ziti_intercept_cfg_v1(); ziti_client_cfg_v1 clt_cfg = { .hostname = {0}, @@ -194,9 +194,9 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) { free(intercept); } - for (int i = 0; event->event.service.changed && event->event.service.changed[i] != NULL; i++) { + for (int i = 0; event->service.changed && event->service.changed[i] != NULL; i++) { - ziti_service *s = event->event.service.changed[i]; + ziti_service *s = event->service.changed[i]; ziti_intercept_cfg_v1 *intercept = alloc_ziti_intercept_cfg_v1(); ziti_client_cfg_v1 clt_cfg = { .hostname = {0}, @@ -238,21 +238,21 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) { break; case ZitiRouterEvent: - switch (event->event.router.status){ + switch (event->router.status){ case EdgeRouterConnected: - ZITI_NODEJS_LOG(INFO, "ziti connected to edge router %s\nversion = %s", event->event.router.name, event->event.router.version); + ZITI_NODEJS_LOG(INFO, "ziti connected to edge router %s\nversion = %s", event->router.name, event->router.version); break; case EdgeRouterDisconnected: - ZITI_NODEJS_LOG(INFO, "ziti disconnected from edge router %s", event->event.router.name); + ZITI_NODEJS_LOG(INFO, "ziti disconnected from edge router %s", event->router.name); break; case EdgeRouterRemoved: - ZITI_NODEJS_LOG(INFO, "ziti removed edge router %s", event->event.router.name); + ZITI_NODEJS_LOG(INFO, "ziti removed edge router %s", event->router.name); break; case EdgeRouterUnavailable: - ZITI_NODEJS_LOG(INFO, "edge router %s is not available", event->event.router.name); + ZITI_NODEJS_LOG(INFO, "edge router %s is not available", event->router.name); break; case EdgeRouterAdded: - ZITI_NODEJS_LOG(INFO, "edge router %s was added", event->event.router.name); + ZITI_NODEJS_LOG(INFO, "edge router %s was added", event->router.name); break; } diff --git a/vcpkg.json b/vcpkg.json index de68e6b..e94e13e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -7,6 +7,7 @@ "platform": "!windows", "$comment": "on windows we link against node binary and Cmake.js provides libuv headers" }, + "libuv", "openssl", "zlib", "llhttp", @@ -16,5 +17,5 @@ ], "features": { }, - "builtin-baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + "builtin-baseline": "b322364f06308bdd24823f9d8f03fe0cc86fd46f" } \ No newline at end of file From 1d1fddb88bfbec4873c6e243a18191c60ef47e3d Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 10:31:20 -0700 Subject: [PATCH 05/28] adjust for latest c-sdk code changes --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index e94e13e..60172da 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -17,5 +17,5 @@ ], "features": { }, - "builtin-baseline": "b322364f06308bdd24823f9d8f03fe0cc86fd46f" + "builtin-baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00" } \ No newline at end of file From ae336e72237032a69cdfb383ea400f479e966f91 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 11:11:32 -0700 Subject: [PATCH 06/28] adjust for latest c-sdk code changes --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 60172da..e94e13e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -17,5 +17,5 @@ ], "features": { }, - "builtin-baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + "builtin-baseline": "b322364f06308bdd24823f9d8f03fe0cc86fd46f" } \ No newline at end of file From 3d66f7d44b07219b4d4fdacec4455c490d1556e0 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 11:21:53 -0700 Subject: [PATCH 07/28] adjust for latest c-sdk code changes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b39e56..23d77f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -93,7 +93,7 @@ jobs: - name: Run VCPKG uses: lukka/run-vcpkg@v10 with: - vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00' + vcpkgGitCommitId: 'b322364f06308bdd24823f9d8f03fe0cc86fd46f' - name: gcc version run: | From 0e32ecc3a249aea74420eb12a19b09d4fe5af65a Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 11:51:46 -0700 Subject: [PATCH 08/28] adjust for latest c-sdk code changes --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23d77f1..afaf7fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,12 +88,10 @@ jobs: run: echo "date=$(date)" >> $GITHUB_OUTPUT - name: Install CMake/Ninja - uses: lukka/get-cmake@v3.27.6 + uses: lukka/get-cmake@v3.30.1 - name: Run VCPKG - uses: lukka/run-vcpkg@v10 - with: - vcpkgGitCommitId: 'b322364f06308bdd24823f9d8f03fe0cc86fd46f' + uses: lukka/run-vcpkg@v11 - name: gcc version run: | From 0360dd1b4599d8e694edb534684a4f5932fd42d3 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 12:04:25 -0700 Subject: [PATCH 09/28] adjust for latest c-sdk code changes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afaf7fd..b07605b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,7 +91,7 @@ jobs: uses: lukka/get-cmake@v3.30.1 - name: Run VCPKG - uses: lukka/run-vcpkg@v11 + uses: lukka/run-vcpkg@v10 - name: gcc version run: | From eb152a989334420fee1e792050b94b6420007c2b Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 12:07:21 -0700 Subject: [PATCH 10/28] adjust for latest c-sdk code changes --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b07605b..7a95f37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,8 @@ jobs: - name: Run VCPKG uses: lukka/run-vcpkg@v10 + with: + vcpkgGitCommitId: 'b322364f06308bdd24823f9d8f03fe0cc86fd46f' - name: gcc version run: | From e9d3dbfa8822bcaac318c1d2bbca2220bddaab96 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 13:02:56 -0700 Subject: [PATCH 11/28] adjust for latest c-sdk code changes --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a95f37..441d4b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,11 @@ jobs: submodules: 'recursive' # token: ${{ secrets.ZITI_CI_GH_TOKEN }} + - name: macOS tools + if: runner.os == 'macOS' + shell: bash + run: brew install autoconf autoconf-archive automake pkg-config + - name: Setup PkgConfig (Windows) if: matrix.config.target == 'windows' run: | From dfb20a0f1dc2696f211b2497724d2566c558e0da Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 8 Jan 2025 15:48:33 -0700 Subject: [PATCH 12/28] adjust for latest c-sdk code changes --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 441d4b9..6654a47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,8 +43,8 @@ jobs: - { os: windows-latest, target: "windows", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - - { os: macos-13, target: "macos", arch: "x64" } - - { os: macos-13, target: "macos", arch: "arm64" } + - { os: macos-latest, target: "macos", arch: "x64" } + - { os: macos-latest, target: "macos", arch: "arm64" } node_ver: [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false From 62ac85188713b3dea4ff1799a98d9923d0c5a16d Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 08:17:04 -0500 Subject: [PATCH 13/28] build macOS-arm on macos-14, macOS-x64 on macos-13 --- .github/workflows/build.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6654a47..87ef299 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,9 +43,9 @@ jobs: - { os: windows-latest, target: "windows", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - - { os: macos-latest, target: "macos", arch: "x64" } - - { os: macos-latest, target: "macos", arch: "arm64" } - node_ver: [ 16, 18, 19, 20, 21, 22, 23] + - { os: macos-13, target: "macos", arch: "x64" } # x64 image + - { os: macos-14, target: "macos", arch: "arm64" } # arm64 image + node_ver: 22 # scale down for now [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false steps: @@ -96,24 +96,15 @@ jobs: uses: lukka/get-cmake@v3.30.1 - name: Run VCPKG - uses: lukka/run-vcpkg@v10 - with: - vcpkgGitCommitId: 'b322364f06308bdd24823f9d8f03fe0cc86fd46f' + uses: lukka/run-vcpkg@v11 + # will use baseline from vcpkg.json - - name: gcc version + - name: show versions run: | gcc --version - - name: cmake version - run: | cmake --version - - name: ninja version - run: | ninja --version - - name: node version - run: | node --version - - name: npm version - run: | npm --version - name: Build NodeJS-SDK From c0837ded275d851a53ecf5c2057a71db44ec8008 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 08:17:58 -0500 Subject: [PATCH 14/28] build macOS-arm on macos-14, macOS-x64 on macos-13 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87ef299..ba1e7d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - { os: macos-13, target: "macos", arch: "x64" } # x64 image - { os: macos-14, target: "macos", arch: "arm64" } # arm64 image - node_ver: 22 # scale down for now [ 16, 18, 19, 20, 21, 22, 23] + node_ver: [ 22 ] # scale down for now [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false steps: From 25a73b15d3ebfd8863a7374b367b6bcf16650d2f Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 08:20:05 -0500 Subject: [PATCH 15/28] build macOS-arm on macos-14, macOS-x64 on macos-13 --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba1e7d9..bc1a13c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,6 +98,9 @@ jobs: - name: Run VCPKG uses: lukka/run-vcpkg@v11 # will use baseline from vcpkg.json + with: + # get baseline from vcpkg + vcpkgJsonGlob: './vcpkg.json' - name: show versions run: | From 961732e19fa2c39e02b13fd1257d144961d43ee8 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 08:41:15 -0500 Subject: [PATCH 16/28] debug build failure --- .github/workflows/build.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc1a13c..729c0ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,13 +104,16 @@ jobs: - name: show versions run: | + echo ===== gcc ===== gcc --version + echo ===== cmake ===== cmake --version - ninja --version - node --version - npm --version + echo "ninja: $(ninja --version)" + echo "node: $(node --version)" + echo "npm: $(npm --version)" - name: Build NodeJS-SDK + id: buildSDK run: | cd ${{ runner.workspace }}/${{ github.event.repository.name }} npm install @@ -120,6 +123,15 @@ jobs: TARGET_ARCH: ${{ matrix.config.arch }} BUILD_DATE: ${{ steps.date.outputs.date }} + - name: debug build failure + if: always() && (steps.build.sdk.outcome == 'failure') + uses: actions/upload-artifact@v3 + with: + name: build-failures + path: | + ./vcpkg/buildtrees/**/*.log + ./build/**/*log + - name: Hello test if: matrix.config.arch == 'x64' run: | From 78af6e7d61d9be0a005418129a11c442782183fc Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 08:43:40 -0500 Subject: [PATCH 17/28] debug build failure --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 729c0ee..09cc7da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -124,7 +124,7 @@ jobs: BUILD_DATE: ${{ steps.date.outputs.date }} - name: debug build failure - if: always() && (steps.build.sdk.outcome == 'failure') + if: always() uses: actions/upload-artifact@v3 with: name: build-failures From b010e69333a6d8af4ef31e9ba0efa32819515129 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 08:48:17 -0500 Subject: [PATCH 18/28] debug build failure --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09cc7da..c8138a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,11 +123,15 @@ jobs: TARGET_ARCH: ${{ matrix.config.arch }} BUILD_DATE: ${{ steps.date.outputs.date }} + - name: show build result + if: always() + run: echo build result ${{ steps.buildSDK.outcome }} + - name: debug build failure if: always() uses: actions/upload-artifact@v3 with: - name: build-failures + name: build-logs-${{ matrix.config.target }}-${{ matrix.config.arch }} path: | ./vcpkg/buildtrees/**/*.log ./build/**/*log From 5ea0d47ce05451e497bb2a89c3b0ffc9e322976d Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 09:15:49 -0500 Subject: [PATCH 19/28] use macOS-13, cache deps for speeding up the build --- .github/workflows/build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8138a5..76eb418 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,8 +43,8 @@ jobs: - { os: windows-latest, target: "windows", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - - { os: macos-13, target: "macos", arch: "x64" } # x64 image - - { os: macos-14, target: "macos", arch: "arm64" } # arm64 image + - { os: macos-13, target: "macos", arch: "x64" } + - { os: macos-13, target: "macos", arch: "arm64" } node_ver: [ 22 ] # scale down for now [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false @@ -112,6 +112,12 @@ jobs: echo "node: $(node --version)" echo "npm: $(npm --version)" + - name: restore dependencies cache + uses: actions/cache@v4 + with: + key: deps-${{ matrix.config.target }}-${{ matrix.config.arch }}-${{ hashFiles('./vcpkg.json') }} + path: './vcpkg/packages' + - name: Build NodeJS-SDK id: buildSDK run: | From 93fafc494bdda7f226c8a696a78c0d06b565cd36 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 09:21:00 -0500 Subject: [PATCH 20/28] macos: install libtool --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76eb418..16c3986 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,7 @@ jobs: - { os: ubuntu-20.04, target: "linux", arch: "x64" } - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - { os: macos-13, target: "macos", arch: "x64" } - - { os: macos-13, target: "macos", arch: "arm64" } + - { os: macos-14, target: "macos", arch: "arm64" } node_ver: [ 22 ] # scale down for now [ 16, 18, 19, 20, 21, 22, 23] fail-fast: false @@ -60,7 +60,7 @@ jobs: - name: macOS tools if: runner.os == 'macOS' shell: bash - run: brew install autoconf autoconf-archive automake pkg-config + run: brew install autoconf autoconf-archive automake pkg-config libtool - name: Setup PkgConfig (Windows) if: matrix.config.target == 'windows' @@ -134,7 +134,7 @@ jobs: run: echo build result ${{ steps.buildSDK.outcome }} - name: debug build failure - if: always() + if: always() && steps.buildSDK.outcome == 'failure' uses: actions/upload-artifact@v3 with: name: build-logs-${{ matrix.config.target }}-${{ matrix.config.arch }} From 2d7a26f191f87a8f86031614989188af2f93f37d Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 09:38:53 -0500 Subject: [PATCH 21/28] fix function signature --- src/Ziti_https_request_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ziti_https_request_data.c b/src/Ziti_https_request_data.c index fd75a43..71a0e3b 100644 --- a/src/Ziti_https_request_data.c +++ b/src/Ziti_https_request_data.c @@ -103,7 +103,7 @@ static void CallJs_on_req_body(napi_env env, napi_value js_cb, void* context, vo /** * */ -void on_req_body(tlsuv_http_req_t *req, const char *body, ssize_t status) { +void on_req_body(tlsuv_http_req_t *req, char *body, ssize_t status) { ZITI_NODEJS_LOG(DEBUG, "status: %zd, body: %p", status, body); From 6d9941eb56308a48f8e78f382c72a5c848409b18 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 09:56:57 -0500 Subject: [PATCH 22/28] fix function signatures --- src/build_config.h.in | 6 +++--- src/utils.c | 6 +++--- src/ziti_enroll.c | 2 +- src/ziti_listen.c | 2 +- src/ziti_service_available.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/build_config.h.in b/src/build_config.h.in index d392af4..e8dcf12 100644 --- a/src/build_config.h.in +++ b/src/build_config.h.in @@ -1,6 +1,6 @@ -#define ZITI_VERSION @ZITI_VERSION@ -#define ZITI_COMMIT @ZITI_COMMIT@ -#define ZITI_BRANCH @ZITI_BRANCH@ +#define ZITI_NODEJS_VERSION @ZITI_VERSION@ +#define ZITI_NODEJS_COMMIT @ZITI_COMMIT@ +#define ZITI_NODEJS_BRANCH @ZITI_BRANCH@ #define ZITI_OS @CMAKE_SYSTEM_NAME@ #define ZITI_ARCH @CMAKE_SYSTEM_PROCESSOR@ #define BUILD_DATE @BUILD_DATE@ \ No newline at end of file diff --git a/src/utils.c b/src/utils.c index 5ff73f4..d12ed2b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -47,10 +47,10 @@ limitations under the License. const char* ziti_nodejs_get_version(int verbose) { if (verbose) { - return "\n\tVersion:\t" to_str(ZITI_VERSION) + return "\n\tVersion:\t" to_str(ZITI_NODEJS_VERSION) "\n\tBuild Date:\t" to_str(BUILD_DATE) - "\n\tGit Branch:\t" to_str(ZITI_BRANCH) - "\n\tGit SHA:\t" to_str(ZITI_COMMIT) + "\n\tGit Branch:\t" to_str(ZITI_NODEJS_BRANCH) + "\n\tGit SHA:\t" to_str(ZITI_NODEJS_COMMIT) "\n\tOS: \t" to_str(ZITI_OS) "\n\tArch: \t" to_str(ZITI_ARCH) "\n\t"; diff --git a/src/ziti_enroll.c b/src/ziti_enroll.c index da273d6..ba07d25 100644 --- a/src/ziti_enroll.c +++ b/src/ziti_enroll.c @@ -106,7 +106,7 @@ static void CallJs_on_enroll(napi_env env, napi_value js_cb, void* context, void /** * */ -void on_ziti_enroll(ziti_config *cfg, int status, char *err, void *ctx) { +void on_ziti_enroll(const ziti_config *cfg, int status, const char *err, void *ctx) { napi_status nstatus; ZITI_NODEJS_LOG(DEBUG, "\nstatus: %d, \nerr: %s,\nctx: %p", status, err, ctx); diff --git a/src/ziti_listen.c b/src/ziti_listen.c index 35a6593..2dabf46 100644 --- a/src/ziti_listen.c +++ b/src/ziti_listen.c @@ -473,7 +473,7 @@ static void CallJs_on_listen_client(napi_env env, napi_value js_cb, void* contex /** * */ -void on_listen_client(ziti_connection serv, ziti_connection client, int status, ziti_client_ctx *clt_ctx) { +void on_listen_client(ziti_connection serv, ziti_connection client, int status, const ziti_client_ctx *clt_ctx) { ZITI_NODEJS_LOG(INFO, "on_listen_client: client: %p, status: %d, clt_ctx: %p", client, status, clt_ctx); diff --git a/src/ziti_service_available.c b/src/ziti_service_available.c index 6d11543..e0113fa 100644 --- a/src/ziti_service_available.c +++ b/src/ziti_service_available.c @@ -103,7 +103,7 @@ static void CallJs_on_service_available(napi_env env, napi_value js_cb, void* co /** * */ -static void on_service_available(ziti_context nf_ctx, ziti_service* service, int status, void *ctx) { +static void on_service_available(ziti_context nf_ctx, const ziti_service* service, int status, void *ctx) { napi_status nstatus; AddonData* addon_data = (AddonData*)ctx; From 5c45075fa5cf4cda16e8ca53904eb6e4da56c4d6 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 20:59:38 -0500 Subject: [PATCH 23/28] build changes - switch from submodule to FetchContent - win32: make sure nodejs provided libuv is used --- CMakeLists.txt | 20 ++++++++------------ deps/CMakeLists.txt | 28 +++++++++++++++++++++++++++ deps/tlsuv-libuv.patch | 43 ++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +-- src/utils.h | 2 +- vcpkg.json | 1 - 6 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 deps/CMakeLists.txt create mode 100644 deps/tlsuv-libuv.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 13f85b3..2f868e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,13 @@ endif (WIN32) file(GLOB SOURCE_FILES ./src/*.c ./src/.cpp) add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) -set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") +set_target_properties(${PROJECT_NAME} PROPERTIES + PREFIX "" + SUFFIX ".node" + C_STANDARD 11 + POSITION_INDEPENDENT_CODE ON +) + target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include PRIVATE ${CMAKE_JS_INC} @@ -31,16 +37,6 @@ target_include_directories(${PROJECT_NAME} if (WIN32) target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN) - - # - # nodejs contains all needed libuv stuff - # trick TLSUV to link against it - add_library(libuv::uv SHARED IMPORTED) - set_target_properties(libuv::uv PROPERTIES - IMPORTED_LOCATION ${CMAKE_JS_LIB} - IMPORTED_IMPLIB ${CMAKE_JS_LIB} - ) - set(TLSUV_LIBUV_LIB libuv::uv) endif (WIN32) @@ -49,7 +45,7 @@ if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET) execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS}) endif() -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/ziti-sdk-c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps) target_link_libraries(${PROJECT_NAME} PRIVATE ziti ${CMAKE_JS_LIB}) if (WIN32) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt new file mode 100644 index 0000000..dbd55c8 --- /dev/null +++ b/deps/CMakeLists.txt @@ -0,0 +1,28 @@ +include(FetchContent) + +if (WIN32) + # nodejs contains all needed libuv stuff + # trick TLSUV to link against it + add_library(libuv::uv SHARED IMPORTED) + set_target_properties(libuv::uv PROPERTIES + IMPORTED_LOCATION ${CMAKE_JS_LIB} + IMPORTED_IMPLIB ${CMAKE_JS_LIB} + ) + set(TLSUV_LIBUV_LIB libuv::uv) + + # make sure on WIN32 tlsuv uses our definition for libuv + FetchContent_Declare(tlsuv + GIT_REPOSITORY https://github.com/openziti/tlsuv.git + GIT_TAG v0.33.1 + PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/tlsuv-libuv.patch + ) + FetchContent_MakeAvailable(tlsuv) +endif (WIN32) + +FetchContent_Declare(ziti + GIT_REPOSITORY https://github.com/openziti/ziti-sdk-c.git + GIT_TAG 1.3.5 +) +FetchContent_MakeAvailable(ziti) + + diff --git a/deps/tlsuv-libuv.patch b/deps/tlsuv-libuv.patch new file mode 100644 index 0000000..51d9f18 --- /dev/null +++ b/deps/tlsuv-libuv.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f8a0c2f..a07ee13 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -84,21 +84,25 @@ endif() + include(FindPkgConfig) + find_package(PkgConfig) + +-find_package(libuv CONFIG QUIET) +-if (libuv_FOUND) +- # newer libuv versions (via VCPKG) have proper namespacing +- if (TARGET libuv::uv_a) +- set(TLSUV_LIBUV_LIB libuv::uv_a) +- elseif (TARGET uv_a) +- set(TLSUV_LIBUV_LIB uv_a) +- elseif (TARGET libuv::uv) +- set(TLSUV_LIBUV_LIB libuv::uv) ++if (TARGET libuv::uv) ++ set(TLSUV_LIBUV_LIB libuv::uv) ++else () ++ find_package(libuv CONFIG QUIET) ++ if (libuv_FOUND) ++ # newer libuv versions (via VCPKG) have proper namespacing ++ if (TARGET libuv::uv_a) ++ set(TLSUV_LIBUV_LIB libuv::uv_a) ++ elseif (TARGET uv_a) ++ set(TLSUV_LIBUV_LIB uv_a) ++ elseif (TARGET libuv::uv) ++ set(TLSUV_LIBUV_LIB libuv::uv) ++ else() ++ set(TLSUV_LIBUV_LIB uv) ++ endif() + else() +- set(TLSUV_LIBUV_LIB uv) ++ pkg_check_modules(libuv REQUIRED IMPORTED_TARGET libuv) ++ set(TLSUV_LIBUV_LIB PkgConfig::libuv) + endif() +-else() +- pkg_check_modules(libuv REQUIRED IMPORTED_TARGET libuv) +- set(TLSUV_LIBUV_LIB PkgConfig::libuv) + endif() + + add_library(tlsuv STATIC diff --git a/package.json b/package.json index 12c43e3..803e42c 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "version": "0.18.0", "main": "./lib/ziti", "scripts": { - "build": "npm run build:init && npm run build:configure && npm run build:make", - "build:init": "git submodule update --init --recursive", + "build": "npm run build:configure && npm run build:make", "build:configure": "run-script-os", "build:configure:windows": "configure", "build:configure:linux:darwin": "./configure", diff --git a/src/utils.h b/src/utils.h index 9d12694..05b1280 100644 --- a/src/utils.h +++ b/src/utils.h @@ -64,7 +64,7 @@ extern FILE *ziti_nodejs_debug_out; // TEMP: skip logging on windows #ifdef WIN32 -#define ZITI_NODEJS_LOG +#define ZITI_NODEJS_LOG(...) #else #define ZITI_NODEJS_LOG(level, fmt, ...) do { \ if (level <= ziti_nodejs_debug_level) {\ diff --git a/vcpkg.json b/vcpkg.json index e94e13e..0c843ba 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -7,7 +7,6 @@ "platform": "!windows", "$comment": "on windows we link against node binary and Cmake.js provides libuv headers" }, - "libuv", "openssl", "zlib", "llhttp", From e47e6ffb585052667373ae23d9bcdf8f53f015f6 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 16:05:54 -0500 Subject: [PATCH 24/28] always save/update dep cache --- .github/workflows/build.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16c3986..acbca23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -113,7 +113,8 @@ jobs: echo "npm: $(npm --version)" - name: restore dependencies cache - uses: actions/cache@v4 + uses: actions/cache/restore@v4 + id: cache-restore with: key: deps-${{ matrix.config.target }}-${{ matrix.config.arch }}-${{ hashFiles('./vcpkg.json') }} path: './vcpkg/packages' @@ -147,6 +148,15 @@ jobs: run: | node tests/hello.js + - name: save dependencies cache + uses: actions/cache/save@v4 + id: cache-save + # save deps even build has failed + if: always() + with: + key: ${{ steps.cache-restore.outputs.cache-primary-key }} + path: './vcpkg/packages' + - name: upload artifacts uses: actions/upload-artifact@v3 with: From 2d304ffa412a9ef751a1122a188aaca6a041a67d Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 16:08:01 -0500 Subject: [PATCH 25/28] remove ziti-sdk submodule --- .gitmodules | 4 ---- deps/ziti-sdk-c | 1 - 2 files changed, 5 deletions(-) delete mode 160000 deps/ziti-sdk-c diff --git a/.gitmodules b/.gitmodules index 7d004b6..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "deps/ziti-sdk-c"] - path = deps/ziti-sdk-c - url = https://github.com/openziti/ziti-sdk-c - branch = main diff --git a/deps/ziti-sdk-c b/deps/ziti-sdk-c deleted file mode 160000 index 9a0c55e..0000000 --- a/deps/ziti-sdk-c +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9a0c55e089b4301f77c88417bdd1c8d7bff98834 From 58f86e6a6b60a10802cef2a27bcc4f5460b5f10a Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 16:09:16 -0500 Subject: [PATCH 26/28] re-enable node versions --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index acbca23..f946379 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - { os: macos-13, target: "macos", arch: "x64" } - { os: macos-14, target: "macos", arch: "arm64" } - node_ver: [ 22 ] # scale down for now [ 16, 18, 19, 20, 21, 22, 23] + node_ver: [ 16, 18, 19, 20, 21, 22, 23 ] fail-fast: false steps: From 6e6bbffbd6b554308e180b6ceb0971a8581a22d8 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 16:15:29 -0500 Subject: [PATCH 27/28] copy toolchains --- CMakePresets.json | 6 +++--- toolchains/Linux-arm.cmake | 12 ++++++++++++ toolchains/Linux-arm64.cmake | 12 ++++++++++++ toolchains/Windows-arm64-msvc.cmake | 8 ++++++++ toolchains/Windows-x86.cmake | 12 ++++++++++++ toolchains/Windows-x86_64.cmake | 12 ++++++++++++ toolchains/linux-embedded.cmake | 17 +++++++++++++++++ toolchains/macOS-arm64.cmake | 17 +++++++++++++++++ toolchains/macOS-x86_64.cmake | 23 +++++++++++++++++++++++ 9 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 toolchains/Linux-arm.cmake create mode 100644 toolchains/Linux-arm64.cmake create mode 100644 toolchains/Windows-arm64-msvc.cmake create mode 100644 toolchains/Windows-x86.cmake create mode 100644 toolchains/Windows-x86_64.cmake create mode 100644 toolchains/linux-embedded.cmake create mode 100644 toolchains/macOS-arm64.cmake create mode 100644 toolchains/macOS-x86_64.cmake diff --git a/CMakePresets.json b/CMakePresets.json index 79c96df..3b1a634 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -54,7 +54,7 @@ "cacheVariables": { "VCPKG_TARGET_ARCHITECTURE": "arm64", "VCPKG_TARGET_TRIPLET": "arm64-osx", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/deps/ziti-sdk-c/toolchains/macOS-arm64.cmake" + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/macOS-arm64.cmake" } }, { @@ -66,7 +66,7 @@ "inherits": "ci-linux-x64", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64-linux", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/deps/ziti-sdk-c/toolchains/Linux-arm64.cmake" + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/Linux-arm64.cmake" } }, { @@ -74,7 +74,7 @@ "inherits": "ci-linux-x64", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm-linux", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/deps/ziti-sdk-c/toolchains/Linux-arm.cmake" + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/Linux-arm.cmake" } }, { diff --git a/toolchains/Linux-arm.cmake b/toolchains/Linux-arm.cmake new file mode 100644 index 0000000..1934d7c --- /dev/null +++ b/toolchains/Linux-arm.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(triple arm-linux-gnueabihf) + +set(CMAKE_C_COMPILER ${triple}-gcc) +set(CMAKE_CXX_COMPILER ${triple}-g++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/Linux-arm64.cmake b/toolchains/Linux-arm64.cmake new file mode 100644 index 0000000..3379863 --- /dev/null +++ b/toolchains/Linux-arm64.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm64) + +set(triple aarch64-linux-gnu) + +set(CMAKE_C_COMPILER ${triple}-gcc) +set(CMAKE_CXX_COMPILER ${triple}-g++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/Windows-arm64-msvc.cmake b/toolchains/Windows-arm64-msvc.cmake new file mode 100644 index 0000000..c8efeb8 --- /dev/null +++ b/toolchains/Windows-arm64-msvc.cmake @@ -0,0 +1,8 @@ +# cross-compile for windows/arm64 on windows/x64 host with visual studio +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR ARM64) +# setting CMAKE_GENERATOR_PLATFORM should be sufficient if you believe the doc, it results in build files +# that cause msbuild to that the ZERO_CHECK project doesn't contain the "Debug|x64" platform/config +# combination. running cmake with '-A ARCH64' avoids the msbuild failure. +set(CMAKE_GENERATOR_PLATFORM ARM64) +set(CMAKE_C_COMPILER cl.exe) \ No newline at end of file diff --git a/toolchains/Windows-x86.cmake b/toolchains/Windows-x86.cmake new file mode 100644 index 0000000..5c7df82 --- /dev/null +++ b/toolchains/Windows-x86.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86) + +set(triple i686-w64-mingw32) + +set(CMAKE_C_COMPILER ${triple}-gcc) +set(CMAKE_CXX_COMPILER ${triple}-g++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/Windows-x86_64.cmake b/toolchains/Windows-x86_64.cmake new file mode 100644 index 0000000..b341d57 --- /dev/null +++ b/toolchains/Windows-x86_64.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(triple x86_64-w64-mingw32) + +set(CMAKE_C_COMPILER ${triple}-gcc) +set(CMAKE_CXX_COMPILER ${triple}-g++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/linux-embedded.cmake b/toolchains/linux-embedded.cmake new file mode 100644 index 0000000..095abe2 --- /dev/null +++ b/toolchains/linux-embedded.cmake @@ -0,0 +1,17 @@ +if (NOT DEFINED ENV{TOOLCHAIN}) + message(FATAL_ERROR "TOOLCHAIN environment variable is not set") +endif () + +set(triple mips-openwrt-linux) + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR mips) + +set(CMAKE_SYSROOT $ENV{TOOLCHAIN}/) +set(CMAKE_C_COMPILER $ENV{TOOLCHAIN}/bin/${triple}-gcc) +set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN}/bin/${triple}-g++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/macOS-arm64.cmake b/toolchains/macOS-arm64.cmake new file mode 100644 index 0000000..a7d22ff --- /dev/null +++ b/toolchains/macOS-arm64.cmake @@ -0,0 +1,17 @@ +# build-macOS-arm64 + +if (NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") AND + NOT(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") ) + set(CMAKE_SYSTEM_NAME Darwin) + set(CMAKE_SYSTEM_PROCESSOR arm64) +endif () + +set(ZITI_BUILD_TESTS OFF CACHE BOOL "" FORCE) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64") + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/macOS-x86_64.cmake b/toolchains/macOS-x86_64.cmake new file mode 100644 index 0000000..25ac447 --- /dev/null +++ b/toolchains/macOS-x86_64.cmake @@ -0,0 +1,23 @@ +# build-macOS-x86_64 + +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(ZITI_BUILD_TESTS OFF CACHE BOOL "" FORCE) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64") + +# for libsodium +set(triple x86_64-apple-macos11) +execute_process(COMMAND /usr/bin/xcrun -sdk macosx --show-sdk-path + OUTPUT_VARIABLE CMAKE_OSX_SYSROOT + OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(ENV{CFLAGS} "-arch x86_64 -isysroot ${CMAKE_OSX_SYSROOT}") +set(ENV{LDFLAGS} "-arch x86_64 -isysroot ${CMAKE_OSX_SYSROOT}") + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) From 04ddf24d9ae4355ac0d0d6a220f8aa9466aa2c7d Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 9 Jan 2025 16:24:52 -0500 Subject: [PATCH 28/28] drop support for eol-ed node versions [16, 19] --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f946379..f08c356 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: - { os: ubuntu-20.04, target: "linux", arch: "arm64" } - { os: macos-13, target: "macos", arch: "x64" } - { os: macos-14, target: "macos", arch: "arm64" } - node_ver: [ 16, 18, 19, 20, 21, 22, 23 ] + node_ver: [ 18, 20, 21, 22, 23 ] fail-fast: false steps: