From a8cf5d34970470bed49a336628c77a122cd4dc3b Mon Sep 17 00:00:00 2001 From: Noah Fontes Date: Tue, 6 Sep 2022 15:44:32 -0700 Subject: p4v: 2021.3.2186916 -> 2022.2.2336701 --- pkgs/applications/version-management/p4v/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkgs/applications/version-management') diff --git a/pkgs/applications/version-management/p4v/default.nix b/pkgs/applications/version-management/p4v/default.nix index 9c804a7459b49..b3b9bd77052a6 100644 --- a/pkgs/applications/version-management/p4v/default.nix +++ b/pkgs/applications/version-management/p4v/default.nix @@ -28,11 +28,11 @@ let in stdenv.mkDerivation rec { pname = "p4v"; - version = "2021.3.2186916"; + version = "2022.2.2336701"; src = fetchurl { - url = "http://web.archive.org/web/20211118024745/https://cdist2.perforce.com/perforce/r21.3/bin.linux26x86_64/p4v.tgz"; - sha256 = "1zldg21xq4srww9pcfbv3p8320ghjnh333pz5r70z1gwbq4vf3jq"; + url = "https://web.archive.org/web/20220902181457/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; + sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; }; dontBuild = true; -- cgit 1.4.1 From 98d026a144d729d7054067cee6a57e6999d5c03f Mon Sep 17 00:00:00 2001 From: Noah Fontes Date: Tue, 6 Sep 2022 15:48:39 -0700 Subject: p4v: use autoPatchelfHook, upstream libraries P4V comes with a compatible set of Qt libraries that just need to be patchelf'd to be usable, which avoids the need for the crypto hack we were using. Switch to using autoPatchelfHook for all libraries, and prefer the distribution's Qt libraries as part of that. This also fixes a bug in the distributed version of p4d, which prevented DVCS from working correctly in P4V. --- .../version-management/p4v/default.nix | 115 +++++++++++---------- 1 file changed, 58 insertions(+), 57 deletions(-) (limited to 'pkgs/applications/version-management') diff --git a/pkgs/applications/version-management/p4v/default.nix b/pkgs/applications/version-management/p4v/default.nix index b3b9bd77052a6..90e1e3af6256a 100644 --- a/pkgs/applications/version-management/p4v/default.nix +++ b/pkgs/applications/version-management/p4v/default.nix @@ -1,32 +1,33 @@ { stdenv , fetchurl , lib -, qtbase +, autoPatchelfHook +, cups +, dbus +, fontconfig +, gccForLibs +, libX11 +, libXcomposite +, libXcursor +, libXdamage +, libXext +, libXi +, libXrandr +, libXrender +, libXtst +, libinput +, libxcb +, libxkbcommon +, nss +, qttools , qtwebengine -, qtdeclarative -, qtwebchannel -, syntax-highlighting -, openssl -, xkeyboard_config -, patchelfUnstable -, wrapQtAppsHook -, writeText +, xcbutilimage +, xcbutilkeysyms +, xcbutilrenderutil +, xcbutilwm }: -let - # This abomination exists because p4v calls CRYPTO_set_mem_functions and - # expects it to succeed. The function will fail if CRYPTO_malloc has already - # been called, which happens at init time via qtwebengine -> ... -> libssh. I - # suspect it was meant to work with a version of Qt where openssl is - # statically linked or some other library is used. - crypto-hack = writeText "crypto-hack.c" '' - #include - int CRYPTO_set_mem_functions( - void *(*m)(size_t, const char *, int), - void *(*r)(void *, size_t, const char *, int), - void (*f)(void *, const char *, int)) { return 1; } - ''; -in stdenv.mkDerivation rec { +stdenv.mkDerivation { pname = "p4v"; version = "2022.2.2336701"; @@ -35,50 +36,50 @@ in stdenv.mkDerivation rec { sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; }; - dontBuild = true; - nativeBuildInputs = [ patchelfUnstable wrapQtAppsHook ]; - - ldLibraryPath = lib.makeLibraryPath [ - stdenv.cc.cc.lib - qtbase - qtwebengine - qtdeclarative - qtwebchannel - syntax-highlighting - openssl + nativeBuildInputs = [ autoPatchelfHook ]; + buildInputs = [ + cups + dbus + fontconfig + gccForLibs + libX11 + libXcomposite + libXcursor + libXdamage + libXext + libXi + libXrandr + libXrender + libXtst + libinput + libxcb + libxkbcommon + nss + qttools + qtwebengine + xcbutilimage + xcbutilkeysyms + xcbutilrenderutil + xcbutilwm ]; + dontBuild = true; + + # Don't wrap the Qt apps; upstream has its own wrapper scripts. dontWrapQtApps = true; - installPhase = '' - mkdir $out - cp -r bin $out - mkdir -p $out/lib - cp -r lib/P4VResources $out/lib - $CC -fPIC -shared -o $out/lib/libcrypto-hack.so ${crypto-hack} - for f in $out/bin/*.bin ; do - patchelf --set-rpath $ldLibraryPath --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f - # combining this with above breaks rpath (patchelf bug?) - patchelf --add-needed libstdc++.so \ - --add-needed $out/lib/libcrypto-hack.so \ - --clear-symbol-version _ZNSt20bad_array_new_lengthD1Ev \ - --clear-symbol-version _ZTVSt20bad_array_new_length \ - --clear-symbol-version _ZTISt20bad_array_new_length \ - --clear-symbol-version _ZdlPvm \ - $f - wrapQtApp $f \ - --suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb - done + installPhase = '' + mkdir -p $out + cp -r bin lib $out + addAutoPatchelfSearchPath $out/lib ''; - dontFixup = true; - meta = { - description = "Perforce Visual Client"; + description = "Perforce Helix Visual Client"; homepage = "https://www.perforce.com"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = lib.licenses.unfreeRedistributable; platforms = [ "x86_64-linux" ]; - maintainers = with lib.maintainers; [ nathyong nioncode ]; + maintainers = with lib.maintainers; [ impl nathyong nioncode ]; }; } -- cgit 1.4.1 From 0defcde4c01baa6c4eda01aad9efbb4d7faab896 Mon Sep 17 00:00:00 2001 From: Noah Fontes Date: Tue, 6 Sep 2022 15:53:30 -0700 Subject: p4v: wrap derivation to avoid polluting PATH P4V includes a bunch of extra binaries in its bin directory that are only useful as part of their wrapper scripts. They really belong in a libexec-style directory, but their wrappers hardcode bin, so we take the easier approach of wrapping their wrappers. --- .../version-management/p4v/default.nix | 114 ++++++++++++--------- 1 file changed, 68 insertions(+), 46 deletions(-) (limited to 'pkgs/applications/version-management') diff --git a/pkgs/applications/version-management/p4v/default.nix b/pkgs/applications/version-management/p4v/default.nix index 90e1e3af6256a..6e4ff1f2c13e1 100644 --- a/pkgs/applications/version-management/p4v/default.nix +++ b/pkgs/applications/version-management/p4v/default.nix @@ -27,59 +27,81 @@ , xcbutilwm }: -stdenv.mkDerivation { +let pname = "p4v"; version = "2022.2.2336701"; - src = fetchurl { - url = "https://web.archive.org/web/20220902181457/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; - sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; - }; + unwrapped = stdenv.mkDerivation { + pname = "${pname}-unwrapped"; + inherit version; - nativeBuildInputs = [ autoPatchelfHook ]; - buildInputs = [ - cups - dbus - fontconfig - gccForLibs - libX11 - libXcomposite - libXcursor - libXdamage - libXext - libXi - libXrandr - libXrender - libXtst - libinput - libxcb - libxkbcommon - nss - qttools - qtwebengine - xcbutilimage - xcbutilkeysyms - xcbutilrenderutil - xcbutilwm - ]; + src = fetchurl { + url = "https://web.archive.org/web/20220902181457/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; + sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; + }; - dontBuild = true; + nativeBuildInputs = [ autoPatchelfHook ]; + buildInputs = [ + cups + dbus + fontconfig + gccForLibs + libX11 + libXcomposite + libXcursor + libXdamage + libXext + libXi + libXrandr + libXrender + libXtst + libinput + libxcb + libxkbcommon + nss + qttools + qtwebengine + xcbutilimage + xcbutilkeysyms + xcbutilrenderutil + xcbutilwm + ]; - # Don't wrap the Qt apps; upstream has its own wrapper scripts. - dontWrapQtApps = true; + dontBuild = true; - installPhase = '' - mkdir -p $out - cp -r bin lib $out - addAutoPatchelfSearchPath $out/lib - ''; + # Don't wrap the Qt apps; upstream has its own wrapper scripts. + dontWrapQtApps = true; + + installPhase = '' + mkdir -p $out + cp -r bin lib $out + addAutoPatchelfSearchPath $out/lib + ''; - meta = { - description = "Perforce Helix Visual Client"; - homepage = "https://www.perforce.com"; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = lib.licenses.unfreeRedistributable; - platforms = [ "x86_64-linux" ]; - maintainers = with lib.maintainers; [ impl nathyong nioncode ]; + meta = { + description = "Perforce Helix Visual Client"; + homepage = "https://www.perforce.com"; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + license = lib.licenses.unfreeRedistributable; + platforms = [ "x86_64-linux" ]; + maintainers = with lib.maintainers; [ impl nathyong nioncode ]; + }; }; +in +stdenv.mkDerivation { + inherit pname version; + + # Build a "clean" version of the package so that we don't add extra ".bin" or + # configuration files to users' PATHs. We can't easily put the unwrapped + # package files in libexec (where they belong, probably) because the upstream + # wrapper scripts have the bin directory hardcoded. + buildCommand = '' + mkdir -p $out/bin + for f in p4admin p4merge p4v p4vc; do + ln -s ${unwrapped}/bin/$f $out/bin + done + ''; + preferLocalBuild = true; + + inherit (unwrapped) meta passthru; } -- cgit 1.4.1 From a289e7feb19e9047dc091063b16c125aa99c6fc3 Mon Sep 17 00:00:00 2001 From: Noah Fontes Date: Tue, 6 Sep 2022 16:05:35 -0700 Subject: p4v: add support for x86_64-darwin --- .../applications/version-management/p4v/darwin.nix | 24 +++++ .../version-management/p4v/default.nix | 119 +++++---------------- pkgs/applications/version-management/p4v/linux.nix | 89 +++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 139 insertions(+), 95 deletions(-) create mode 100644 pkgs/applications/version-management/p4v/darwin.nix create mode 100644 pkgs/applications/version-management/p4v/linux.nix (limited to 'pkgs/applications/version-management') diff --git a/pkgs/applications/version-management/p4v/darwin.nix b/pkgs/applications/version-management/p4v/darwin.nix new file mode 100644 index 0000000000000..d3d3568b9f2e2 --- /dev/null +++ b/pkgs/applications/version-management/p4v/darwin.nix @@ -0,0 +1,24 @@ +{ stdenv, undmg }: + +{ pname, version, src, meta }: +stdenv.mkDerivation { + inherit pname version src meta; + + nativeBuildInputs = [ undmg ]; + + sourceRoot = "."; + + installPhase = '' + mkdir -p $out/Applications $out/bin + + # Install Qt applications. + for f in p4admin.app p4merge.app p4v.app; do + mv $f $out/Applications + done + + # Install p4vc separately (it's a tiny shell script). + mv p4vc $out/bin + substituteInPlace $out/bin/p4vc \ + --replace /Applications $out/Applications + ''; +} diff --git a/pkgs/applications/version-management/p4v/default.nix b/pkgs/applications/version-management/p4v/default.nix index 6e4ff1f2c13e1..1004661499be2 100644 --- a/pkgs/applications/version-management/p4v/default.nix +++ b/pkgs/applications/version-management/p4v/default.nix @@ -1,107 +1,38 @@ { stdenv , fetchurl , lib -, autoPatchelfHook -, cups -, dbus -, fontconfig -, gccForLibs -, libX11 -, libXcomposite -, libXcursor -, libXdamage -, libXext -, libXi -, libXrandr -, libXrender -, libXtst -, libinput -, libxcb -, libxkbcommon -, nss -, qttools -, qtwebengine -, xcbutilimage -, xcbutilkeysyms -, xcbutilrenderutil -, xcbutilwm +, callPackage +, libsForQt5 }: let - pname = "p4v"; - version = "2022.2.2336701"; - - unwrapped = stdenv.mkDerivation { - pname = "${pname}-unwrapped"; - inherit version; - - src = fetchurl { - url = "https://web.archive.org/web/20220902181457/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; + # Upstream replaces minor versions, so use archived URLs. + srcs = { + "x86_64-linux" = fetchurl { + url = "https://web.archive.org/web/20220902181457id_/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; }; - - nativeBuildInputs = [ autoPatchelfHook ]; - buildInputs = [ - cups - dbus - fontconfig - gccForLibs - libX11 - libXcomposite - libXcursor - libXdamage - libXext - libXi - libXrandr - libXrender - libXtst - libinput - libxcb - libxkbcommon - nss - qttools - qtwebengine - xcbutilimage - xcbutilkeysyms - xcbutilrenderutil - xcbutilwm - ]; - - dontBuild = true; - - # Don't wrap the Qt apps; upstream has its own wrapper scripts. - dontWrapQtApps = true; - - installPhase = '' - mkdir -p $out - cp -r bin lib $out - addAutoPatchelfSearchPath $out/lib - ''; - - meta = { - description = "Perforce Helix Visual Client"; - homepage = "https://www.perforce.com"; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = lib.licenses.unfreeRedistributable; - platforms = [ "x86_64-linux" ]; - maintainers = with lib.maintainers; [ impl nathyong nioncode ]; + "x86_64-darwin" = fetchurl { + url = "https://web.archive.org/web/20220902194716id_/https://ftp.perforce.com/perforce/r22.2/bin.macosx1015x86_64/P4V.dmg"; + sha256 = "c4a9460c0f849be193c68496c500f8a785c740f5bea5b5e7f617969c20be3cd7"; }; }; -in -stdenv.mkDerivation { - inherit pname version; - # Build a "clean" version of the package so that we don't add extra ".bin" or - # configuration files to users' PATHs. We can't easily put the unwrapped - # package files in libexec (where they belong, probably) because the upstream - # wrapper scripts have the bin directory hardcoded. - buildCommand = '' - mkdir -p $out/bin - for f in p4admin p4merge p4v p4vc; do - ln -s ${unwrapped}/bin/$f $out/bin - done - ''; - preferLocalBuild = true; + mkDerivation = + if stdenv.isDarwin then callPackage ./darwin.nix { } + else libsForQt5.callPackage ./linux.nix { }; +in mkDerivation { + pname = "p4v"; + version = "2022.2.2336701"; + + src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - inherit (unwrapped) meta passthru; + meta = { + description = "Perforce Helix Visual Client"; + homepage = "https://www.perforce.com"; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + license = lib.licenses.unfreeRedistributable; + platforms = builtins.attrNames srcs; + maintainers = with lib.maintainers; [ impl nathyong nioncode ]; + }; } diff --git a/pkgs/applications/version-management/p4v/linux.nix b/pkgs/applications/version-management/p4v/linux.nix new file mode 100644 index 0000000000000..6a9d6ba6aad4b --- /dev/null +++ b/pkgs/applications/version-management/p4v/linux.nix @@ -0,0 +1,89 @@ +{ stdenv +, autoPatchelfHook +, cups +, dbus +, fontconfig +, gccForLibs +, libX11 +, libXcomposite +, libXcursor +, libXdamage +, libXext +, libXi +, libXrandr +, libXrender +, libXtst +, libinput +, libxcb +, libxkbcommon +, nss +, qttools +, qtwebengine +, xcbutilimage +, xcbutilkeysyms +, xcbutilrenderutil +, xcbutilwm +}: + +{ pname, version, src, meta }: +let + unwrapped = stdenv.mkDerivation { + pname = "${pname}-unwrapped"; + inherit version src meta; + + nativeBuildInputs = [ autoPatchelfHook ]; + buildInputs = [ + cups + dbus + fontconfig + gccForLibs + libX11 + libXcomposite + libXcursor + libXdamage + libXext + libXi + libXrandr + libXrender + libXtst + libinput + libxcb + libxkbcommon + nss + qttools + qtwebengine + xcbutilimage + xcbutilkeysyms + xcbutilrenderutil + xcbutilwm + ]; + + dontBuild = true; + + # Don't wrap the Qt apps; upstream has its own wrapper scripts. + dontWrapQtApps = true; + + installPhase = '' + mkdir -p $out + cp -r bin lib $out + addAutoPatchelfSearchPath $out/lib + ''; + }; +in +stdenv.mkDerivation { + inherit pname version; + + # Build a "clean" version of the package so that we don't add extra ".bin" or + # configuration files to users' PATHs. We can't easily put the unwrapped + # package files in libexec (where they belong, probably) because the upstream + # wrapper scripts have the bin directory hardcoded. + buildCommand = '' + mkdir -p $out/bin + for f in p4admin p4merge p4v p4vc; do + ln -s ${unwrapped}/bin/$f $out/bin + done + ''; + preferLocalBuild = true; + + inherit (unwrapped) meta passthru; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 33ca400bbb815..590bfa419ccb8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30207,7 +30207,7 @@ with pkgs; p4 = callPackage ../applications/version-management/p4 { }; p4d = callPackage ../applications/version-management/p4d { }; - p4v = libsForQt515.callPackage ../applications/version-management/p4v { }; + p4v = callPackage ../applications/version-management/p4v { }; partio = callPackage ../development/libraries/partio {}; -- cgit 1.4.1