From 5a56dbf2db07767a83fc020a84c205db8d418fc7 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 25 Feb 2024 19:32:14 -0300 Subject: [PATCH] edbrowse: enable Unix ODBC support --- pkgs/by-name/ed/edbrowse/package.nix | 43 +++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ed/edbrowse/package.nix b/pkgs/by-name/ed/edbrowse/package.nix index fd053b8e0e2b..154095e57cc8 100644 --- a/pkgs/by-name/ed/edbrowse/package.nix +++ b/pkgs/by-name/ed/edbrowse/package.nix @@ -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";