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.
This commit is contained in:
parent
e2fb651752
commit
9f2b4357c1
|
@ -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,34 +141,32 @@ let
|
|||
fi
|
||||
done
|
||||
fi
|
||||
'' + 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"
|
||||
moveToOutput "lib/llvmjit*" "$out"
|
||||
|
||||
${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"
|
||||
moveToOutput "lib/llvmjit*" "$out"
|
||||
# In the case of JIT support, prevent a retained dependency on clang-wrapper
|
||||
substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${self.llvmPackages.stdenv.cc}/bin/clang clang
|
||||
nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f)
|
||||
|
||||
# In the case of JIT support, prevent a retained dependency on clang-wrapper
|
||||
substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${self.llvmPackages.stdenv.cc}/bin/clang clang
|
||||
nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f)
|
||||
# Stop out depending on the default output of llvm
|
||||
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
||||
--replace ${self.llvmPackages.llvm.out}/bin "" \
|
||||
--replace '$(LLVM_BINPATH)/' ""
|
||||
|
||||
# Stop out depending on the default output of llvm
|
||||
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
||||
--replace ${self.llvmPackages.llvm.out}/bin "" \
|
||||
--replace '$(LLVM_BINPATH)/' ""
|
||||
# Stop out depending on the -dev output of llvm
|
||||
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
||||
--replace ${self.llvmPackages.llvm.dev}/bin/llvm-config llvm-config \
|
||||
--replace -I${self.llvmPackages.llvm.dev}/include ""
|
||||
|
||||
# Stop out depending on the -dev output of llvm
|
||||
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
||||
--replace ${self.llvmPackages.llvm.dev}/bin/llvm-config llvm-config \
|
||||
--replace -I${self.llvmPackages.llvm.dev}/include ""
|
||||
|
||||
${lib.optionalString (!stdenv'.isDarwin) ''
|
||||
# Stop lib depending on the -dev output of llvm
|
||||
rpath=$(patchelf --print-rpath $out/lib/llvmjit.so)
|
||||
nuke-refs -e $out $out/lib/llvmjit.so
|
||||
# Restore the correct rpath
|
||||
patchelf $out/lib/llvmjit.so --set-rpath "$rpath"
|
||||
''}
|
||||
${lib.optionalString (!stdenv'.isDarwin) ''
|
||||
# Stop lib depending on the -dev output of llvm
|
||||
rpath=$(patchelf --print-rpath $out/lib/llvmjit.so)
|
||||
nuke-refs -e $out $out/lib/llvmjit.so
|
||||
# Restore the correct rpath
|
||||
patchelf $out/lib/llvmjit.so --set-rpath "$rpath"
|
||||
''}
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue