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 = ''
|
postPatch = ''
|
||||||
# Hardcode the path to pgxs so pg_config returns the path in $out
|
# 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"
|
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
|
# 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/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.c --replace pkglib_path \"$out/lib\"
|
||||||
substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_path \"$out/lib\"
|
substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_path \"$out/lib\"
|
||||||
''}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall =
|
postInstall =
|
||||||
|
@ -143,34 +141,32 @@ let
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
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 ''
|
# In the case of JIT support, prevent a retained dependency on clang-wrapper
|
||||||
# Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that
|
substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${self.llvmPackages.stdenv.cc}/bin/clang clang
|
||||||
# depends on libpq.so will also have libLLVM.so in its closure too, bloating it
|
nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f)
|
||||||
moveToOutput "lib/bitcode" "$out"
|
|
||||||
moveToOutput "lib/llvmjit*" "$out"
|
|
||||||
|
|
||||||
# In the case of JIT support, prevent a retained dependency on clang-wrapper
|
# Stop out depending on the default output of llvm
|
||||||
substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${self.llvmPackages.stdenv.cc}/bin/clang clang
|
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
||||||
nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f)
|
--replace ${self.llvmPackages.llvm.out}/bin "" \
|
||||||
|
--replace '$(LLVM_BINPATH)/' ""
|
||||||
|
|
||||||
# Stop out depending on the default output of llvm
|
# Stop out depending on the -dev output of llvm
|
||||||
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
||||||
--replace ${self.llvmPackages.llvm.out}/bin "" \
|
--replace ${self.llvmPackages.llvm.dev}/bin/llvm-config llvm-config \
|
||||||
--replace '$(LLVM_BINPATH)/' ""
|
--replace -I${self.llvmPackages.llvm.dev}/include ""
|
||||||
|
|
||||||
# Stop out depending on the -dev output of llvm
|
${lib.optionalString (!stdenv'.isDarwin) ''
|
||||||
substituteInPlace $out/lib/pgxs/src/Makefile.global \
|
# Stop lib depending on the -dev output of llvm
|
||||||
--replace ${self.llvmPackages.llvm.dev}/bin/llvm-config llvm-config \
|
rpath=$(patchelf --print-rpath $out/lib/llvmjit.so)
|
||||||
--replace -I${self.llvmPackages.llvm.dev}/include ""
|
nuke-refs -e $out $out/lib/llvmjit.so
|
||||||
|
# Restore the correct rpath
|
||||||
${lib.optionalString (!stdenv'.isDarwin) ''
|
patchelf $out/lib/llvmjit.so --set-rpath "$rpath"
|
||||||
# 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