diff --git a/docker/packager/binary/build.sh b/docker/packager/binary/build.sh index 70139a04852..0c88cbe57aa 100755 --- a/docker/packager/binary/build.sh +++ b/docker/packager/binary/build.sh @@ -35,22 +35,24 @@ ninja $NINJA_FLAGS clickhouse-bundle ccache --show-config ||: ccache --show-stats ||: -# Also build fuzzers if any -FUZZER_TARGETS=$(find ../src -name '*_fuzzer.cpp' -execdir basename {} .cpp ';' | tr '\n' ' ') + # Also build fuzzers if any +if [[ "${CMAKE_FLAGS[@]}" == "*ENABLE_FUZZING*" ]]; then + FUZZER_TARGETS=$(find ../src -name '*_fuzzer.cpp' -execdir basename {} .cpp ';' | tr '\n' ' ') -mkdir -p /output/fuzzers -for FUZZER_TARGET in $FUZZER_TARGETS -do - # shellcheck disable=SC2086 # No quotes because I want it to expand to nothing if empty. - ninja $NINJA_FLAGS $FUZZER_TARGET - # Find this binary in build directory and strip it - FUZZER_PATH=$(find ./src -name "$FUZZER_TARGET") - strip --strip-unneeded "$FUZZER_PATH" - mv "$FUZZER_PATH" /output/fuzzers -done + mkdir -p /output/fuzzers + for FUZZER_TARGET in $FUZZER_TARGETS + do + # shellcheck disable=SC2086 # No quotes because I want it to expand to nothing if empty. + ninja $NINJA_FLAGS $FUZZER_TARGET + # Find this binary in build directory and strip it + FUZZER_PATH=$(find ./src -name "$FUZZER_TARGET") + strip --strip-unneeded "$FUZZER_PATH" + mv "$FUZZER_PATH" /output/fuzzers + done -tar -zcvf /output/fuzzers.tar.gz /output/fuzzers -rm -rf /output/fuzzers + tar -zcvf /output/fuzzers.tar.gz /output/fuzzers + rm -rf /output/fuzzers +fi mv ./programs/clickhouse* /output mv ./src/unit_tests_dbms /output ||: # may not exist for some binary builds diff --git a/docker/packager/deb/build.sh b/docker/packager/deb/build.sh index 7bcd79a919f..d343287eee9 100755 --- a/docker/packager/deb/build.sh +++ b/docker/packager/deb/build.sh @@ -24,18 +24,24 @@ then mkdir /output/binary ||: # if exists mv /build/obj-*/programs/clickhouse* /output/binary - # Copy all fuzzers + # Copy all fuzzers if any FUZZER_TARGETS=$(find /build/obj-*/src -name '*_fuzzer' -execdir basename {} ';' | tr '\n' ' ') - mkdir -p /output/fuzzers ||: # if exists - for FUZZER_TARGET in $FUZZER_TARGETS - do - FUZZER_PATH=$(find /build/obj-*/src -name "$FUZZER_TARGET") - strip --strip-unneeded "$FUZZER_PATH" - mv "$FUZZER_PATH" /output/fuzzers ||: # if exists - done - tar -zcvf /output/fuzzers.tar.gz /output/fuzzers - rm -rf /output/fuzzers + if [[ $FUZZER_TARGETS != "" ]]; then + + mkdir -p /output/fuzzers ||: # if exists + for FUZZER_TARGET in $FUZZER_TARGETS + do + FUZZER_PATH=$(find /build/obj-*/src -name "$FUZZER_TARGET") + strip --strip-unneeded "$FUZZER_PATH" + mv "$FUZZER_PATH" /output/fuzzers ||: # if exists + done + + + tar -zcvf /output/fuzzers.tar.gz /output/fuzzers + rm -rf /output/fuzzers + + fi if [ "$BINARY_OUTPUT" = "tests" ] then