nixpkgs/pkgs/applications/version-management/p4v/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
2.5 KiB
Nix
Raw Normal View History

2021-06-09 01:28:01 +00:00
{ stdenv
, fetchurl
, lib
, qtbase
, qtwebengine
, qtdeclarative
, qtwebchannel
, syntax-highlighting
, openssl
, xkeyboard_config
, patchelfUnstable
, wrapQtAppsHook
, writeText
}:
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; }
'';
2018-03-12 08:12:45 +00:00
2021-06-09 01:28:01 +00:00
in stdenv.mkDerivation rec {
pname = "p4v";
2021-06-09 01:28:01 +00:00
version = "2021.3.2186916";
2018-03-12 08:12:45 +00:00
src = fetchurl {
2021-06-09 01:28:01 +00:00
url = "http://web.archive.org/web/20211118024745/https://cdist2.perforce.com/perforce/r21.3/bin.linux26x86_64/p4v.tgz";
sha256 = "1zldg21xq4srww9pcfbv3p8320ghjnh333pz5r70z1gwbq4vf3jq";
2018-03-12 08:12:45 +00:00
};
dontBuild = true;
2020-08-10 18:48:09 +00:00
nativeBuildInputs = [ patchelfUnstable wrapQtAppsHook ];
2018-03-12 08:12:45 +00:00
ldLibraryPath = lib.makeLibraryPath [
stdenv.cc.cc.lib
qtbase
2020-08-10 18:48:09 +00:00
qtwebengine
2021-06-09 01:28:01 +00:00
qtdeclarative
qtwebchannel
syntax-highlighting
2020-08-10 18:48:09 +00:00
openssl
2018-03-12 08:12:45 +00:00
];
dontWrapQtApps = true;
2018-03-12 08:12:45 +00:00
installPhase = ''
mkdir $out
cp -r bin $out
2020-08-10 18:48:09 +00:00
mkdir -p $out/lib
cp -r lib/P4VResources $out/lib
2021-06-09 01:28:01 +00:00
$CC -fPIC -shared -o $out/lib/libcrypto-hack.so ${crypto-hack}
2018-03-12 08:12:45 +00:00
for f in $out/bin/*.bin ; do
2020-08-10 18:48:09 +00:00
patchelf --set-rpath $ldLibraryPath --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f
# combining this with above breaks rpath (patchelf bug?)
2021-06-09 01:28:01 +00:00
patchelf --add-needed libstdc++.so \
--add-needed $out/lib/libcrypto-hack.so \
2020-08-10 18:48:09 +00:00
--clear-symbol-version _ZNSt20bad_array_new_lengthD1Ev \
--clear-symbol-version _ZTVSt20bad_array_new_length \
--clear-symbol-version _ZTISt20bad_array_new_length \
2021-06-09 01:28:01 +00:00
--clear-symbol-version _ZdlPvm \
2020-08-10 18:48:09 +00:00
$f
wrapQtApp $f \
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb
2018-03-12 08:12:45 +00:00
done
'';
2020-08-10 18:48:09 +00:00
dontFixup = true;
2018-03-12 08:12:45 +00:00
meta = {
description = "Perforce Visual Client";
homepage = "https://www.perforce.com";
2021-01-15 13:21:58 +00:00
license = lib.licenses.unfreeRedistributable;
2018-03-12 08:12:45 +00:00
platforms = [ "x86_64-linux" ];
2021-01-15 13:21:58 +00:00
maintainers = with lib.maintainers; [ nathyong nioncode ];
2018-03-12 08:12:45 +00:00
};
}