From 98802aa75a940f0670aa433664f17ccec33e6e0d Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 25 Feb 2024 18:41:45 -0300 Subject: [PATCH 1/3] edbrowse: migrate to by-name --- .../editors => by-name/ed}/edbrowse/0001-small-fixes.patch | 0 .../edbrowse/default.nix => by-name/ed/edbrowse/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 2 deletions(-) rename pkgs/{applications/editors => by-name/ed}/edbrowse/0001-small-fixes.patch (100%) rename pkgs/{applications/editors/edbrowse/default.nix => by-name/ed/edbrowse/package.nix} (100%) diff --git a/pkgs/applications/editors/edbrowse/0001-small-fixes.patch b/pkgs/by-name/ed/edbrowse/0001-small-fixes.patch similarity index 100% rename from pkgs/applications/editors/edbrowse/0001-small-fixes.patch rename to pkgs/by-name/ed/edbrowse/0001-small-fixes.patch diff --git a/pkgs/applications/editors/edbrowse/default.nix b/pkgs/by-name/ed/edbrowse/package.nix similarity index 100% rename from pkgs/applications/editors/edbrowse/default.nix rename to pkgs/by-name/ed/edbrowse/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5c01638c2092..8b17c48d3316 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31018,8 +31018,6 @@ with pkgs; inherit (recurseIntoAttrs (callPackage ../applications/editors/ed { })) ed edUnstable; - edbrowse = callPackage ../applications/editors/edbrowse { }; - edlin = callPackage ../applications/editors/edlin { }; orbiton = callPackage ../applications/editors/orbiton { From 7659f7b35b1e0192cc321922d84d75301b215f89 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 25 Feb 2024 18:47:29 -0300 Subject: [PATCH 2/3] edbrowse: refactor - finalAttrs design pattern - get rid of nested with - substitute vrthra to AndersonTorres on meta.maintainers --- pkgs/by-name/ed/edbrowse/package.nix | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ed/edbrowse/package.nix b/pkgs/by-name/ed/edbrowse/package.nix index 0f51e016c0ea..fd053b8e0e2b 100644 --- a/pkgs/by-name/ed/edbrowse/package.nix +++ b/pkgs/by-name/ed/edbrowse/package.nix @@ -1,8 +1,7 @@ { lib -, stdenv -, fetchFromGitHub , curl , duktape +, fetchFromGitHub , html-tidy , openssl , pcre @@ -10,17 +9,18 @@ , pkg-config , quickjs , readline +, stdenv , which }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "edbrowse"; version = "3.8.0"; src = fetchFromGitHub { owner = "CMB"; - repo = pname; - rev = "v${version}"; + repo = "edbrowse"; + rev = "v${finalAttrs.version}"; hash = "sha256-ZXxzQBAmu7kM3sjqg/rDLBXNucO8sFRFKXV8UxQVQZU="; }; @@ -28,6 +28,7 @@ stdenv.mkDerivation rec { pkg-config which ]; + buildInputs = [ curl duktape @@ -45,10 +46,10 @@ stdenv.mkDerivation rec { ]; postPatch = '' - substituteInPlace src/makefile --replace\ - '-L/usr/local/lib/quickjs' '-L${quickjs}/lib/quickjs' - for i in $(find ./tools/ -type f ! -name '*.c'); do - patchShebangs $i + 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 ''; @@ -57,7 +58,7 @@ stdenv.mkDerivation rec { "PREFIX=${placeholder "out"}" ]; - meta = with lib; { + meta = { homepage = "https://edbrowse.org/"; description = "Command Line Editor Browser"; longDescription = '' @@ -71,10 +72,14 @@ stdenv.mkDerivation rec { send email, with no human intervention whatsoever. edbrowse can also tap into databases through odbc. It was primarily written by Karl Dahlke. ''; - license = licenses.gpl1Plus; - maintainers = with maintainers; [ schmitthenner vrthra equirosa ]; - platforms = platforms.linux; + license = with lib.licenses; [ gpl1Plus ]; mainProgram = "edbrowse"; + maintainers = with lib.maintainers; [ + schmitthenner + equirosa + AndersonTorres + ]; + platforms = lib.platforms.linux; }; -} +}) # TODO: send the patch to upstream developers From 5a56dbf2db07767a83fc020a84c205db8d418fc7 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 25 Feb 2024 19:32:14 -0300 Subject: [PATCH 3/3] 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";