Initial commit
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
{
|
||||
lib,
|
||||
|
||||
src,
|
||||
version,
|
||||
nameSuffix,
|
||||
|
||||
stdenv,
|
||||
featureFlags ? [ ],
|
||||
extensions ? [ ],
|
||||
enableInteractive ? false,
|
||||
|
||||
unzip,
|
||||
zlib,
|
||||
readline,
|
||||
ncurses,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "sqlite-amalgamation${nameSuffix}";
|
||||
inherit version src;
|
||||
|
||||
outputs = [
|
||||
# "bin"
|
||||
"dev"
|
||||
"out"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
unzip
|
||||
];
|
||||
buildInputs = [
|
||||
zlib
|
||||
]
|
||||
++ lib.optionals enableInteractive [
|
||||
readline
|
||||
ncurses
|
||||
];
|
||||
|
||||
# required for aarch64 but applied for all arches for simplicity
|
||||
preConfigure = ''
|
||||
patchShebangs configure
|
||||
'';
|
||||
|
||||
# sqlite relies on autosetup now; so many of the
|
||||
# previously-understood flags are gone. They should instead be set
|
||||
# on a per-output basis.
|
||||
setOutputFlags = false;
|
||||
|
||||
configureFlags = [
|
||||
# "--bindir=${placeholder "bin"}/bin"
|
||||
"--includedir=${placeholder "dev"}/include"
|
||||
"--libdir=${placeholder "out"}/lib"
|
||||
]
|
||||
++ lib.optional (!enableInteractive) "--disable-readline"
|
||||
# autosetup only looks up readline.h in predefined set of directories.
|
||||
++ lib.optional enableInteractive "--with-readline-header=${lib.getDev readline}/include/readline/readline.h"
|
||||
++ lib.optional (stdenv.hostPlatform.isStatic) "--disable-shared";
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString featureFlags;
|
||||
|
||||
# Test for features which may not be available at compile time
|
||||
preBuild = ''
|
||||
# Necessary for FTS5 on Linux
|
||||
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lm"
|
||||
|
||||
echo ""
|
||||
echo "NIX_CFLAGS_COMPILE = $NIX_CFLAGS_COMPILE"
|
||||
echo ""
|
||||
'';
|
||||
|
||||
makeTarget = "sqlite3.c";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm444 sqlite3.{c,h} -t "$out"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# dontInstall = true;
|
||||
})
|
||||
Reference in New Issue
Block a user