Skip to content

Commit e31020d

Browse files
authored
Merge pull request #90 from journeyapps/macos-arm64
MacOS arm64 support
2 parents 583b98f + e8322e1 commit e31020d

134 files changed

Lines changed: 301346 additions & 144 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ aliases:
1111
if [[ "${ELECTRON_VERSION}" ]]; then
1212
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://electronjs.org/headers"
1313
fi
14+
if [[ "${BUILD_ARM64}" == "true" ]]; then
15+
GYP_ARGS="${GYP_ARGS} --target_arch=arm64"
16+
fi
1417
./node_modules/.bin/node-pre-gyp rebuild package testpackage $GYP_ARGS
1518
1619
- &build-command-windows
@@ -34,6 +37,9 @@ aliases:
3437
if [[ "${ELECTRON_VERSION}" ]]; then
3538
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://electronjs.org/headers"
3639
fi
40+
if [[ "${BUILD_ARM64}" == "true" ]]; then
41+
GYP_ARGS="${GYP_ARGS} --target_arch=arm64"
42+
fi
3743
COMMIT_MESSAGE=`git log --format=%s -n 1 $CIRCLE_SHA1`
3844
if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]] && [[ "$PUBLISH" == "true" ]]; then
3945
./node_modules/.bin/node-pre-gyp publish $GYP_ARGS
@@ -88,7 +94,7 @@ aliases:
8894
- run: curl -sSL https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
8995
- run: sudo apt-get update && sudo apt-get install -y git-lfs && git-lfs install --force && git-lfs pull
9096
# These are required for electron(-mocha)
91-
- run: sudo apt-get install -y libgtk2.0-0 libgtk-3-dev libxtst6 libxss1 libgconf2-4 libnss3 libasound2
97+
- run: sudo apt-get install -y libgtk2.0-0 libgtk-3-dev libxtst6 libxss1 libgconf2-dev libnss3 libasound2
9298
- run:
9399
name: Install
94100
command: |
@@ -102,7 +108,7 @@ aliases:
102108

103109
- &common-macos
104110
macos:
105-
xcode: "10.2.1"
111+
xcode: "13.1.0"
106112
steps:
107113
- checkout
108114
- run: |
@@ -130,12 +136,17 @@ aliases:
130136
node -v
131137
npm install --build-from-source
132138
- run: *build-command
133-
- run: npm run test
139+
- run:
140+
name: Run Tests
141+
command: |
142+
if [[ "${SKIP_TEST}" != "true" ]]; then
143+
npm run test
144+
fi
134145
- run: *publish-command
135146

136147
- &common-electron-macos
137148
macos:
138-
xcode: "10.2.1"
149+
xcode: "13.1.0"
139150
steps:
140151
- checkout
141152
- run: |
@@ -214,11 +225,16 @@ aliases:
214225
# ./node_modules/.bin/electron "test/support/createdb-electron.js"
215226
# ./node_modules/.bin/electron-mocha --timeout 480000
216227
jobs:
217-
build-14:
228+
build-16:
218229
<<: *common-build
219230
environment:
220231
PUBLISH: true
221-
ELECTRON_VERSION: "11.2.3"
232+
ELECTRON_VERSION: "16.0.2"
233+
docker:
234+
- image: circleci/node:16.9.1
235+
236+
build-14:
237+
<<: *common-build
222238
docker:
223239
- image: circleci/node:14.11.0
224240

@@ -234,6 +250,13 @@ jobs:
234250

235251
# Node version should match electron's node version.
236252
# See https://github.com/mapbox/node-sqlite3/pull/1367
253+
build-electron-16:
254+
<<: *common-electron-linux
255+
docker:
256+
- image: circleci/node:16.9.1
257+
environment:
258+
ELECTRON_VERSION: "16.0.2"
259+
237260
build-electron-11:
238261
<<: *common-electron-linux
239262
docker:
@@ -276,10 +299,26 @@ jobs:
276299
environment:
277300
ELECTRON_VERSION: "6.1.9"
278301

