From 7b1b72c853215b37ba32507d86b798c9c9cb72ec Mon Sep 17 00:00:00 2001 From: Ente Date: Wed, 11 Dec 2019 18:34:41 +0100 Subject: [PATCH 1/6] hopper: fix libxml2 dynamic linking issue * port to qt5.callPackage / mkDerivation * format derivation --- .../tools/analysis/hopper/default.nix | 29 ++++++++++++++----- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/analysis/hopper/default.nix b/pkgs/development/tools/analysis/hopper/default.nix index c9214ae7e35d..3df60c0b99c8 100644 --- a/pkgs/development/tools/analysis/hopper/default.nix +++ b/pkgs/development/tools/analysis/hopper/default.nix @@ -1,6 +1,21 @@ -{ stdenv, fetchurl, pkgs, lib }: +{ mkDerivation, stdenv, fetchurl, pkgs, lib, qtbase }: +let -stdenv.mkDerivation rec { + ldLibraryPath = with pkgs; stdenv.lib.makeLibraryPath [ + libbsd.out + libffi.out + gmpxx.out + python27Full.out + python27Packages.libxml2.out + qt5.qtbase + zlib + xlibs.libX11.out + xorg_sys_opengl.out + xlibs.libXrender.out + gcc-unwrapped.lib + ]; + +in mkDerivation rec { pname = "hopper"; version = "4.5.7"; rev = "v${lib.versions.major version}"; @@ -12,13 +27,13 @@ stdenv.mkDerivation rec { sourceRoot = "."; - ldLibraryPath = with pkgs; stdenv.lib.makeLibraryPath [ -libbsd.out libffi.out gmpxx.out python27Full.out python27Packages.libxml2 qt5.qtbase zlib xlibs.libX11.out xorg_sys_opengl.out xlibs.libXrender.out gcc-unwrapped.lib + buildInputs = [ + qtbase ]; - nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ]; - - qtWrapperArgs = [ ''--suffix LD_LIBRARY_PATH : ${ldLibraryPath}'' ]; + qtWrapperArgs = [ + ''--suffix LD_LIBRARY_PATH : ${ldLibraryPath}'' + ]; installPhase = '' mkdir -p $out/bin diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2b0483568cbf..9e97b8b8124c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1831,7 +1831,7 @@ in hostsblock = callPackage ../tools/misc/hostsblock { }; - hopper = callPackage ../development/tools/analysis/hopper {}; + hopper = qt5.callPackage ../development/tools/analysis/hopper {}; hr = callPackage ../applications/misc/hr { }; From 2f7f00bb84c2a69269aeda5eb6054b50da4e3255 Mon Sep 17 00:00:00 2001 From: Ente Date: Wed, 11 Dec 2019 21:13:30 +0100 Subject: [PATCH 2/6] hopper: refactor derivation * use wrapQtAppsHook in favour for the custom qt builder * use autoPatchelfHook * cleanup build dependencies * add maintainer Enteee --- .../tools/analysis/hopper/default.nix | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pkgs/development/tools/analysis/hopper/default.nix b/pkgs/development/tools/analysis/hopper/default.nix index 3df60c0b99c8..8f0b6c5b2df2 100644 --- a/pkgs/development/tools/analysis/hopper/default.nix +++ b/pkgs/development/tools/analysis/hopper/default.nix @@ -1,21 +1,17 @@ -{ mkDerivation, stdenv, fetchurl, pkgs, lib, qtbase }: +{ + stdenv, fetchurl, lib, + + autoPatchelfHook, + + wrapQtAppsHook, + + libbsd, + python27, + gmpxx, +}: let - ldLibraryPath = with pkgs; stdenv.lib.makeLibraryPath [ - libbsd.out - libffi.out - gmpxx.out - python27Full.out - python27Packages.libxml2.out - qt5.qtbase - zlib - xlibs.libX11.out - xorg_sys_opengl.out - xlibs.libXrender.out - gcc-unwrapped.lib - ]; - -in mkDerivation rec { +in stdenv.mkDerivation rec { pname = "hopper"; version = "4.5.7"; rev = "v${lib.versions.major version}"; @@ -27,31 +23,35 @@ in mkDerivation rec { sourceRoot = "."; - buildInputs = [ - qtbase + nativeBuildInputs = [ + wrapQtAppsHook + autoPatchelfHook ]; - qtWrapperArgs = [ - ''--suffix LD_LIBRARY_PATH : ${ldLibraryPath}'' + buildInputs = [ + libbsd + python27 + gmpxx ]; installPhase = '' mkdir -p $out/bin mkdir -p $out/lib mkdir -p $out/share + cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper cp -r $sourceRoot/opt/hopper-${rev}/lib $out cp -r $sourceRoot/usr/share $out/share - patchelf \ - --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \ - $out/bin/hopper ''; - meta = { + meta = with stdenv.lib; { homepage = "https://www.hopperapp.com/index.html"; description = "A macOS and Linux Disassembler"; - license = stdenv.lib.licenses.unfree; - maintainers = [ stdenv.lib.maintainers.luis ]; - platforms = stdenv.lib.platforms.linux; + license = licenses.unfree; + maintainers = [ + maintainers.luis + maintainers.Enteee + ]; + platforms = platforms.linux; }; } From b301e82cfe825bd3db4fbcc39820724a6c6f213a Mon Sep 17 00:00:00 2001 From: Ente Date: Wed, 11 Dec 2019 21:19:21 +0100 Subject: [PATCH 3/6] hopper: 4.5.7 -> 4.5.19 --- pkgs/development/tools/analysis/hopper/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/analysis/hopper/default.nix b/pkgs/development/tools/analysis/hopper/default.nix index 8f0b6c5b2df2..d58fad474301 100644 --- a/pkgs/development/tools/analysis/hopper/default.nix +++ b/pkgs/development/tools/analysis/hopper/default.nix @@ -13,12 +13,12 @@ let in stdenv.mkDerivation rec { pname = "hopper"; - version = "4.5.7"; + version = "4.5.19"; rev = "v${lib.versions.major version}"; src = fetchurl { url = "https://d2ap6ypl1xbe4k.cloudfront.net/Hopper-${rev}-${version}-Linux.pkg.tar.xz"; - sha256 = "1ce7a0f13126a940398aa8da4a74e250dff0401074f30446a8840ac3dbb902c0"; + sha256 = "1c9wbjwz5xn0skz2a1wpxyx78hhrm8vcbpzagsg4wwnyblap59db"; }; sourceRoot = "."; From 7da91c565c55d02accb297e1180ce720336782c4 Mon Sep 17 00:00:00 2001 From: Ente Date: Sun, 15 Dec 2019 14:54:28 +0100 Subject: [PATCH 4/6] hopper: apply changes from code review * add dependency to ncurses, gnustep * don't copy to share/share * run pre/post Install hooks * fix desktop icon * with maintainers --- .../tools/analysis/hopper/default.nix | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/analysis/hopper/default.nix b/pkgs/development/tools/analysis/hopper/default.nix index d58fad474301..5786bacd7a9d 100644 --- a/pkgs/development/tools/analysis/hopper/default.nix +++ b/pkgs/development/tools/analysis/hopper/default.nix @@ -8,10 +8,11 @@ libbsd, python27, gmpxx, -}: -let -in stdenv.mkDerivation rec { + ncurses5, + gnustep, +}: +stdenv.mkDerivation rec { pname = "hopper"; version = "4.5.19"; rev = "v${lib.versions.major version}"; @@ -32,25 +33,47 @@ in stdenv.mkDerivation rec { libbsd python27 gmpxx + + ncurses5 + gnustep.libobjc ]; installPhase = '' + runHook preInstall + mkdir -p $out/bin mkdir -p $out/lib mkdir -p $out/share cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper - cp -r $sourceRoot/opt/hopper-${rev}/lib $out - cp -r $sourceRoot/usr/share $out/share + cp \ + --archive \ + $sourceRoot/opt/hopper-${rev}/lib/libBlocksRuntime.so* \ + $sourceRoot/opt/hopper-${rev}/lib/libdispatch.so* \ + $sourceRoot/opt/hopper-${rev}/lib/libgnustep-base.so* \ + $sourceRoot/opt/hopper-${rev}/lib/libHopperCore.so* \ + $sourceRoot/opt/hopper-${rev}/lib/libkqueue.so* \ + $sourceRoot/opt/hopper-${rev}/lib/libobjcxx.so* \ + $sourceRoot/opt/hopper-${rev}/lib/libpthread_workqueue.so* \ + $out/lib + + cp -r $sourceRoot/usr/share $out + + runHook postInstall + ''; + + postFixup = '' + substituteInPlace "$out/share/applications/hopper-${rev}.desktop" \ + --replace "Exec=/opt/hopper-${rev}/bin/Hopper" "Exec=$out/bin/hopper" ''; meta = with stdenv.lib; { homepage = "https://www.hopperapp.com/index.html"; description = "A macOS and Linux Disassembler"; license = licenses.unfree; - maintainers = [ - maintainers.luis - maintainers.Enteee + maintainers = with maintainers; [ + luis + Enteee ]; platforms = platforms.linux; }; From bb517428021ab1670f8532ad3d417436b3652ff4 Mon Sep 17 00:00:00 2001 From: Ente Date: Sun, 15 Dec 2019 15:01:21 +0100 Subject: [PATCH 5/6] hopper: nixpkgs-fmt --- .../tools/analysis/hopper/default.nix | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/pkgs/development/tools/analysis/hopper/default.nix b/pkgs/development/tools/analysis/hopper/default.nix index 5786bacd7a9d..78be246eb878 100644 --- a/pkgs/development/tools/analysis/hopper/default.nix +++ b/pkgs/development/tools/analysis/hopper/default.nix @@ -1,19 +1,17 @@ -{ - stdenv, fetchurl, lib, - - autoPatchelfHook, - - wrapQtAppsHook, - - libbsd, - python27, - gmpxx, - - ncurses5, - gnustep, +{ stdenv +, fetchurl +, lib +, autoPatchelfHook +, wrapQtAppsHook +, libbsd +, python27 +, gmpxx +, ncurses5 +, gnustep +, }: stdenv.mkDerivation rec { - pname = "hopper"; + pname = "hopper"; version = "4.5.19"; rev = "v${lib.versions.major version}"; From 970e6452ed5f94f55487502dbdf0703e8c628adb Mon Sep 17 00:00:00 2001 From: Ente Date: Wed, 18 Dec 2019 12:42:27 +0100 Subject: [PATCH 6/6] hopper: remove unneeded , --- pkgs/development/tools/analysis/hopper/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/tools/analysis/hopper/default.nix b/pkgs/development/tools/analysis/hopper/default.nix index 78be246eb878..8bb1c5d04f87 100644 --- a/pkgs/development/tools/analysis/hopper/default.nix +++ b/pkgs/development/tools/analysis/hopper/default.nix @@ -8,7 +8,6 @@ , gmpxx , ncurses5 , gnustep -, }: stdenv.mkDerivation rec { pname = "hopper";