Skip to content

Commit df797f6

Browse files
authored
Merge pull request #65 from duckdb/jray/build-linux-arm64
build linux arm64
2 parents d8dfbb9 + f2b08fc commit df797f6

File tree

12 files changed

+165
-31
lines changed

12 files changed

+165
-31
lines changed

.github/workflows/DuckDBNodeBindingsAndAPI.yml

Lines changed: 81 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ on:
33
pull_request:
44
workflow_dispatch:
55
inputs:
6+
publish:
7+
description: 'Publish'
8+
type: boolean
9+
required: true
10+
default: false
611
publish_dry_run:
712
description: 'Publish Dry Run'
813
type: boolean
@@ -13,41 +18,51 @@ on:
1318
type: boolean
1419
required: true
1520
default: false
16-
publish_linux_x64:
17-
description: 'Publish Bindings for Linux x64'
18-
type: boolean
19-
required: true
20-
default: false
21-
publish_bindings:
22-
description: 'Publish Bindings (from Linux x64)'
23-
type: boolean
24-
required: true
25-
default: false
26-
publish_api:
27-
description: 'Publish API (from Linux x64)'
21+
# publish_linux_x64:
22+
# description: 'Publish Bindings for Linux x64'
23+
# type: boolean
24+
# required: true
25+
# default: false
26+
# publish_bindings:
27+
# description: 'Publish Bindings (from Linux x64)'
28+
# type: boolean
29+
# required: true
30+
# default: false
31+
# publish_api:
32+
# description: 'Publish API (from Linux x64)'
33+
# type: boolean
34+
# required: true
35+
# default: false
36+
linux_arm64:
37+
description: 'Run on Linux arm64'
2838
type: boolean
2939
required: true
3040
default: false
41+
# publish_linux_arm64:
42+
# description: 'Publish Bindings for Linux arm64'
43+
# type: boolean
44+
# required: true
45+
# default: false
3146
macos_arm64:
3247
description: 'Run on Mac OS X arm64'
3348
type: boolean
3449
required: true
3550
default: false
36-
publish_darwin_arm64:
37-
description: 'Publish Bindings for Darwin arm64'
38-
type: boolean
39-
required: true
40-
default: false
51+
# publish_darwin_arm64:
52+
# description: 'Publish Bindings for Darwin arm64'
53+
# type: boolean
54+
# required: true
55+
# default: false
4156
windows_x64:
4257
description: 'Run on Windows x64'
4358
type: boolean
4459
required: true
4560
default: false
46-
publish_win32_x64:
47-
description: 'Publish Bindings for Win32 x64'
48-
type: boolean
49-
required: true
50-
default: false
61+
# publish_win32_x64:
62+
# description: 'Publish Bindings for Win32 x64'
63+
# type: boolean
64+
# required: true
65+
# default: false
5166
repository_dispatch:
5267

5368
concurrency:
@@ -87,30 +102,66 @@ jobs:
87102
run: pnpm test
88103

89104
- name: Git Status
90-
if: ${{ inputs.publish_linux_x64 || inputs.publish_bindings || inputs.publish_api }}
105+
if: ${{ inputs.publish }}
91106
run: git status
92107

93108
- name: Publish - Bindings - Linux x64
94-
if: ${{ inputs.publish_linux_x64 }}
109+
if: ${{ inputs.publish }}
95110
working-directory: bindings/pkgs/@duckdb/node-bindings-linux-x64
96111
run: pnpm publish ${{ inputs.publish_dry_run && '--dry-run' || '' }} --publish-branch ${{ github.ref_name }} --access public
97112
env:
98113
NPM_AUTH_TOKEN: ${{ secrets.DUCKDB_NPM_TOKEN }}
99114

100115
- name: Publish - Bindings
101-
if: ${{ inputs.publish_bindings }}
116+
if: ${{ inputs.publish }}
102117
working-directory: bindings/pkgs/@duckdb/node-bindings
103118
run: pnpm publish ${{ inputs.publish_dry_run && '--dry-run' || '' }} --publish-branch ${{ github.ref_name }} --access public
104119
env:
105120
NPM_AUTH_TOKEN: ${{ secrets.DUCKDB_NPM_TOKEN }}
106121

107122
- name: Publish - API
108-
if: ${{ inputs.publish_api }}
123+
if: ${{ inputs.publish }}
109124
working-directory: api/pkgs/@duckdb/node-api
110125
run: pnpm publish ${{ inputs.publish_dry_run && '--dry-run' || '' }} --publish-branch ${{ github.ref_name }} --access public
111126
env:
112127
NPM_AUTH_TOKEN: ${{ secrets.DUCKDB_NPM_TOKEN }}
113128

