Skip to content

Commit

Permalink
ci: linux aarch64 cross builds (#96)
Browse files Browse the repository at this point in the history
* try: linux aarch64 cross builds

* x

* fixed maybe

* x

* build

* x
  • Loading branch information
DjDeveloperr authored Mar 13, 2023
1 parent 9096f98 commit 8c8a7ac
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,41 @@ jobs:
- name: Lint
run: deno lint --ignore=sqlite

cross-build-linux-aarch64:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v2
with:
submodules: true

- name: Setup Deno
uses: denoland/setup-deno@main
with:
deno-version: 'v1.x'

- name: Install Dependencies
run: |
sudo apt update
sudo apt install gcc-9-aarch64-linux-gnu
- name: Build
env:
CC: aarch64-linux-gnu-gcc-9
TARGET_ARCH: aarch64
run: deno task build

- name: Release
if: ${{ github.ref == 'refs/heads/main' }}
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "Release Draft"
draft: true
files: |
build/libsqlite3_aarch64.so
test:
strategy:
matrix:
Expand Down
7 changes: 5 additions & 2 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const ARCH = Deno.env.get("TARGET_ARCH") || Deno.build.arch;

const COMPILE_OPTIONS: Record<string, string> = {
SQLITE_DQS: "0",
SQLITE_DEFAULT_MEMSTATUS: "0",
Expand Down Expand Up @@ -36,7 +38,7 @@ const ext = Deno.build.os === "windows"
: "so";
const lib = `${prefix}sqlite3.${ext}`;
const libWithArch = `${prefix}sqlite3${
Deno.build.arch !== "x86_64" ? `_${Deno.build.arch}` : ""
ARCH !== "x86_64" ? `_${ARCH}` : ""
}.${ext}`;

const SLICE_WIN = Deno.build.os === "windows" ? 1 : 0;
Expand Down Expand Up @@ -67,7 +69,7 @@ if (Deno.build.os !== "windows") {

const CFLAGS = `${
Deno.build.os === "windows" ? "OPT_FEATURE_FLAGS" : "CFLAGS"
}=${Deno.build.os === "windows" ? "" : "-g -O3 "}${
}=${Deno.build.os === "windows" ? "" : "-g -O3 -fPIC "}${
Object.entries(
COMPILE_OPTIONS,
)
Expand All @@ -94,6 +96,7 @@ if (Deno.build.os === "windows") {
$(
new URL("../sqlite/configure", import.meta.url),
"--enable-releasemode",
...(Deno.build.arch === ARCH ? [] : ["--disable-tcl", "--host=arm-linux"]),
);
$(
"make",
Expand Down
5 changes: 1 addition & 4 deletions src/ffi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,7 @@ try {
throw e;
}

const error = new Error("Failed to load SQLite3 Dynamic Library");
error.cause = e;

throw error;
throw new Error("Failed to load SQLite3 Dynamic Library", { cause: e });
}

const init = lib.sqlite3_initialize();
Expand Down

0 comments on commit 8c8a7ac

Please sign in to comment.