Unverified Commit f5136486 authored by Stefan Frijters's avatar Stefan Frijters
Browse files

p4: move env variables into env, fix optional string

parent 3c78204c
Loading
Loading
Loading
Loading
+25 −21
Original line number Diff line number Diff line
@@ -39,10 +39,10 @@ stdenv.mkDerivation (finalAttrs: {
  src = fetchurl {
    # Upstream replaces minor versions, so use archived URL.
    url = "https://web.archive.org/web/20240526153453id_/https://ftp.perforce.com/perforce/r24.1/bin.tools/p4source.tgz";
    sha256 = "sha256-6+DOJPeVzP4x0UsN9MlZRAyusapBTICX0BuyvVBQBC8=";
    hash = "sha256-6+DOJPeVzP4x0UsN9MlZRAyusapBTICX0BuyvVBQBC8=";
  };

  postPatch = lib.optionals stdenv.hostPlatform.isDarwin ''
  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    # same error as https://github.com/pocoproject/poco/issues/4586
    substituteInPlace zlib/zutil.h \
      --replace-fail '#if defined(MACOS) || defined(TARGET_OS_MAC)' '#if defined(MACOS)'
@@ -79,12 +79,14 @@ stdenv.mkDerivation (finalAttrs: {
    "-sLIBC++DIR=${lib.getLib stdenv.cc.libcxx}/lib"
  ];

  CCFLAGS =
  env = {
    CCFLAGS = toString (
      # 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}" ];
      lib.optionals stdenv.hostPlatform.isAarch64 [ "-I${androidZlibContrib}" ]
    );

  "C++FLAGS" =
    "C++FLAGS" = toString (
      # 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
@@ -98,7 +100,9 @@ stdenv.mkDerivation (finalAttrs: {
            "limits"
            "-include"
            "thread"
        ];
          ]
    );
  };

  preBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
    export MACOSX_SDK=$SDKROOT