From 4ec8e9938b0de83c3a9fa94eb547ca450c3c864a Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Mon, 4 Sep 2023 10:01:48 +0000 Subject: [PATCH] win32_build.sh: use ENABLE_SHARED=ON by default The Windows build script uses static linking by default, the reason being that some tests were failing to build otherwise, mostly due to unspecified dependencies. Now that the issue was addressed, we can enable dynamic linking by default. Worth mentioning that the Ceph MSI build script already uses dynamic linking. While at it, we'll drop some duplicate defaults from "win32_deps_build.sh". For better clarity, we'll avoid exporting some "win32_build.sh" variables, instead passing them explicitly to "win32_deps_build.sh". Signed-off-by: Lucian Petrut --- README.windows.rst | 2 +- mingw_conf.sh | 3 +++ win32_build.sh | 15 ++++++++------- win32_deps_build.sh | 14 +------------- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/README.windows.rst b/README.windows.rst index b8065b6b282..5a701390056 100644 --- a/README.windows.rst +++ b/README.windows.rst @@ -54,7 +54,7 @@ EMBEDDED_DBG_SYM By default, the generated symbols. If this flag is set, the debug symbols will remain embedded in the executables. -ENABLE_SHARED Dynamically link Ceph libs. False +ENABLE_SHARED Dynamically link Ceph libs. ON ================= =============================== =============================== The following command will build the binaries and add them to a zip archive diff --git a/mingw_conf.sh b/mingw_conf.sh index 7c0d527e1e2..6a226da5f04 100644 --- a/mingw_conf.sh +++ b/mingw_conf.sh @@ -17,6 +17,9 @@ SCRIPT_DIR="$(dirname "$BASH_SOURCE")" SCRIPT_DIR="$(realpath "$SCRIPT_DIR")" +MINGW_CMAKE_FILE=${MINGW_CMAKE_FILE:-} +MINGW_POSIX_FLAGS=${MINGW_POSIX_FLAGS:-} + if [[ -n $USE_MINGW_LLVM ]]; then MINGW_LLVM_DIR=${MINGW_LLVM_DIR:-"$SCRIPT_DIR/build.deps/mingw-llvm"} fi diff --git a/win32_build.sh b/win32_build.sh index 8edf4032629..4c65e7ae260 100755 --- a/win32_build.sh +++ b/win32_build.sh @@ -58,7 +58,6 @@ if [[ -z $OS ]]; then ;; esac fi -export OS="$OS" # The main advantages of mingw-llvm: # * not affected by the libstdc++/winpthread rw lock bugs @@ -68,7 +67,7 @@ TOOLCHAIN=${TOOLCHAIN:-"mingw-llvm"} case "$TOOLCHAIN" in mingw-llvm) echo "Using mingw-llvm." - export USE_MINGW_LLVM=1 + USE_MINGW_LLVM=1 ;; mingw-gcc) echo "Using mingw-gcc" @@ -93,9 +92,7 @@ if [[ -z $CMAKE_BUILD_TYPE ]]; then CMAKE_BUILD_TYPE=Release fi -# Some tests can't use shared libraries yet due to unspecified dependencies. -# We'll do a static build by default for now. -ENABLE_SHARED=${ENABLE_SHARED:-OFF} +ENABLE_SHARED=${ENABLE_SHARED:-ON} binDir="$BUILD_DIR/bin" strippedBinDir="$BUILD_DIR/bin_stripped" @@ -145,8 +142,12 @@ cd $BUILD_DIR if [[ ! -f ${depsToolsetDir}/completed ]]; then echo "Preparing dependencies: $DEPS_DIR. Log: ${BUILD_DIR}/build_deps.log" - NUM_WORKERS=$NUM_WORKERS DEPS_DIR=$DEPS_DIR OS="$OS"\ - "$SCRIPT_DIR/win32_deps_build.sh" | tee "${BUILD_DIR}/build_deps.log" + NUM_WORKERS=$NUM_WORKERS \ + DEPS_DIR=$DEPS_DIR \ + OS="$OS" \ + ENABLE_SHARED=$ENABLE_SHARED \ + USE_MINGW_LLVM=$USE_MINGW_LLVM \ + "$SCRIPT_DIR/win32_deps_build.sh" | tee "${BUILD_DIR}/build_deps.log" fi # Due to distribution specific mingw settings, the mingw.cmake file diff --git a/win32_deps_build.sh b/win32_deps_build.sh index adc34a01834..6eea81d1b8a 100755 --- a/win32_deps_build.sh +++ b/win32_deps_build.sh @@ -1,17 +1,10 @@ #!/usr/bin/env bash -set -e +set -eu SCRIPT_DIR="$(dirname "$BASH_SOURCE")" SCRIPT_DIR="$(realpath "$SCRIPT_DIR")" -USE_MINGW_LLVM=${USE_MINGW_LLVM:-} -ENABLE_SHARED=${ENABLE_SHARED:-OFF} - -num_vcpus=$(nproc) -NUM_WORKERS=${NUM_WORKERS:-$num_vcpus} - -DEPS_DIR="${DEPS_DIR:-$SCRIPT_DIR/build.deps}" depsSrcDir="$DEPS_DIR/src" depsToolsetDir="$DEPS_DIR/mingw" @@ -51,11 +44,6 @@ mingwLlvmUrl="https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/ mingwLlvmSha256Sum="bc97745e702fb9e8f2a16f7d09dd5061ceeef16554dd12e542f619ce937e8d7a" mingwLlvmDir="${DEPS_DIR}/mingw-llvm" -# Allow for OS specific customizations through the OS flag (normally -# passed through from win32_build). -# Valid options are currently "ubuntu", "rhel", and "suse". -OS=${OS:-"ubuntu"} - function _make() { make -j $NUM_WORKERS $@ } -- 2.39.5