279-
build-macos-14:
302+
303+
build-macos-16:
304+
<<: *common-macos
305+
environment:
306+
PUBLISH: true
307+
NODE_VERSION: "16.9.1"
308+
ELECTRON_VERSION: "16.0.2"
309+
310+
build-macos-16-arm64:
280311
<<: *common-macos
281312
environment:
282313
PUBLISH: true
314+
NODE_VERSION: "16.9.1"
315+
ELECTRON_VERSION: "16.0.2"
316+
BUILD_ARM64: true
317+
SKIP_TEST: true
318+
319+
build-macos-14:
320+
<<: *common-macos
321+
environment:
283322
NODE_VERSION: "14.11.0"
284323
ELECTRON_VERSION: "11.2.3"
285324

@@ -295,6 +334,7 @@ jobs:
295334

296335
# NODE_VERSION should match electron's node version.
297336
# See https://github.com/mapbox/node-sqlite3/pull/1367
337+
298338
build-macos-electron-11:
299339
<<: *common-electron-macos
300340
environment:
@@ -333,47 +373,51 @@ jobs:
333373
NODE_VERSION: "12.6.0"
334374

335375
# Node 14 - build NAPI 3 and 6
336-
windows-14_x86:
376+
windows-16_x86:
337377
<<: *common-windows
338378
environment:
339-
NODE_VERSION: "14.11.0"
379+
NODE_VERSION: "16.9.1"
340380
NODE_ARCH: x86
341381
PUBLISH: true
342-
ELECTRON_VERSION: "11.2.3"
382+
ELECTRON_VERSION: "16.0.2"
343383
BUILD_ARM64: false
344384

345-
windows-14_x64:
385+
windows-16_x64:
346386
<<: *common-windows
347387
environment:
348-
NODE_VERSION: "14.11.0"
388+
NODE_VERSION: "16.9.1"
349389
NODE_ARCH: x64
350390
PUBLISH: true
351-
ELECTRON_VERSION: "11.2.3"
391+
ELECTRON_VERSION: "16.0.2"
352392
BUILD_ARM64: false
353393

354-
windows-14_arm64:
394+
windows-16_arm64:
355395
<<: *common-windows
356396
environment:
357-
NODE_VERSION: "14.11.0"
397+
NODE_VERSION: "16.9.1"
358398
NODE_ARCH: x64
359399
PUBLISH: true
360-
ELECTRON_VERSION: "11.2.3"
400+
ELECTRON_VERSION: "16.0.2"
361401
BUILD_ARM64: true
362402
SKIP_TEST: true # We can build for arm64, but can't run arm64.
363403

364404
workflows:
365405
version: 2
366406
build_all:
367407
jobs:
408+
- build-16
368409
- build-14
369410
- build-12
370411
- build-10
412+
- build-electron-16
371413
- build-electron-11
372414
# - build-electron-10 # Segfaults on electron-mocha
373415
- build-electron-9
374416
- build-electron-8
375417
- build-electron-7
376418
- build-electron-6
419+
- build-macos-16-arm64
420+
- build-macos-16
377421
- build-macos-14
378422
- build-macos-12
379423
- build-macos-10
@@ -383,6 +427,6 @@ workflows:
383427
- build-macos-electron-8
384428
- build-macos-electron-7
385429
- build-macos-electron-6
386-
- windows-14_x86
387-
- windows-14_x64
388-
- windows-14_arm64
430+
- windows-16_x86
431+
- windows-16_x64
432+
- windows-16_arm64

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
deps/sqlcipher-*.tar.gz filter=lfs diff=lfs merge=lfs -text
2+
deps/**/*.lib filter=lfs diff=lfs merge=lfs -text
3+
deps/**/*.pdb filter=lfs diff=lfs merge=lfs -text
4+
deps/**/*.a filter=lfs diff=lfs merge=lfs -text

