Skip to content

Commit

Permalink
llvm-{16,17,18,19,devel}: fix cmake variable handling
Browse files Browse the repository at this point in the history
The Portfiles for these llvm versions were mishandling
CMAKE_INSTALL_NAME_DIR in configure.pre_args-delete, failing to delete
the intended variable set by the _resources/port1.0/group/cmake-1.1.tcl
port group because the port group encloses the value in quotes, but the
Portfiles omitted the quotes.

CMAKE_INSTALL_RPATH was being mishandled in the same way, but because
these Portfiles specify cmake.install_rpath as empty, the port group does
not set CMAKE_INSTALL_RPATH at all, so the configure.pre_args-delete
entry for that variable can be removed from the Portfiles altogether.

These Portfiles’ configure.pre_args-replace item for
CMAKE_SYSTEM_PREFIX_PATH has been updated to reflect the value actually
set by the port group.

For llvm-16 and later, these Portfile updates should not cause any
meaningful change to the build output, so these Portfiles’ `revision`
fields are not updated. This same change would have impact to llvm-15
and earlier. llvm-15 was handled more carefully in macports#25918, and llvm-14
in macports#25919. A more comprehensive explanation of the change appears at
macports#25918 (comment).
  • Loading branch information
markmentovai committed Sep 27, 2024
1 parent 33cb6fc commit 0c655da
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
5 changes: 2 additions & 3 deletions lang/llvm-16/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ cmake.build_type Release
cmake.install_rpath

configure.pre_args-delete \
-DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
-DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib
-DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"

configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

configure.pre_args-replace \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;${cmake.install_prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"

configure.args-append \
Expand Down
5 changes: 2 additions & 3 deletions lang/llvm-17/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@ cmake.build_type Release
cmake.install_rpath

configure.pre_args-delete \
-DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
-DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib
-DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"

configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

configure.pre_args-replace \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;${cmake.install_prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"

configure.args-append \
Expand Down
7 changes: 3 additions & 4 deletions lang/llvm-18/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@ cmake.build_type Release
cmake.install_rpath

configure.pre_args-delete \
-DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
-DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib
-DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"

configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

configure.pre_args-replace \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;${cmake.install_prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"

configure.args-append \
Expand Down Expand Up @@ -381,7 +380,7 @@ post-destroot {
file rename ${destroot}${sub_prefix}/bin/clang-${clang_exe_version} ${destroot}${sub_prefix}/bin/clang
}

# If only 'flang-new' created, link to 'flang'
# If only 'flang-new' created, link to 'flang'
if {[file exists ${destroot}${sub_prefix}/bin/flang-new]} {
if {![file exists ${destroot}${sub_prefix}/bin/flang]} {
ln -s ${sub_prefix}/bin/flang-new ${destroot}${sub_prefix}/bin/flang
Expand Down
7 changes: 3 additions & 4 deletions lang/llvm-19/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@ cmake.build_type Release
cmake.install_rpath

configure.pre_args-delete \
-DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
-DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib
-DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"

configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

configure.pre_args-replace \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;${cmake.install_prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"

configure.args-append \
Expand Down Expand Up @@ -376,7 +375,7 @@ post-destroot {
file rename ${destroot}${sub_prefix}/bin/clang-${clang_exe_version} ${destroot}${sub_prefix}/bin/clang
}

# If only 'flang-new' created, link to 'flang'
# If only 'flang-new' created, link to 'flang'
if {[file exists ${destroot}${sub_prefix}/bin/flang-new]} {
if {![file exists ${destroot}${sub_prefix}/bin/flang]} {
ln -s ${sub_prefix}/bin/flang-new ${destroot}${sub_prefix}/bin/flang
Expand Down
11 changes: 5 additions & 6 deletions lang/llvm-devel/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ cmake.build_type Release
cmake.install_rpath

configure.pre_args-delete \
-DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
-DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib
-DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"

configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

configure.pre_args-replace \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;${cmake.install_prefix}\;/usr" \
-DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"

configure.args-append \
Expand Down Expand Up @@ -156,9 +155,9 @@ patchfiles-append \
0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
0025-lldb-add-defines-needed-for-older-SDKs.patch

# patches that longer apply when cloned from llvmm-17. To be seen if needed still.
# 0010-compiler-rt-cmake-config-ix.cmake-was-Leopard-No-ASA.patch
# 0011-Fix-missing-long-long-math-prototypes-when-using-the.patch
# patches that longer apply when cloned from llvm-17. To be seen if needed still.
# 0010-compiler-rt-cmake-config-ix.cmake-was-Leopard-No-ASA.patch
# 0011-Fix-missing-long-long-math-prototypes-when-using-the.patch

if {${os.platform} eq "darwin" && ${os.major} < 14} {
patchfiles-append \
Expand Down

0 comments on commit 0c655da

Please sign in to comment.