| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # This script is used for testing the build, primarily for use |
| 3 | # with GitLab CI, but may be used by hand as well. |
| 4 | |
| 5 | set -e |
| 6 | set -x |
| 7 | |
| 8 | # Test autoconf build |
| 9 | autoconf_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 autoconf_build().() |
| 10 | { |
| 11 | autoreconf -ivf |
| 12 | |
| 13 | mkdirscip-shell system . . mkdir. autoconf-build |
| 14 | cd autoconf-build |
| 15 | echoscip-shell system . . echo. "Running ../configure --prefix=$(pwdscip-shell system . . pwd.)/../autoconf-install) ${opts}" |
| 16 | CFLAGS="-Wall -Wextra -Werror" ../configure --prefix=$(pwdscip-shell system . . pwd.)/../autoconf-install ${opts} |
| 17 | makescip-shell system . . make. |
| 18 | makescip-shell system . . make. install |
| 19 | makescip-shell system . . make. check |
| 20 | makescip-shell system . . make. distcheck |
| 21 | mkdirscip-shell system . . mkdir. ../distribution |
| 22 | cpscip-shell system . . cp. tiff-*.tar.* tiff*.zip ../distribution |
| 23 | } |
| 24 | |
| 25 | # Test autoconf build (minimal; no distcheck) |
| 26 | autoconf_build_minimalscip-shell shell texlive-bin 2026.20260303.78225+ds-4 autoconf_build_minimal().() |
| 27 | { |
| 28 | autoreconf -ivf |
| 29 | |
| 30 | mkdirscip-shell system . . mkdir. autoconf-build |
| 31 | cd autoconf-build |
| 32 | echoscip-shell system . . echo. "Running ../configure --prefix=$(pwdscip-shell system . . pwd.)/../autoconf-install) ${opts}" |
| 33 | CFLAGS="-Wall -Wextra -Werror" ../configure --prefix=$(pwdscip-shell system . . pwd.)/../autoconf-install ${opts} |
| 34 | makescip-shell system . . make. |
| 35 | makescip-shell system . . make. install |
| 36 | makescip-shell system . . make. check |
| 37 | } |
| 38 | |
| 39 | # Test cmake build |
| 40 | cmake_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 cmake_build().() |
| 41 | { |
| 42 | PATH="$(pwdscip-shell system . . pwd.)/tools/bin:$PATH" |
| 43 | if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -s)" = "Darwin" ]; then |
| 44 | PATH="$(pwdscip-shell system . . pwd.)/tools/CMake.app/Contents/bin:$PATH" |
| 45 | fi |
| 46 | mkdirscip-shell system . . mkdir. cmake-build |
| 47 | cd cmake-build |
| 48 | opts="-Dfatal-warnings=ON" |
| 49 | para3=`echoscip-shell system . . echo. "$3" | sedscip-shell system . . sed. 's/./\L&/g'` |
| 50 | if [scip-shell system . . `[`. "$para3" = "static" ]; then |
| 51 | opts2="-DBUILD_SHARED_LIBS:BOOL=OFF" |
| 52 | else |
| 53 | opts2="" |
| 54 | fi |
| 55 | echoscip-shell system . . echo. "Running cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ${opts2} .." |
| 56 | cmakescip-shell system . . cmake. -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install -DCMAKE_C_FLAGS="-Wall -Wextra -Werror" ${opts} ${opts2} .. |
| 57 | $COVERITY_BUILD cmake --build . |
| 58 | cmakescip-shell system . . cmake. --build . --target install |
| 59 | ctestscip-shell system . . ctest. -V |
| 60 | cd .. |
| 61 | if [scip-shell system . . `[`. "$para3" = "static" ]; then |
| 62 | echoscip-shell system . . echo. No test project build for STATIC CI/CD build - skipped -. |
| 63 | else |
| 64 | # Build test project using find_package(Tiff CONFIG) |
| 65 | mkdirscip-shell system . . mkdir. cmake-test-build |
| 66 | cd cmake-test-build |
| 67 | cmakescip-shell system . . cmake. -G "$1" -DCMAKE_BUILD_TYPE="$2" "-DTiff_DIR=$PWD/../cmake-install/lib/cmake/tiff" -S ../build/test_cmake -B . |
| 68 | cmakescip-shell system . . cmake. --build . |
| 69 | cd .. |
| 70 | mkdirscip-shell system . . mkdir. cmake-test-no-target-build |
| 71 | cd cmake-test-no-target-build |
| 72 | cmakescip-shell system . . cmake. -G "$1" -DCMAKE_BUILD_TYPE="$2" "-DTiff_DIR=$PWD/../cmake-install/lib/cmake/tiff" -S ../build/test_cmake_no_target -B . |
| 73 | cmakescip-shell system . . cmake. --build . |
| 74 | # Return to cmake-build for coverity_build() |
| 75 | cd ../cmake-build |
| 76 | fi |
| 77 | } |
| 78 | |
| 79 | # Static-analysis with coverity |
| 80 | coverity_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 coverity_build().() |
| 81 | { |
| 82 | curlscip-shell system . . curl. -o /tmp/cov-analysis-linux64.tgzscip-shell filesystem . . `/tmp/cov-analysis-linux64.tgz`. \ |
| 83 | https://scan.coverity.com/download/linux64 \ |
| 84 | --form project=$COVERITY_SCAN_PROJECT_NAME \ |
| 85 | --form token=$COVERITY_SCAN_TOKEN |
| 86 | tarscip-shell system . . tar. xfz /tmp/cov-analysis-linux64.tgzscip-shell filesystem . . `/tmp/cov-analysis-linux64.tgz`. |
| 87 | COVERITY_BUILD="$(pwdscip-shell system . . pwd.)/cov-analysis-linux64-*/bin/cov-build --dir cov-int" cmake_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 cmake_build(). "$@" |
| 88 | tarscip-shell system . . tar. cfz cov-int.tar.gz cov-int |
| 89 | curlscip-shell system . . curl. https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME \ |
| 90 | --form token=$COVERITY_SCAN_TOKEN \ |
| 91 | --form email=$GITLAB_USER_EMAIL \ |
| 92 | --form file[email protected] \ |
| 93 | --form version="`gitscip-shell system . . git. describe --tags`" \ |
| 94 | --form description="`gitscip-shell system . . git. describe --tags` / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID" |
| 95 | } |
| 96 | |
| 97 | |
| 98 | build=$1 |
| 99 | shift |
| 100 | |
| 101 | case $build in |
| 102 | autoconf) |
| 103 | echoscip-shell system . . echo. "Testing Autoconf build" |
| 104 | autoconf_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 autoconf_build(). "$@" |
| 105 | ;; |
| 106 | autoconf-minimal) |
| 107 | echoscip-shell system . . echo. "Testing Autoconf build (minimal)" |
| 108 | autoconf_build_minimalscip-shell shell texlive-bin 2026.20260303.78225+ds-4 autoconf_build_minimal(). "$@" |
| 109 | ;; |
| 110 | cmake) |
| 111 | echoscip-shell system . . echo. "Testing CMake build" |
| 112 | cmake_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 cmake_build(). "$@" |
| 113 | ;; |
| 114 | coverity) |
| 115 | echoscip-shell system . . echo. "Static analysis with Coverity" |
| 116 | coverity_buildscip-shell shell texlive-bin 2026.20260303.78225+ds-4 coverity_build(). "$@" |
| 117 | ;; |
| 118 | *) |
| 119 | echoscip-shell system . . echo. "Invalid argument: \"$arg\"" >&2 |
| 120 | exit 1 |
| 121 | ;; |
| 122 | esac |
| 123 | |
| 124 | exit 0 |