CONTRIBUTING.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Contributing
22

3-
General guidelines for contributing to node-sqlite3
3+
General guidelines for contributing to node-sqlcipher.
44

5-
## Install Help
5+
# Testing
66

7-
If you've landed here due to a failed install of `node-sqlite3` then feel free to create a [new issue](https://github.com/mapbox/node-sqlite3/issues/new) to ask for help. The most likely problem is that we do not yet provide pre-built binaries for your particular platform and so the `node-sqlite3` install attempted a source compile but failed because you are missing the [dependencies for node-gyp](https://github.com/TooTallNate/node-gyp#installation). But please provide as much detail on your problem as possible and we'll try to help. Please include:
8-
- terminal logs of failed install (preferably from running `npm install sqlite3 --loglevel=info`)
9-
- `node-sqlite3` version you tried to install
10-
- node version you are running
11-
- operating system and architecture you are running, e.g. `Windows 7 64 bit`.
7+
[mocha](https://github.com/visionmedia/mocha) is required to run unit tests.
8+
9+
In sqlite3's directory (where its `package.json` resides) run the following:
10+
11+
npm install --build-from-source
12+
npm test
1213

1314
## Developing / Pre-release
1415

@@ -36,13 +37,7 @@ git commit --allow-empty -m "[publish binary]"
3637

3738
**3)** Ensure binaries built
3839

39-
Check the travis and appveyor pages to ensure they are all green as an indication that the `[publish binary]` command worked.
40-
41-
If you need to republish binaries you can do this with the command below, however this should not be a common thing for you to do!
42-
43-
```sh
44-
git commit --allow-empty -m "[republish binary]"
45-
```
40+
Check the CircleCI pages to ensure they are all green as an indication that the `[publish binary]` command worked.
4641

4742
Note: NEVER republish binaries for an existing released version.
4843

README.md

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,10 @@ A copy of the source for SQLCipher 4.4.2 is bundled, which is based on SQLite 3.
5353

5454
## Building from source.
5555

56-
This is done automatically by node-pre-gyp when installing on a platform without pre-built binaries. This should generally
57-
not be required with later versions, since two pre-built versions (N-API 3 and N-API 6) cover all electron and node versions.
56+
Building from source when installing the package is only supported up to version 5.2.0.
5857

59-
However, this does require some additional setup, and is likely to run against obscure errors when installing.
60-
61-
Requirements:
62-
63-
### Mac
64-
65-
* `brew install openssl@1.1`
66-
67-
### Windows
68-
69-
* Visual Studio 2015
70-
* Python 2.7
58+
The two pre-built versions (N-API 3 and N-API 6) cover all electron and node versions, so building from source should
59+
not be required.
7160

7261
## Usage with electron-forge / electron-rebuild
7362

@@ -97,7 +86,7 @@ SQLCipher depends on OpenSSL.
9786

