From ffc37872c3ecd41da32bb5711e167b59a9ce99a0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 6 Jul 2024 00:55:28 +0200 Subject: [PATCH] CI: allow environment to select Qt version for release and ABI --- ci/RELEASE.sh | 16 ++++++++++++---- ci/abicheck.sh | 12 +++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ci/RELEASE.sh b/ci/RELEASE.sh index fe2bc173b..1b500ce47 100755 --- a/ci/RELEASE.sh +++ b/ci/RELEASE.sh @@ -34,6 +34,7 @@ # * BUILD_CLANG set to `false` to avoid second build with clang # * BUILD_ONLY set to `true` to break after building # * TEST_TARBALL set to 'false' to skip build-and-test phase after tarring +# * QT_VERSION set to nothing (uses default), 5 or 6 # ### END USAGE @@ -70,11 +71,18 @@ while getopts "hBbPT" opt ; do esac done - if $STRING_FREEZE ; then sh ci/txcheck.sh || { echo "! String freeze failed." ; exit 1 ; } fi +# Via environment, not command-line +case "$QT_VERSION" in + 5) extra_cmake_args="-DWITH_QT6=OFF" ;; + 6) extra_cmake_args="-DWITH_QT6=ON" ;; + "") extra_cmake_args="" ;; + *) echo "Invalid QT_VERSION environment '${QT_VERSION}'" ; exit 1 ; ;; +esac + ### Setup # # @@ -102,7 +110,7 @@ test -n "$V" || { echo "Could not obtain version in $BUILDDIR ." ; exit 1 ; } if test "x$BUILD_DEFAULT" = "xtrue" ; then rm -rf "$BUILDDIR" mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } - ( cd "$BUILDDIR" && cmake .. && make -j4 ) || { echo "Could not perform test-build in $BUILDDIR." ; exit 1 ; } + ( cd "$BUILDDIR" && cmake .. $extra_cmake_args && make -j4 ) || { echo "Could not perform test-build in $BUILDDIR." ; exit 1 ; } ( cd "$BUILDDIR" && make test ) || { echo "Tests failed in $BUILDDIR ." ; exit 1 ; } fi @@ -114,7 +122,7 @@ if test "x$BUILD_CLANG" = "xtrue" ; then # Do build again with clang rm -rf "$BUILDDIR" mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } - ( cd "$BUILDDIR" && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build in $BUILDDIR." ; exit 1 ; } + ( cd "$BUILDDIR" && CC=clang CXX=clang++ cmake .. $extra_cmake_args && make -j4 ) || { echo "Could not perform test-build in $BUILDDIR." ; exit 1 ; } ( cd "$BUILDDIR" && make test ) || { echo "Tests failed in $BUILDDIR (clang)." ; exit 1 ; } fi fi @@ -131,7 +139,7 @@ else # Presumably -B was given; just do the cmake part rm -rf "$BUILDDIR" mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } - ( cd "$BUILDDIR" && cmake .. ) || { echo "Could not run cmake in $BUILDDIR ." ; exit 1 ; } + ( cd "$BUILDDIR" && cmake .. $extra_cmake_args ) || { echo "Could not run cmake in $BUILDDIR ." ; exit 1 ; } fi ### Create signed tag diff --git a/ci/abicheck.sh b/ci/abicheck.sh index 99e064a81..716d483d7 100755 --- a/ci/abicheck.sh +++ b/ci/abicheck.sh @@ -10,6 +10,16 @@ # least once, maybe twice (if it needs the base-version ABI information # and hasn't cached it). +# The build settings can be influenced via environment variables: +# * QT_VERSION set to nothing (uses default), 5 or 6 + +case "$QT_VERSION" in + 5) extra_cmake_args="-DWITH_QT6=OFF" ;; + 6) extra_cmake_args="-DWITH_QT6=ON" ;; + "") extra_cmake_args="" ;; + *) echo "Invalid QT_VERSION environment '${QT_VERSION}'" ; exit 1 ; ;; +esac + # The base version can be a tag or git-hash; it will be checked-out # in a worktree. # @@ -28,7 +38,7 @@ do_build() { rm -f $BUILD_DIR.log echo "# Running CMake for $LABEL" - cmake -S $SOURCE_DIR -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og -g -gdwarf" -DCMAKE_C_FLAGS="-Og -g -gdwarf" > /dev/null 2>&1 + cmake -S $SOURCE_DIR -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og -g -gdwarf" -DCMAKE_C_FLAGS="-Og -g -gdwarf" $extra_cmake_args > /dev/null 2>&1 test -f $BUILD_DIR/Makefile || { echo "! failed to CMake $LABEL" ; exit 1 ; } echo "# Running make for $LABEL"