edbrowse: enable Unix ODBC support

This commit is contained in:
Anderson Torres 2024-02-25 19:32:14 -03:00
parent 7659f7b35b
commit 5a56dbf2db

View file

@ -10,7 +10,9 @@
, quickjs
, readline
, stdenv
, unixODBC
, which
, withODBC ? true
}:
stdenv.mkDerivation (finalAttrs: {
@ -24,6 +26,23 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-ZXxzQBAmu7kM3sjqg/rDLBXNucO8sFRFKXV8UxQVQZU=";
};
sourceRoot = "${finalAttrs.src.name}/src";
patches = [
# Fixes some small annoyances on src/makefile
./0001-small-fixes.patch
];
patchFlags = [
"-p2"
];
postPatch = ''
for file in $(find ./tools/ -type f ! -name '*.c'); do
patchShebangs $file
done
'';
nativeBuildInputs = [
pkg-config
which
@ -38,26 +57,22 @@ stdenv.mkDerivation (finalAttrs: {
perl
quickjs
readline
] ++ lib.optionals withODBC [
unixODBC
];
patches = [
# Fixes some small annoyances on src/makefile
./0001-small-fixes.patch
];
postPatch = ''
substituteInPlace src/makefile \
--replace '-L/usr/local/lib/quickjs' '-L${quickjs}/lib/quickjs'
for file in $(find ./tools/ -type f ! -name '*.c'); do
patchShebangs $file
done
'';
makeFlags = [
"-C" "src"
"PREFIX=${placeholder "out"}"
];
preBuild = ''
buildFlagsArray+=(
BUILD_EDBR_ODBC=${if withODBC then "on" else "off"}
EBDEMIN=on
QUICKJS_LDFLAGS="-L${quickjs}/lib/quickjs -lquickjs -ldl -latomic"
)
'';
meta = {
homepage = "https://edbrowse.org/";
description = "Command Line Editor Browser";