Compare commits
6 Commits
3b3bf381bf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
e7ce86cba0
|
|||
|
de8601180d
|
|||
|
874e22c2e7
|
|||
|
8afa09b948
|
|||
|
0fa835d36e
|
|||
|
510aff407e
|
@@ -1,4 +1,4 @@
|
|||||||
name: "Run nix flake check"
|
name: "Build nix flake checks"
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -6,6 +6,13 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: debian-latest
|
runs-on: debian-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package: [
|
||||||
|
"checkStaticExts",
|
||||||
|
"checkStaticExtsCross",
|
||||||
|
"checkStaticExtsCrossAndroid",
|
||||||
|
]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
@@ -15,5 +22,5 @@ jobs:
|
|||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: https://github.com/cachix/install-nix-action@v31
|
uses: https://github.com/cachix/install-nix-action@v31
|
||||||
|
|
||||||
- name: Nix flake check
|
- name: Nix build check package
|
||||||
run: nix flake check
|
run: nix build .#checks.x86_64-linux.${{ matrix.package }} -L
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 h7x4 <h7x4@nani.wtf>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{ self, pkgs }:
|
||||||
|
let
|
||||||
|
pkgs' = pkgs.pkgsCross.aarch64-android;
|
||||||
|
|
||||||
|
sqlite-example-exts-static = pkgs'.callPackage ./util/sqlite-example-exts-static.nix { };
|
||||||
|
|
||||||
|
sqlite-with-static-exts = self.mkSqlite {
|
||||||
|
pkgs = pkgs';
|
||||||
|
|
||||||
|
extensions = [
|
||||||
|
{
|
||||||
|
library = "${sqlite-example-exts-static}/lib/libaddext.a";
|
||||||
|
init = "sqlite3_addext_init";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
library = "${sqlite-example-exts-static}/lib/libsubext.a";
|
||||||
|
init = "sqlite3_subext_init";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
library = "${sqlite-example-exts-static}/lib/libmultext.a";
|
||||||
|
init = "sqlite3_multext_init";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs'.runCommand "test-sqlite-with-static-exts-aarch64" {
|
||||||
|
nativeBuildInputs = [ sqlite-with-static-exts.sqlite-cli ];
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit sqlite-example-exts-static;
|
||||||
|
inherit sqlite-with-static-exts;
|
||||||
|
};
|
||||||
|
} ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
sqlite3 :memory: <<<"SELECT myadd(1, 2), mysub(5, 3), mymult(4, 6);" | tee "$out/test.log"
|
||||||
|
grep -q -F "3|2|24" "$out/test.log" || (echo "Unexpected output from sqlite3 with static extensions" && exit 1)
|
||||||
|
''
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
checks = forAllSystems (system: pkgs: {
|
checks = forAllSystems (system: pkgs: {
|
||||||
checkStaticExts = import ./checks/check-static-exts.nix { inherit self pkgs; };
|
checkStaticExts = import ./checks/check-static-exts.nix { inherit self pkgs; };
|
||||||
checkStaticExtsCross = import ./checks/check-static-exts-cross.nix { inherit self pkgs; };
|
checkStaticExtsCross = import ./checks/check-static-exts-cross.nix { inherit self pkgs; };
|
||||||
|
checkStaticExtsCrossAndroid = import ./checks/check-static-exts-cross-android.nix { inherit self pkgs; };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " featureFlags;
|
env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " featureFlags;
|
||||||
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
|
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
|
||||||
|
env.CC_FOR_BUILD = "${stdenv.cc.targetPrefix}cc";
|
||||||
|
|
||||||
makeFlags = [ "sqlite3.c" "sqlite3.h" ];
|
makeFlags = [ "sqlite3.c" "sqlite3.h" ];
|
||||||
|
|
||||||
|
|||||||
+16
-1
@@ -79,6 +79,18 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
runHook preCheck
|
runHook preCheck
|
||||||
|
|
||||||
|
for ext in ${lib.escapeShellArgs (builtins.catAttrs "library" extensions)}; do
|
||||||
|
if [ ! -f "$ext" ]; then
|
||||||
|
echo "Extension $ext does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! file "$ext" | grep -qE "ELF|ar archive"; then
|
||||||
|
echo "Extension $ext does not appear to be a valid shared library or static archive."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
for ext in ${lib.escapeShellArgs (builtins.catAttrs "library" extensions)}; do
|
for ext in ${lib.escapeShellArgs (builtins.catAttrs "library" extensions)}; do
|
||||||
if nm -g --defined-only "$ext" | grep -q " sqlite_api$"; then
|
if nm -g --defined-only "$ext" | grep -q " sqlite_api$"; then
|
||||||
echo "Extension $ext appears to reference the 'sqlite_api' symbol, which is not expected for extensions which are going to be statically linked."
|
echo "Extension $ext appears to reference the 'sqlite_api' symbol, which is not expected for extensions which are going to be statically linked."
|
||||||
@@ -92,8 +104,11 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
${lib.concatMapStringsSep "\n" (ext: "expectedSymbols[${lib.escapeShellArg ext.shutdown}]=${lib.escapeShellArg ext.library};") (lib.filter (ext: ext.shutdown or null != null) extensions)}
|
${lib.concatMapStringsSep "\n" (ext: "expectedSymbols[${lib.escapeShellArg ext.shutdown}]=${lib.escapeShellArg ext.library};") (lib.filter (ext: ext.shutdown or null != null) extensions)}
|
||||||
|
|
||||||
for sym in "''${!expectedSymbols[@]}"; do
|
for sym in "''${!expectedSymbols[@]}"; do
|
||||||
if ! nm -g --defined-only "''${expectedSymbols[$sym]}" | grep -q " ''${sym}$"; then
|
SYMBOL_LIST=$(nm -g --defined-only "''${expectedSymbols[$sym]}" | awk '{print $3}' | sed '/^[[:space:]]*$/d')
|
||||||
|
if ! grep -q "''${sym}$" <<< "$SYMBOL_LIST"; then
|
||||||
echo "Expected symbol $sym not found in ''${expectedSymbols[$sym]}."
|
echo "Expected symbol $sym not found in ''${expectedSymbols[$sym]}."
|
||||||
|
echo "Found symbols:"
|
||||||
|
echo "$SYMBOL_LIST"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -67,4 +67,5 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
|
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
|
||||||
env.NIX_LDFLAGS = lib.concatStringsSep " " (if coreInitExt == null then [ ] else coreInitExt.passthru.extraLDFLAGS);
|
env.NIX_LDFLAGS = lib.concatStringsSep " " (if coreInitExt == null then [ ] else coreInitExt.passthru.extraLDFLAGS);
|
||||||
|
env.CC_FOR_BUILD = "${stdenv.cc.targetPrefix}cc";
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -69,4 +69,5 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
|
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
|
||||||
env.NIX_LDFLAGS = lib.concatStringsSep " " (if coreInitExt == null then [ ] else coreInitExt.passthru.extraLDFLAGS);
|
env.NIX_LDFLAGS = lib.concatStringsSep " " (if coreInitExt == null then [ ] else coreInitExt.passthru.extraLDFLAGS);
|
||||||
|
env.CC_FOR_BUILD = "${stdenv.cc.targetPrefix}cc";
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user