checks/check-static-exts-cross: init, move checks to separate dir
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
{ self, pkgs }:
|
||||||
|
let
|
||||||
|
pkgs' = pkgs.pkgsCross.aarch64-multiplatform;
|
||||||
|
|
||||||
|
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)
|
||||||
|
''
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{ self, pkgs }:
|
||||||
|
let
|
||||||
|
sqlite-example-exts-static = pkgs.callPackage ./util/sqlite-example-exts-static.nix { };
|
||||||
|
|
||||||
|
sqlite-with-static-exts = self.mkSqlite {
|
||||||
|
inherit 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" {
|
||||||
|
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)
|
||||||
|
''
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
sqlite,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "sqlite-example-exts-static";
|
||||||
|
src = ../sqlite-example-exts;
|
||||||
|
|
||||||
|
env.NIX_CFLAGS_COMPILE = "-DSQLITE_CORE";
|
||||||
|
|
||||||
|
buildInputs = [ sqlite.dev ];
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
"$CC" -c addext.c
|
||||||
|
"$AR" rcs libaddext.a addext.o
|
||||||
|
|
||||||
|
"$CC" -c subext.c
|
||||||
|
"$AR" rcs libsubext.a subext.o
|
||||||
|
|
||||||
|
"$CC" -c multext.c
|
||||||
|
"$AR" rcs libmultext.a multext.o
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
install -Dm444 *.a -t "$out/lib"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -41,70 +41,9 @@
|
|||||||
"sqlite-static${result._suffix}" = result.sqlite-static;
|
"sqlite-static${result._suffix}" = result.sqlite-static;
|
||||||
}) productVars));
|
}) productVars));
|
||||||
|
|
||||||
checks = forAllSystems (system: pkgs: let
|
checks = forAllSystems (system: pkgs: {
|
||||||
sqlite-example-exts-static = pkgs.stdenv.mkDerivation {
|
checkStaticExts = import ./checks/check-static-exts.nix { inherit self pkgs; };
|
||||||
name = "sqlite-example-exts-static";
|
checkStaticExtsCross = import ./checks/check-static-exts-cross.nix { inherit self pkgs; };
|
||||||
src = ./sqlite-example-exts;
|
|
||||||
|
|
||||||
env.NIX_CFLAGS_COMPILE = "-DSQLITE_CORE";
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [ sqlite.dev ];
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
"$CC" -c addext.c
|
|
||||||
"$AR" rcs libaddext.a addext.o
|
|
||||||
|
|
||||||
"$CC" -c subext.c
|
|
||||||
"$AR" rcs libsubext.a subext.o
|
|
||||||
|
|
||||||
"$CC" -c multext.c
|
|
||||||
"$AR" rcs libmultext.a multext.o
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
install -Dm444 *.a -t "$out/lib"
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
sqlite-with-static-exts = self.mkSqlite {
|
|
||||||
inherit 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 {
|
|
||||||
checkExts = pkgs.runCommand "test-sqlite-with-static-exts" {
|
|
||||||
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)
|
|
||||||
'';
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user