Unverified Commit 9f2b4357 authored by Maximilian Bosch's avatar Maximilian Bosch
Browse files

postgresql: save rebuilds of existing packages

...by using `+ lib.optionalString ...` rather than a substitution. That
way the phases don't have additional trailing white-spaces in the
non-JIT case which cause rebuilds.
parent e2fb6517
Loading
Loading
Loading
Loading
+27 −31
Original line number Diff line number Diff line
@@ -114,13 +114,11 @@ let
    postPatch = ''
      # Hardcode the path to pgxs so pg_config returns the path in $out
      substituteInPlace "src/common/config_info.c" --replace HARDCODED_PGXS_PATH "$out/lib"

      ${lib.optionalString jitSupport ''
    '' + lib.optionalString jitSupport ''
        # Force lookup of jit stuff in $out instead of $lib
        substituteInPlace src/backend/jit/jit.c --replace pkglib_path \"$out/lib\"
        substituteInPlace src/backend/jit/llvm/llvmjit.c --replace pkglib_path \"$out/lib\"
        substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_path \"$out/lib\"
      ''}
    '';

    postInstall =
@@ -143,8 +141,7 @@ let
            fi
          done
        fi

        ${lib.optionalString jitSupport ''
      '' + lib.optionalString jitSupport ''
        # Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that
        # depends on libpq.so will also have libLLVM.so in its closure too, bloating it
        moveToOutput "lib/bitcode" "$out"
@@ -171,7 +168,6 @@ let
          # Restore the correct rpath
          patchelf $out/lib/llvmjit.so --set-rpath "$rpath"
        ''}
        ''}
      '';

    postFixup = lib.optionalString (!stdenv'.isDarwin && stdenv'.hostPlatform.libc == "glibc")