clickhouse: Pull request fixes for substituteInPlace and cross-compilation
This commit is contained in:
@@ -63,63 +63,60 @@ llvmPackages_19.stdenv.mkDerivation (finalAttrs: {
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
nativeBuildInputs =
|
||||
[
|
||||
cmake
|
||||
ninja
|
||||
python3
|
||||
perl
|
||||
llvmPackages_19.lld
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isx86_64 [
|
||||
nasm
|
||||
yasm
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
llvmPackages_19.bintools
|
||||
findutils
|
||||
darwin.bootstrap_cmds
|
||||
]
|
||||
++ lib.optionals rustSupport [
|
||||
rustc
|
||||
cargo
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
python3
|
||||
perl
|
||||
llvmPackages_19.lld
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isx86_64 [
|
||||
nasm
|
||||
yasm
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
llvmPackages_19.bintools
|
||||
findutils
|
||||
darwin.bootstrap_cmds
|
||||
]
|
||||
++ lib.optionals rustSupport [
|
||||
rustc
|
||||
cargo
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
|
||||
|
||||
dontCargoSetupPostUnpack = true;
|
||||
|
||||
postPatch =
|
||||
''
|
||||
patchShebangs src/
|
||||
patchShebangs utils/
|
||||
postPatch = ''
|
||||
patchShebangs src/ utils/
|
||||
|
||||
sed -i 's|/usr/bin/env perl|"${lib.getExe perl}"|' contrib/openssl-cmake/CMakeLists.txt
|
||||
sed -i 's|/usr/bin/env perl|"${lib.getExe perl}"|' contrib/openssl-cmake/CMakeLists.txt
|
||||
|
||||
substituteInPlace src/Storages/System/StorageSystemLicenses.sh utils/list-licenses/list-licenses.sh \
|
||||
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace cmake/tools.cmake \
|
||||
--replace-fail 'gfind' 'find' \
|
||||
--replace-fail 'ggrep' 'grep' \
|
||||
--replace-fail '--ld-path=''${LLD_PATH}' '-fuse-ld=lld'
|
||||
''
|
||||
+ lib.optionalString rustSupport ''
|
||||
cargoSetupPostPatchHook() { true; }
|
||||
'';
|
||||
substituteInPlace src/Storages/System/StorageSystemLicenses.sh utils/list-licenses/list-licenses.sh \
|
||||
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace cmake/tools.cmake \
|
||||
--replace-fail 'gfind' 'find' \
|
||||
--replace-fail 'ggrep' 'grep' \
|
||||
--replace-fail '--ld-path=''${LLD_PATH}' '-fuse-ld=lld'
|
||||
''
|
||||
# Rust is handled by cmake
|
||||
+ lib.optionalString rustSupport ''
|
||||
cargoSetupPostPatchHook() { true; }
|
||||
'';
|
||||
|
||||
cmakeFlags =
|
||||
[
|
||||
"-DENABLE_CHDIG=OFF"
|
||||
"-DENABLE_TESTS=OFF"
|
||||
"-DENABLE_DELTA_KERNEL_RS=0"
|
||||
"-DCOMPILER_CACHE=disabled"
|
||||
]
|
||||
++ lib.optional (
|
||||
stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64
|
||||
) "-DNO_ARMV81_OR_HIGHER=1";
|
||||
cmakeFlags = [
|
||||
"-DENABLE_CHDIG=OFF"
|
||||
"-DENABLE_TESTS=OFF"
|
||||
"-DENABLE_DELTA_KERNEL_RS=0"
|
||||
"-DCOMPILER_CACHE=disabled"
|
||||
]
|
||||
++ lib.optional (
|
||||
stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64
|
||||
) "-DNO_ARMV81_OR_HIGHER=1";
|
||||
|
||||
env = {
|
||||
CARGO_HOME = "$PWD/../.cargo/";
|
||||
@@ -137,19 +134,16 @@ llvmPackages_19.stdenv.mkDerivation (finalAttrs: {
|
||||
hardeningDisable = [ "fortify" ];
|
||||
|
||||
postInstall = ''
|
||||
rm -rf $out/share/clickhouse-test
|
||||
|
||||
sed -i -e '\!<log>/var/log/clickhouse-server/clickhouse-server\.log</log>!d' \
|
||||
$out/etc/clickhouse-server/config.xml
|
||||
substituteInPlace $out/etc/clickhouse-server/config.xml \
|
||||
--replace-fail "<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>" "<console>1</console>"
|
||||
substituteInPlace $out/etc/clickhouse-server/config.xml \
|
||||
--replace-fail "<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>" "<console>1</console>" \
|
||||
--replace-fail "<level>trace</level>" "<level>warning</level>"
|
||||
'';
|
||||
|
||||
# Basic smoke test
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
checkPhase = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
$NIX_BUILD_TOP/$sourceRoot/build/programs/clickhouse local --query 'SELECT 1' | grep 1
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user