From 9e4ab9c2b4151f09487c06f8c406ee4215fce81a Mon Sep 17 00:00:00 2001 From: yibin Date: Mon, 11 Jul 2022 10:25:31 +0800 Subject: [PATCH 1/4] Add debug image building script for centos7 and darwin Signed-off-by: yibin --- release-centos7-llvm/scripts/build-debug.sh | 23 +++++++++ .../scripts/build-tiflash-release.sh | 6 ++- release-darwin/build/build-debug.sh | 20 ++++++++ release-darwin/build/build-release.sh | 24 +-------- release-darwin/build/build-tiflash-release.sh | 51 +++++++++++++++++++ 5 files changed, 100 insertions(+), 24 deletions(-) create mode 100755 release-centos7-llvm/scripts/build-debug.sh create mode 100755 release-darwin/build/build-debug.sh create mode 100755 release-darwin/build/build-tiflash-release.sh diff --git a/release-centos7-llvm/scripts/build-debug.sh b/release-centos7-llvm/scripts/build-debug.sh new file mode 100755 index 00000000000..59dc9b86a54 --- /dev/null +++ b/release-centos7-llvm/scripts/build-debug.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright 2022 PingCAP, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +CMAKE_PREFIX_PATH=$1 + +set -ueox pipefail + +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" + +${SCRIPTPATH}/build-tiflash-release.sh "DEBUG" "${CMAKE_PREFIX_PATH}" diff --git a/release-centos7-llvm/scripts/build-tiflash-release.sh b/release-centos7-llvm/scripts/build-tiflash-release.sh index 42993b51afe..c6c7dd7f25f 100755 --- a/release-centos7-llvm/scripts/build-tiflash-release.sh +++ b/release-centos7-llvm/scripts/build-tiflash-release.sh @@ -47,7 +47,11 @@ ENABLE_PCH=${ENABLE_PCH:-ON} INSTALL_DIR="${SRCPATH}/release-centos7-llvm/tiflash" rm -rf ${INSTALL_DIR} && mkdir -p ${INSTALL_DIR} -BUILD_DIR="${SRCPATH}/release-centos7-llvm/build-release" +if [ $CMAKE_BUILD_TYPE == "RELWITHDEBINFO" ]; then + BUILD_DIR="$SRCPATH/release-centos7-llvm/build-release" +else + BUILD_DIR="$SRCPATH/release-centos7-llvm/build-debug" +fi rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} cmake -S "${SRCPATH}" \ diff --git a/release-darwin/build/build-debug.sh b/release-darwin/build/build-debug.sh new file mode 100755 index 00000000000..614859d0ece --- /dev/null +++ b/release-darwin/build/build-debug.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2022 PingCAP, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ueox pipefail + +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" + +${SCRIPTPATH}/build-tiflash-release.sh "DEBUG" diff --git a/release-darwin/build/build-release.sh b/release-darwin/build/build-release.sh index 4c8d12853e4..56331e38f7b 100755 --- a/release-darwin/build/build-release.sh +++ b/release-darwin/build/build-release.sh @@ -16,27 +16,5 @@ set -ueox pipefail SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -SRCPATH=${1:-$(cd $SCRIPTPATH/../..; pwd -P)} -PATH=$PATH:/root/.cargo/bin -NPROC=${NPROC:-$(sysctl -n hw.physicalcpu || grep -c ^processor /proc/cpuinfo)} -CMAKE_BUILD_TYPE="RELWITHDEBINFO" -install_dir="$SRCPATH/release-darwin/tiflash" -if [ -d "$install_dir" ]; then rm -rf "${install_dir:?}"/*; else mkdir -p "$install_dir"; fi -build_dir="$SRCPATH/release-darwin/build-release" -rm -rf $build_dir && mkdir -p $build_dir && cd $build_dir - -cmake "$SRCPATH" \ - -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ - -Wno-dev \ - -DNO_WERROR=ON - -cmake --build . --target tiflash --parallel $NPROC -cmake --install . --component=tiflash-release --prefix="$install_dir" - -FILE="$install_dir/tiflash" -otool -L "$FILE" - -set +e -echo "show ccache stats" -ccache -s +${SCRIPTPATH}/build-tiflash-release.sh "" diff --git a/release-darwin/build/build-tiflash-release.sh b/release-darwin/build/build-tiflash-release.sh new file mode 100755 index 00000000000..5fa7257958f --- /dev/null +++ b/release-darwin/build/build-tiflash-release.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Copyright 2022 PingCAP, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ueox pipefail + +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +SRCPATH=${1:-$(cd $SCRIPTPATH/../..; pwd -P)} +PATH=$PATH:/root/.cargo/bin +NPROC=${NPROC:-$(sysctl -n hw.physicalcpu || grep -c ^processor /proc/cpuinfo)} + +CMAKE_BUILD_TYPE=$1 +if [[ -z ${CMAKE_BUILD_TYPE} ]]; then + CMAKE_BUILD_TYPE="RELWITHDEBINFO" +fi + +install_dir="$SRCPATH/release-darwin/tiflash" +if [ -d "$install_dir" ]; then rm -rf "${install_dir:?}"/*; else mkdir -p "$install_dir"; fi + +if [ $CMAKE_BUILD_TYPE == "RELWITHDEBINFO" ]; then + build_dir="$SRCPATH/release-darwin/build-release" +else + build_dir="$SRCPATH/release-darwin/build-debug" +fi +rm -rf $build_dir && mkdir -p $build_dir && cd $build_dir + +cmake "$SRCPATH" \ + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ + -Wno-dev \ + -DNO_WERROR=ON + +cmake --build . --target tiflash --parallel $NPROC +cmake --install . --component=tiflash-release --prefix="$install_dir" + +FILE="$install_dir/tiflash" +otool -L "$FILE" + +set +e +echo "show ccache stats" +ccache -s From dd118696695826d97c54a74b7d6ae13dd4e9e7a4 Mon Sep 17 00:00:00 2001 From: yibin Date: Mon, 11 Jul 2022 14:41:56 +0800 Subject: [PATCH 2/4] Add build target Signed-off-by: yibin --- release-centos7-llvm/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/release-centos7-llvm/Makefile b/release-centos7-llvm/Makefile index 1b15df7ddc3..7ac3fabf969 100644 --- a/release-centos7-llvm/Makefile +++ b/release-centos7-llvm/Makefile @@ -23,6 +23,10 @@ image_tiflash_llvm_base_aarch64: build_tiflash_release_amd64: docker run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-release.sh +# Just add build_tiflash_debug_amd64 target to support FailPoint tests on x86, and outputs are the same as release version +build_tiflash_debug_amd64: + docker run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-debug.sh + build_tiflash_ci_amd64: docker run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-tiflash-ci.sh From 36c1a77bc5f2984c9c82da719b429df8b0b4004e Mon Sep 17 00:00:00 2001 From: yibin Date: Mon, 11 Jul 2022 15:51:41 +0800 Subject: [PATCH 3/4] Add centos7 debug image build target Signed-off-by: yibin --- release-centos7-llvm/Makefile | 2 +- release-centos7-llvm/scripts/build-tiflash-release.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/release-centos7-llvm/Makefile b/release-centos7-llvm/Makefile index 7ac3fabf969..9c1bba42a53 100644 --- a/release-centos7-llvm/Makefile +++ b/release-centos7-llvm/Makefile @@ -23,7 +23,7 @@ image_tiflash_llvm_base_aarch64: build_tiflash_release_amd64: docker run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-release.sh -# Just add build_tiflash_debug_amd64 target to support FailPoint tests on x86, and outputs are the same as release version +# Add build_tiflash_debug_amd64 target to enable FailPoints on x86. Since outputs are the same as release version, no new package targets added. build_tiflash_debug_amd64: docker run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-debug.sh diff --git a/release-centos7-llvm/scripts/build-tiflash-release.sh b/release-centos7-llvm/scripts/build-tiflash-release.sh index c6c7dd7f25f..01ca00e8706 100755 --- a/release-centos7-llvm/scripts/build-tiflash-release.sh +++ b/release-centos7-llvm/scripts/build-tiflash-release.sh @@ -49,8 +49,10 @@ rm -rf ${INSTALL_DIR} && mkdir -p ${INSTALL_DIR} if [ $CMAKE_BUILD_TYPE == "RELWITHDEBINFO" ]; then BUILD_DIR="$SRCPATH/release-centos7-llvm/build-release" + ENABLE_FAILPOINTS="OFF" else BUILD_DIR="$SRCPATH/release-centos7-llvm/build-debug" + ENABLE_FAILPOINTS="ON" fi rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} @@ -59,6 +61,7 @@ cmake -S "${SRCPATH}" \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -DENABLE_TESTING=OFF \ -DENABLE_TESTS=OFF \ + -DENABLE_FAILPOINTS=${ENABLE_FAILPOINTS} \ -Wno-dev \ -DUSE_CCACHE=OFF \ -DRUN_HAVE_STD_REGEX=0 \ From 91b135a66ca5619f8a279880ca1b9083814d78ab Mon Sep 17 00:00:00 2001 From: yibin Date: Mon, 11 Jul 2022 16:54:02 +0800 Subject: [PATCH 4/4] Revert darwin build scripts Signed-off-by: yibin --- release-darwin/build/build-debug.sh | 20 -------- release-darwin/build/build-release.sh | 24 ++++++++- release-darwin/build/build-tiflash-release.sh | 51 ------------------- 3 files changed, 23 insertions(+), 72 deletions(-) delete mode 100755 release-darwin/build/build-debug.sh delete mode 100755 release-darwin/build/build-tiflash-release.sh diff --git a/release-darwin/build/build-debug.sh b/release-darwin/build/build-debug.sh deleted file mode 100755 index 614859d0ece..00000000000 --- a/release-darwin/build/build-debug.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Copyright 2022 PingCAP, Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ueox pipefail - -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" - -${SCRIPTPATH}/build-tiflash-release.sh "DEBUG" diff --git a/release-darwin/build/build-release.sh b/release-darwin/build/build-release.sh index 56331e38f7b..4c8d12853e4 100755 --- a/release-darwin/build/build-release.sh +++ b/release-darwin/build/build-release.sh @@ -16,5 +16,27 @@ set -ueox pipefail SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +SRCPATH=${1:-$(cd $SCRIPTPATH/../..; pwd -P)} +PATH=$PATH:/root/.cargo/bin +NPROC=${NPROC:-$(sysctl -n hw.physicalcpu || grep -c ^processor /proc/cpuinfo)} +CMAKE_BUILD_TYPE="RELWITHDEBINFO" -${SCRIPTPATH}/build-tiflash-release.sh "" +install_dir="$SRCPATH/release-darwin/tiflash" +if [ -d "$install_dir" ]; then rm -rf "${install_dir:?}"/*; else mkdir -p "$install_dir"; fi +build_dir="$SRCPATH/release-darwin/build-release" +rm -rf $build_dir && mkdir -p $build_dir && cd $build_dir + +cmake "$SRCPATH" \ + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ + -Wno-dev \ + -DNO_WERROR=ON + +cmake --build . --target tiflash --parallel $NPROC +cmake --install . --component=tiflash-release --prefix="$install_dir" + +FILE="$install_dir/tiflash" +otool -L "$FILE" + +set +e +echo "show ccache stats" +ccache -s diff --git a/release-darwin/build/build-tiflash-release.sh b/release-darwin/build/build-tiflash-release.sh deleted file mode 100755 index 5fa7257958f..00000000000 --- a/release-darwin/build/build-tiflash-release.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright 2022 PingCAP, Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ueox pipefail - -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -SRCPATH=${1:-$(cd $SCRIPTPATH/../..; pwd -P)} -PATH=$PATH:/root/.cargo/bin -NPROC=${NPROC:-$(sysctl -n hw.physicalcpu || grep -c ^processor /proc/cpuinfo)} - -CMAKE_BUILD_TYPE=$1 -if [[ -z ${CMAKE_BUILD_TYPE} ]]; then - CMAKE_BUILD_TYPE="RELWITHDEBINFO" -fi - -install_dir="$SRCPATH/release-darwin/tiflash" -if [ -d "$install_dir" ]; then rm -rf "${install_dir:?}"/*; else mkdir -p "$install_dir"; fi - -if [ $CMAKE_BUILD_TYPE == "RELWITHDEBINFO" ]; then - build_dir="$SRCPATH/release-darwin/build-release" -else - build_dir="$SRCPATH/release-darwin/build-debug" -fi -rm -rf $build_dir && mkdir -p $build_dir && cd $build_dir - -cmake "$SRCPATH" \ - -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ - -Wno-dev \ - -DNO_WERROR=ON - -cmake --build . --target tiflash --parallel $NPROC -cmake --install . --component=tiflash-release --prefix="$install_dir" - -FILE="$install_dir/tiflash" -otool -L "$FILE" - -set +e -echo "show ccache stats" -ccache -s