2022-09-07 06:50:31 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, fetchzip
|
|
|
|
, lib
|
|
|
|
, emptyDirectory
|
|
|
|
, linkFarm
|
|
|
|
, jam
|
|
|
|
, openssl
|
|
|
|
, CoreServices
|
|
|
|
, Foundation
|
|
|
|
, Security
|
2024-06-12 18:59:49 +00:00
|
|
|
, testers
|
2022-09-07 06:50:31 +00:00
|
|
|
}:
|
2020-08-21 16:37:10 +00:00
|
|
|
|
2022-09-07 06:50:31 +00:00
|
|
|
let
|
|
|
|
opensslStatic = openssl.override {
|
|
|
|
static = true;
|
|
|
|
};
|
|
|
|
androidZlibContrib =
|
|
|
|
let
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://android.googlesource.com/platform/external/zlib/+archive/61174f4fd262c6075f88768465f308aae95a2f04.tar.gz";
|
|
|
|
sha256 = "sha256-EMzKAHcEWOUugcHKH2Fj3ZaIHC9UlgO4ULKe3RvgxvI=";
|
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
linkFarm "android-zlib-contrib" [
|
|
|
|
# We only want to keep the contrib directory as the other files conflict
|
|
|
|
# with p4's own zlib files. (For the same reason, we can't use the
|
|
|
|
# cone-based Git sparse checkout, either.)
|
|
|
|
{ name = "contrib"; path = "${src}/contrib"; }
|
|
|
|
];
|
|
|
|
in
|
2024-06-12 18:59:49 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: rec {
|
2020-08-21 16:37:10 +00:00
|
|
|
pname = "p4";
|
2024-06-12 18:59:49 +00:00
|
|
|
version = "2024.1/2596294";
|
2020-08-21 16:37:10 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-09-07 06:50:31 +00:00
|
|
|
# Upstream replaces minor versions, so use archived URL.
|
2024-06-12 18:59:49 +00:00
|
|
|
url = "https://web.archive.org/web/20240526153453id_/https://ftp.perforce.com/perforce/r24.1/bin.tools/p4source.tgz";
|
|
|
|
sha256 = "sha256-6+DOJPeVzP4x0UsN9MlZRAyusapBTICX0BuyvVBQBC8=";
|
2020-08-21 16:37:10 +00:00
|
|
|
};
|
|
|
|
|
2022-09-07 06:50:31 +00:00
|
|
|
nativeBuildInputs = [ jam ];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices Foundation Security ];
|
|
|
|
|
|
|
|
outputs = [ "out" "bin" "dev" ];
|
2020-08-21 16:37:10 +00:00
|
|
|
|
2022-09-07 06:50:31 +00:00
|
|
|
hardeningDisable = lib.optionals stdenv.hostPlatform.isDarwin [ "strictoverflow" ];
|
2020-08-21 16:37:10 +00:00
|
|
|
|
2022-09-07 06:50:31 +00:00
|
|
|
jamFlags =
|
|
|
|
[
|
|
|
|
"-sEXEC=bin.unix"
|
|
|
|
"-sCROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
|
|
"-sMALLOC_OVERRIDE=no"
|
|
|
|
"-sSSLINCDIR=${lib.getDev opensslStatic}/include"
|
|
|
|
"-sSSLLIBDIR=${lib.getLib opensslStatic}/lib"
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.cc.isClang [ "-sOSCOMP=clang" "-sCLANGVER=${stdenv.cc.cc.version}" ]
|
|
|
|
++ lib.optionals stdenv.cc.isGNU [ "-sOSCOMP=gcc" "-sGCCVER=${stdenv.cc.cc.version}" ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ "-sOSVER=26" ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
"-sOSVER=1013"
|
llvmPackages_{12,13,14,15,16,17,git}.{libcxx,libcxxabi}: merge libcxxabi into libcxx (#292043)
- merge libcxxabi into libcxx for LLVM 12, 13, 14, 15, 16, 17, and git.
- remove the link time workaround `-lc++ -lc++abi` from 58 packages as it is no longer required.
- fixes https://github.com/NixOS/nixpkgs/issues/166205
- provides alternative fixes for. https://github.com/NixOS/nixpkgs/issues/269548 https://github.com/NixOS/nix/issues/9640
- pkgsCross.x86_64-freebsd builds work again
This change can be represented in 3 stages
1. merge libcxxabi into libcxx -- files: pkgs/development/compilers/llvm/[12, git]/{libcxx, libcxxabi}
2. update stdenv to account for merge -- files: stdenv.{adapters, cc.wrapper, darwin}
3. remove all references to libcxxabi outside of llvm (about 58 packages modified)
### merging libcxxabi into libcxx
- take the union of the libcxxabi and libcxx cmake flags
- eliminate the libcxx-headers-only package - it was only needed to break libcxx <-> libcxxabi circular dependency
- libcxx.cxxabi is removed. external cxxabi (freebsd) will symlink headers / libs into libcxx.
- darwin will re-export the libcxxabi symbols into libcxx so linking `-lc++` is sufficient.
- linux/freebsd `libc++.so` is a linker script `LINK(libc++.so.1, -lc++abi)` making `-lc++` sufficient.
- libcxx/default.nix [12, 17] are identical except for patches and `LIBCXX_ADDITIONAL_LIBRARIES` (only used in 16+)
- git/libcxx/defaul.nix does not link with -nostdlib when useLLVM is true so flag is removed. this is not much different than before as libcxxabi used -nostdlib where libcxx did not, so libc was linked in anyway.
### stdenv changes
- darwin bootstrap, remove references to libcxxabi and cxxabi
- cc-wrapper: remove c++ link workaround when libcxx.cxxabi doesn't exist (still exists for LLVM pre 12)
- adapter: update overrideLibcxx to account for a pkgs.stdenv that only has libcxx
### 58 package updates
- remove `NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}` as no longer needed
- swift, nodejs_v8 remove libcxxabi references in the clang override
https://github.com/NixOS/nixpkgs/pull/292043
2024-03-11 10:53:37 +00:00
|
|
|
"-sLIBC++DIR=${lib.getLib stdenv.cc.libcxx}/lib"
|
2022-09-07 06:50:31 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
CCFLAGS =
|
|
|
|
# The file contrib/optimizations/slide_hash_neon.h is missing from the
|
|
|
|
# upstream distribution. It comes from the Android/Chromium sources.
|
|
|
|
lib.optionals stdenv.hostPlatform.isAarch64 [ "-I${androidZlibContrib}" ];
|
|
|
|
|
|
|
|
"C++FLAGS" =
|
|
|
|
# Avoid a compilation error that only occurs for 4-byte longs.
|
|
|
|
lib.optionals stdenv.hostPlatform.isi686 [ "-Wno-narrowing" ]
|
|
|
|
# See the "Header dependency changes" section of
|
|
|
|
# https://www.gnu.org/software/gcc/gcc-11/porting_to.html for more
|
|
|
|
# information on why we need to include these.
|
|
|
|
++ lib.optionals
|
|
|
|
(stdenv.cc.isClang || (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.cc.version "11.0.0"))
|
|
|
|
[ "-include" "limits" "-include" "thread" ];
|
|
|
|
|
2024-11-19 20:29:49 +00:00
|
|
|
preBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
export MACOSX_SDK=$SDKROOT
|
|
|
|
'';
|
|
|
|
|
2022-09-07 06:50:31 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
jam $jamFlags -j$NIX_BUILD_CORES p4
|
|
|
|
jam $jamFlags -j$NIX_BUILD_CORES -sPRODUCTION=yes p4api.tar
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
2020-08-21 16:37:10 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2022-09-07 06:50:31 +00:00
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $bin/bin $dev $out
|
|
|
|
cp bin.unix/p4 $bin/bin
|
2024-06-12 18:59:49 +00:00
|
|
|
cp -r bin.unix/p4api-*/include $dev
|
|
|
|
cp -r bin.unix/p4api-*/lib $out
|
2022-09-07 06:50:31 +00:00
|
|
|
runHook postInstall
|
2020-08-21 16:37:10 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-12 18:59:49 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
command = "p4 -V";
|
|
|
|
};
|
|
|
|
|
2022-09-07 06:50:31 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Perforce Helix Core command-line client and APIs";
|
2020-08-21 16:37:10 +00:00
|
|
|
homepage = "https://www.perforce.com";
|
2022-09-07 06:50:31 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
mainProgram = "p4";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ corngood impl ];
|
2020-08-21 16:37:10 +00:00
|
|
|
};
|
2024-06-12 18:59:49 +00:00
|
|
|
})
|