diff options
author | Noah Fontes <noah@noahfontes.com> | 2022-09-06 16:05:35 -0700 |
---|---|---|
committer | Noah Fontes <noah@noahfontes.com> | 2022-10-07 23:26:49 -0700 |
commit | a289e7feb19e9047dc091063b16c125aa99c6fc3 (patch) | |
tree | 53936c0c953bdc2ce8c77b39fd7151924b21a58e /pkgs/applications/version-management | |
parent | 0defcde4c01baa6c4eda01aad9efbb4d7faab896 (diff) |
p4v: add support for x86_64-darwin
Diffstat (limited to 'pkgs/applications/version-management')
-rw-r--r-- | pkgs/applications/version-management/p4v/darwin.nix | 24 | ||||
-rw-r--r-- | pkgs/applications/version-management/p4v/default.nix | 119 | ||||
-rw-r--r-- | pkgs/applications/version-management/p4v/linux.nix | 89 |
3 files changed, 138 insertions, 94 deletions
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; +} |