129+
linux_arm64:
130+
name: Linux arm64
131+
runs-on: ubuntu-latest
132+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.linux_arm64 }}
133+
env:
134+
TARGET_ARCH: arm64
135+
CC: aarch64-linux-gnu-gcc
136+
CXX: aarch64-linux-gnu-g++
137+
steps:
138+
- name: Install aarch64 compilers
139+
run: sudo apt install binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
140+
141+
- uses: actions/checkout@v4
142+
143+
- uses: pnpm/action-setup@v3
144+
with:
145+
version: 9
146+
147+
- name: Workspace - Install
148+
run: pnpm install --ignore-scripts
149+
150+
- name: Bindings - Build
151+
working-directory: bindings
152+
run: pnpm run build
153+
154+
- name: Git Status
155+
if: ${{ inputs.publish }}
156+
run: git status
157+
158+
- name: Publish - Bindings - Linux arm64
159+
if: ${{ inputs.publish }}
160+
working-directory: bindings/pkgs/@duckdb/node-bindings-linux-arm64
161+
run: pnpm publish ${{ inputs.publish_dry_run && '--dry-run' || '' }} --publish-branch ${{ github.ref_name }} --access public
162+
env:
163+
NPM_AUTH_TOKEN: ${{ secrets.DUCKDB_NPM_TOKEN }}
164+
114165
macos_arm64:
115166
name: Mac OS X arm64
116167
runs-on: macos-latest
@@ -142,11 +193,11 @@ jobs:
142193
run: pnpm test
143194

144195
- name: Git Status
145-
if: ${{ inputs.publish_darwin_arm64 }}
196+
if: ${{ inputs.publish }}
146197
run: git status
147198

148199
- name: Publish - Bindings - Darwin arm64
149-
if: ${{ inputs.publish_darwin_arm64 }}
200+
if: ${{ inputs.publish }}
150201
working-directory: bindings/pkgs/@duckdb/node-bindings-darwin-arm64
151202
run: pnpm publish ${{ inputs.publish_dry_run && '--dry-run' || '' }} --publish-branch ${{ github.ref_name }} --access public
152203
env:
@@ -183,11 +234,11 @@ jobs:
183234
run: pnpm test
184235

185236
- name: Git Status
186-
if: ${{ inputs.publish_win32_x64 }}
237+
if: ${{ inputs.publish }}
187238
run: git status
188239

189240
- name: Publish - Bindings - Win32 x64
190-
if: ${{ inputs.publish_win32_x64 }}
241+
if: ${{ inputs.publish }}
191242
working-directory: bindings/pkgs/@duckdb/node-bindings-win32-x64
192243
run: pnpm publish ${{ inputs.publish_dry_run && '--dry-run' || '' }} --publish-branch ${{ github.ref_name }} --access public
193244
env:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [@duckdb/node-api](api/pkgs/@duckdb/node-api/README.md)
1010
- [@duckdb/node-bindings](bindings/pkgs/@duckdb/node-bindings/README.md)
1111
- [@duckdb/node-bindings-darwin-arm64](bindings/pkgs/@duckdb/node-bindings-darwin-arm64/README.md)
12+
- [@duckdb/node-bindings-linux-arm64](bindings/pkgs/@duckdb/node-bindings-linux-x64/README.md)
1213
- [@duckdb/node-bindings-linux-x64](bindings/pkgs/@duckdb/node-bindings-linux-x64/README.md)
1314
- [@duckdb/node-bindings-win32-x64](bindings/pkgs/@duckdb/node-bindings-win32-x64/README.md)
1415

