From 86f56f178e2b140cca56d832e98dbcc0bed1514c Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sat, 4 Jan 2025 19:41:15 +0100 Subject: [PATCH 1/2] wxhexeditor: move to pkgs/by-name --- .../editors => by-name/wx}/wxhexeditor/missing-semicolon.patch | 0 .../default.nix => by-name/wx/wxhexeditor/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/{applications/editors => by-name/wx}/wxhexeditor/missing-semicolon.patch (100%) rename pkgs/{applications/editors/wxhexeditor/default.nix => by-name/wx/wxhexeditor/package.nix} (100%) diff --git a/pkgs/applications/editors/wxhexeditor/missing-semicolon.patch b/pkgs/by-name/wx/wxhexeditor/missing-semicolon.patch similarity index 100% rename from pkgs/applications/editors/wxhexeditor/missing-semicolon.patch rename to pkgs/by-name/wx/wxhexeditor/missing-semicolon.patch diff --git a/pkgs/applications/editors/wxhexeditor/default.nix b/pkgs/by-name/wx/wxhexeditor/package.nix similarity index 100% rename from pkgs/applications/editors/wxhexeditor/default.nix rename to pkgs/by-name/wx/wxhexeditor/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c1246415e951..12a611fa2e95 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15879,7 +15879,7 @@ with pkgs; wsjtx = qt5.callPackage ../applications/radio/wsjtx { }; - wxhexeditor = callPackage ../applications/editors/wxhexeditor { + wxhexeditor = callPackage ../by-name/wx/wxhexeditor/package.nix { inherit (darwin.apple_sdk.frameworks) Cocoa; inherit (llvmPackages) openmp; wxGTK = wxGTK32; From b00775ff87cb6a9261b9b436f0dc8f04b02ec64f Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sat, 4 Jan 2025 19:45:22 +0100 Subject: [PATCH 2/2] wxhexeditor: refactor --- pkgs/by-name/wx/wxhexeditor/package.nix | 63 ++++++++++++------------- pkgs/top-level/all-packages.nix | 6 --- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/pkgs/by-name/wx/wxhexeditor/package.nix b/pkgs/by-name/wx/wxhexeditor/package.nix index 9dda57287fc4..e581b8c50ba8 100644 --- a/pkgs/by-name/wx/wxhexeditor/package.nix +++ b/pkgs/by-name/wx/wxhexeditor/package.nix @@ -8,22 +8,41 @@ gettext, libtool, python3, - wxGTK, - openmp, - Cocoa, + wxGTK32, + llvmPackages, }: stdenv.mkDerivation rec { - pname = "wxHexEditor"; + pname = "wxhexeditor"; version = "0.24"; src = fetchFromGitHub { repo = "wxHexEditor"; owner = "EUA"; rev = "v${version}"; - sha256 = "08xnhaif8syv1fa0k6lc3jm7yg2k50b02lyds8w0jyzh4xi5crqj"; + hash = "sha256-EmdWYifwewk40s1TARYoUzx/qhyMmgmUC9tr5KKCtiM="; }; + patches = [ + # https://github.com/EUA/wxHexEditor/issues/90 + (fetchpatch { + url = "https://github.com/EUA/wxHexEditor/commit/d0fa3ddc3e9dc9b05f90b650991ef134f74eed01.patch"; + hash = "sha256-0m+dvsPlEoRnc22O73InR+NLPWb5JiSzEwdDmyE4i/E="; + }) + ./missing-semicolon.patch + ]; + + postPatch = + '' + substituteInPlace Makefile \ + --replace-fail "/usr" "$out" \ + --replace-fail "mhash; ./configure" "mhash; ./configure --prefix=$out" + '' + + lib.optionalString stdenv.cc.isClang '' + substituteInPlace Makefile \ + --replace-fail "-lgomp" "-lomp" + ''; + strictDeps = true; nativeBuildInputs = [ @@ -32,39 +51,19 @@ stdenv.mkDerivation rec { gettext libtool python3 - wxGTK + wxGTK32 ]; - buildInputs = - lib.optionals stdenv.cc.isClang [ - openmp - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - Cocoa - ]; + buildInputs = lib.optionals stdenv.cc.isClang [ + llvmPackages.openmp + ]; preConfigure = "patchShebangs ."; - prePatch = - '' - substituteInPlace Makefile --replace "/usr" "$out" - substituteInPlace Makefile --replace "mhash; ./configure" "mhash; ./configure --prefix=$out" - '' - + lib.optionalString stdenv.cc.isClang '' - substituteInPlace Makefile --replace "-lgomp" "-lomp" - ''; - - patches = [ - # https://github.com/EUA/wxHexEditor/issues/90 - (fetchpatch { - url = "https://github.com/EUA/wxHexEditor/commit/d0fa3ddc3e9dc9b05f90b650991ef134f74eed01.patch"; - sha256 = "1wcb70hrnhq72frj89prcqylpqs74xrfz3kdfdkq84p5qfz9svyj"; - }) - ./missing-semicolon.patch + makeFlags = lib.optionals stdenv.cc.isGNU [ + "OPTFLAGS=-fopenmp" ]; - makeFlags = lib.optionals stdenv.cc.isGNU [ "OPTFLAGS=-fopenmp" ]; - meta = { description = "Hex Editor / Disk Editor for Huge Files or Devices"; longDescription = '' @@ -79,8 +78,8 @@ stdenv.mkDerivation rec { ''; homepage = "http://www.wxhexeditor.org/"; license = lib.licenses.gpl2Plus; - platforms = lib.platforms.unix; maintainers = with lib.maintainers; [ wegank ]; mainProgram = "wxHexEditor"; + platforms = lib.platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 12a611fa2e95..0b233356a78f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15879,12 +15879,6 @@ with pkgs; wsjtx = qt5.callPackage ../applications/radio/wsjtx { }; - wxhexeditor = callPackage ../by-name/wx/wxhexeditor/package.nix { - inherit (darwin.apple_sdk.frameworks) Cocoa; - inherit (llvmPackages) openmp; - wxGTK = wxGTK32; - }; - x11basic = callPackage ../development/compilers/x11basic { autoconf = buildPackages.autoconf269; };