diff options
Diffstat (limited to 'pkgs/applications/version-management/p4v/default.nix')
-rw-r--r-- | pkgs/applications/version-management/p4v/default.nix | 92 |
1 files changed, 23 insertions, 69 deletions
diff --git a/pkgs/applications/version-management/p4v/default.nix b/pkgs/applications/version-management/p4v/default.nix index 9c804a7459b49..1004661499be2 100644 --- a/pkgs/applications/version-management/p4v/default.nix +++ b/pkgs/applications/version-management/p4v/default.nix @@ -1,84 +1,38 @@ { stdenv , fetchurl , lib -, qtbase -, qtwebengine -, qtdeclarative -, qtwebchannel -, syntax-highlighting -, openssl -, xkeyboard_config -, patchelfUnstable -, wrapQtAppsHook -, writeText +, callPackage +, libsForQt5 }: -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 <stddef.h> - 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 { - pname = "p4v"; - version = "2021.3.2186916"; - src = fetchurl { - url = "http://web.archive.org/web/20211118024745/https://cdist2.perforce.com/perforce/r21.3/bin.linux26x86_64/p4v.tgz"; - sha256 = "1zldg21xq4srww9pcfbv3p8320ghjnh333pz5r70z1gwbq4vf3jq"; +let + # 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"; + }; + "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"; + }; }; - dontBuild = true; - nativeBuildInputs = [ patchelfUnstable wrapQtAppsHook ]; - - ldLibraryPath = lib.makeLibraryPath [ - stdenv.cc.cc.lib - qtbase - qtwebengine - qtdeclarative - qtwebchannel - syntax-highlighting - openssl - ]; - - 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 - ''; + mkDerivation = + if stdenv.isDarwin then callPackage ./darwin.nix { } + else libsForQt5.callPackage ./linux.nix { }; +in mkDerivation { + pname = "p4v"; + version = "2022.2.2336701"; - dontFixup = true; + src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 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 ]; + platforms = builtins.attrNames srcs; + maintainers = with lib.maintainers; [ impl nathyong nioncode ]; }; } |