9887
For Windows, we bundle OpenSSL 1.1.1i. Binaries are generated using [vckpg](https://github.com/microsoft/vcpkg) (e.g., `.\vcpkg\vcpkg install openssl:x64-windows-static`).
9988

100-
On Mac we build against OpenSSL installed via brew, but statically link it so that end-users do not need to install it.
89+
On Mac we bundle OpenSSL 1.1.1l.
10190

10291
On Linux we dynamically link against the system OpenSSL.
10392

@@ -107,24 +96,6 @@ See the [API documentation](https://github.com/mapbox/node-sqlite3/wiki) in the
10796

10897
Documentation for the SQLCipher extension is available [here](https://www.zetetic.net/sqlcipher/sqlcipher-api/).
10998

110-
# Testing
111-
112-
[mocha](https://github.com/visionmedia/mocha) is required to run unit tests.
113-
114-
In sqlite3's directory (where its `package.json` resides) run the following:
115-
116-
npm install --build-from-source
117-
npm test
118-
119-
# Publishing
120-
121-
To publish a new version, run:
122-
123-
npm version minor -m "%s [publish binary]"
124-
npm publish
125-
126-
Publishing of the prebuilt binaries is performed on CircleCI.
127-
12899
# Acknowledgments
129100

130101
Most of the work in this library is from the [node-sqlite3](https://github.com/mapbox/node-sqlite3) library by [MapBox](https://mapbox.com/).

SQLCipher.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ The above produces 4 files of interest:
2222
```
2323
sqlite3.c
2424
sqlite3.h
25-
shell.c # optional
26-
sqlite3ext.h # optional
27-
VERSION # optional
25+
shell.c
26+
sqlite3ext.h
27+
VERSION # rename to VERSION.txt
2828
```
2929

30-
The files are copied to: `sqlcipher-amalgamation-<version>`.
30+
Copy these files to: `deps/sqlcipher-amalgamation`.
3131

3232
## Step 2: Get OpenSSL libraries
3333

34-
NodeJS typically includes OpenSSL. However, for Electron on Windows, we need to bundle a copy.
34+
NodeJS typically includes OpenSSL. However, to support Electron, we statically link against libcrypto from OpenSSL.
3535

3636
Run the following commands to generate the latest OpenSSL libs for Windows:
3737

@@ -40,25 +40,15 @@ cd deps
4040
.\openssl-windows.bat
4141
```
4242

43-
... this will output the libs in `deps/openssl-windows` (OpenSSL-WinXX), including the header files in `deps/openssl-windows/openssl-include`. Every arch-specific folder includes these binaries:
43+
... this will output the libs in `deps/` (OpenSSL-WinXX), including the header files in `deps/openssl-include`. Every arch-specific folder includes these binaries:
4444

4545
```
4646
libcrypto.lib
4747
libssl.lib
4848
ossl_static.pdb
4949
```
5050

51-
Copy all folders under `deps/openssl-windows` to `sqlcipher-amalgamation-<version>`.
52-
53-
## Step 3: Build the archive
54-
55-
Archive the folder as `deps/sqlcipher-amalgamation-<version>.tar.gz`, and update the version number in `common-sqlite.gypi` (must be the same).
56-
57-
```
58-
tar czf sqlcipher-amalgamation-$VERSION.tar.gz sqlcipher-amalgamation-$VERSION
59-
```
60-
61-
## Step 4: Test the build
51+
## Step 3: Test the build
6252

6353
Run:
6454

@@ -78,7 +68,7 @@ npm run test
7868
The OpenSSL files are specifically required for Electron, which doesn't bundle OpenSSL like NodeJS does. The header and .lib files are required at compile-time. We bundle a statically-linked version of OpenSSL with the library, so the user does not need to manually install OpenSSL.
7969

8070
`deps/sqlite3.gyp` has been modified from the original node-sqlite3 one to:
81-
* Use the bundled OpenSSL on Windows.
71+
* Use the bundled OpenSSL on Windows and MacOS.
8272
* Add additional define statements required by SQLCipher.
8373

8474

deps/OpenSSL-Win32/libcrypto.lib

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:4308888d9a5811e758377a78e702950e4a88b0b34ca7a40a40c9e01be8febb99
3+
size 17370716

deps/OpenSSL-Win32/libssl.lib

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:eb87cd8fb8147996f07a186b0cfd4a1a5b2c2ccc8350889233aa250430f47357
3+
size 3550650

deps/OpenSSL-Win32/ossl_static.pdb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:3a659cbfb68d2c6999e7268eae65eb5498729eef5e40643fa6a15c60ce634275
3+
size 1060864
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:ea63217cff9c906a1230392031b0e2664c377c75294ecfb9fd16936abe183945
3+
size 18667312

deps/OpenSSL-Win64-ARM/libssl.lib

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:fae12a772a1223fe4b2b6c1a55d517eb5a293892a219553a5b2cfe40d3881acb
3+
size 3977430

0 commit comments

Comments
 (0)