From fa6a2ab7f529a7f248a3ed8795ccfe0d6dcd373a Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Mon, 8 Feb 2016 12:02:20 +0100 Subject: Add new parameter with settable option: cmakeargs This will allow to pass user-defined CMake arguments. One of the users is pkgsrc, which defines it to following example string: -DPYVERSSUFFIX:STRING=2.7 -DCMAKE_INSTALL_PREFIX:PATH=/usr/pkg \ -DCMAKE_MODULE_PATH:PATH=/tmp/pkgsrc-tmp/wip/coreclr-git/work/.buildlink/cmake-Modules \ -DCMAKE_SKIP_RPATH:BOOL=TRUE -DCMAKE_INSTALL_LIBDIR:PATH=lib \ -DCMAKE_INSTALL_MANDIR:PATH=man Without these values unmodified build.sh won't integrate with pkgsrc as expected. Solution suggested by Jan Vorli (Microsoft) While there, there was need to alter loop type to handle options passed to arguments. As a bonus, new loop should be POSIX confirming. --- src/pal/tools/gen-buildsys-clang.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/pal/tools') diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh index ea8194fc1f..5e281e492e 100755 --- a/src/pal/tools/gen-buildsys-clang.sh +++ b/src/pal/tools/gen-buildsys-clang.sh @@ -3,16 +3,17 @@ # This file invokes cmake and generates the build system for gcc. # -if [ $# -lt 4 -o $# -gt 7 ] +if [ $# -lt 4 -o $# -gt 8 ] then echo "Usage..." - echo "gen-buildsys-clang.sh [build flavor] [coverage] [ninja]" + echo "gen-buildsys-clang.sh [build flavor] [coverage] [ninja] [cmakeargs]" echo "Specify the path to the top level CMake file - /src/NDP" echo "Specify the clang version to use, split into major and minor version" echo "Specify the target architecture." echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG." echo "Optionally specify 'coverage' to enable code coverage build." echo "Target ninja instead of make. ninja must be on the PATH." + echo "Pass additional arguments to CMake call." exit 1 fi @@ -39,6 +40,7 @@ buildtype=DEBUG code_coverage=OFF build_tests=OFF generator="Unix Makefiles" +__UnprocessedCMakeArgs="" for i in "${@:5}"; do upperI="$(echo $i | awk '{print toupper($0)}')" @@ -59,7 +61,7 @@ for i in "${@:5}"; do generator=Ninja ;; *) - echo "Ignoring unknown arg '$i'" + __UnprocessedCMakeArgs="$__UnprocessedCMakeArgs $i" esac done @@ -144,4 +146,5 @@ cmake \ "-DCMAKE_ENABLE_CODE_COVERAGE=$code_coverage" \ "-DCLR_CMAKE_BUILD_TESTS=$build_tests" \ $cmake_extra_defines \ + "$__UnprocessedCMakeArgs" \ "$1" -- cgit v1.2.3