@@ -17,6 +18,7 @@
1718
- [@duckdb/node-api](https://www.npmjs.com/package/@duckdb/node-api)
1819
- [@duckdb/node-bindings](https://www.npmjs.com/package/@duckdb/node-bindings)
1920
- [@duckdb/node-bindings-darwin-arm64](https://www.npmjs.com/package/@duckdb/node-bindings-darwin-arm64)
21+
- [@duckdb/node-bindings-linux-arm64](https://www.npmjs.com/package/@duckdb/node-bindings-linux-x64)
2022
- [@duckdb/node-bindings-linux-x64](https://www.npmjs.com/package/@duckdb/node-bindings-linux-x64)
2123
- [@duckdb/node-bindings-win32-x64](https://www.npmjs.com/package/@duckdb/node-bindings-win32-x64)
2224

@@ -46,12 +48,14 @@ Change version in:
4648
- `api/pkgs/@duckdb/node-api/package.json`
4749
- `bindings/pkgs/@duckdb/node-bindings/package.json`
4850
- `bindings/pkgs/@duckdb/node-bindings-darwin-arm64/package.json`
51+
- `bindings/pkgs/@duckdb/node-bindings-linux-arm64/package.json`
4952
- `bindings/pkgs/@duckdb/node-bindings-linux-x64/package.json`
5053
- `bindings/pkgs/@duckdb/node-bindings-win32-x64/package.json`
5154

5255
### Upgrade DuckDB Version
5356

5457
Change version in:
58+
- `bindings/scripts/fetch_libduckdb_linux_aarch64.py`
5559
- `bindings/scripts/fetch_libduckdb_linux_amd64.py`
5660
- `bindings/scripts/fetch_libduckdb_osx_universal.py`
5761
- `bindings/scripts/fetch_libduckdb_windows_amd64.py`

api/pkgs/@duckdb/node-api/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Some features are not yet complete:
2727

2828
### Supported Platforms
2929

30+
- Linux arm64 (experimental)
3031
- Linux x64
3132
- Mac OS X (Darwin) arm64 (Apple Silicon)
3233
- Windows (Win32) x64

bindings/binding.gyp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
'script_path': '<(module_root_dir)/scripts/fetch_libduckdb_linux_amd64.py',
1010
},
1111
}],
12+
['OS=="linux" and target_arch=="arm64"', {
13+
'variables': {
14+
'script_path': '<(module_root_dir)/scripts/fetch_libduckdb_linux_aarch64.py',
15+
},
16+
}],
1217
['OS=="mac"', {
1318
'variables': {
1419
'script_path': '<(module_root_dir)/scripts/fetch_libduckdb_osx_universal.py',
@@ -54,6 +59,21 @@
5459
},
5560
],
5661
}],
62+
['OS=="linux" and target_arch=="arm64"', {
63+
'link_settings': {
64+
'libraries': [
65+
'-lduckdb',
66+
'-L<(module_root_dir)/libduckdb',
67+
'-Wl,-rpath,\'$$ORIGIN\'',
68+
],
69+
},
70+
'copies': [
71+
{
72+
'files': ['<(module_root_dir)/libduckdb/libduckdb.so'],
73+
'destination': '<(module_root_dir)/pkgs/@duckdb/node-bindings-linux-arm64',
74+
},
75+
],
76+
}],
5777
['OS=="mac"', {
5878
'cflags+': ['-fvisibility=hidden'],
5979
'xcode_settings': {
@@ -101,6 +121,14 @@
101121
},
102122
],
103123
}],
124+
['OS=="linux" and target_arch=="arm64"', {
125+
'copies': [
126+
{
127+
'files': ['<(module_root_dir)/build/Release/duckdb.node'],
128+
'destination': '<(module_root_dir)/pkgs/@duckdb/node-bindings-linux-arm64',
129+
},
130+
],
131+
}],
104132
['OS=="mac"', {
105133
'copies': [
106134
{

bindings/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"scripts": {
44
"build": "npm run build:package && npm run build:test",
5-
"build:package": "node-gyp configure && node-gyp build",
5+
"build:package": "cross-replace node-gyp configure --verbose --arch=$TARGET_ARCH && node-gyp build --verbose --arch=$TARGET_ARCH",
66
"build:test": "tsc -b test",
77
"clean": "npm run clean:gyp && npm run clean:libduckdb && npm run clean:package",
88
"clean:gyp": "node-gyp clean",
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@duckdb/node-bindings": "workspace:*",
16+
"cross-replace": "^0.2.0",
1617
"node-addon-api": "^8.3.0",
1718
"node-gyp": "^10.3.1",
1819
"rimraf": "^5.0.10",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# DuckDB Node Bindings: Linux arm64 (experimental)
2+
3+
Binaries supporting [Node](https://nodejs.org/) bindings to the [DuckDB C API](https://duckdb.org/docs/api/c/overview) for Linux arm64. These are experimental; they are not fully tested.
4+
5+
See [@duckdb/node-bindings](https://www.npmjs.com/package/@duckdb/node-bindings) for a low-level API that uses these binaries, or [@duckdb/node-api](https://www.npmjs.com/package/@duckdb/node-api) for a high-level API built on those bindings.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@duckdb/node-bindings-linux-arm64",
3+
"version": "1.1.3-alpha.6",
4+
"os": [
5+
"linux"
6+
],
7+
"cpu": [
8+
"arm64"
9+
],
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/duckdb/duckdb-node-neo.git"
13+
}
14+
}

bindings/pkgs/@duckdb/node-bindings/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ See [@duckdb/node-api](https://www.npmjs.com/package/@duckdb/node-api) for a hig
66

77
### Supported Platforms
88

9+
- Linux arm64 (experimental)
910
- Linux x64
1011
- Mac OS X (Darwin) arm64 (Apple Silicon)
1112
- Windows (Win32) x64

bindings/pkgs/@duckdb/node-bindings/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"types": "./duckdb.d.ts",
66
"optionalDependencies": {
77
"@duckdb/node-bindings-darwin-arm64": "workspace:*",
8+
"@duckdb/node-bindings-linux-arm64": "workspace:*",
89
"@duckdb/node-bindings-linux-x64": "workspace:*",
910
"@duckdb/node-bindings-win32-x64": "workspace:*"
1011
},

0 commit comments

Comments
 (0)