Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2023 11:06:21 GMT
From:      Nuno Teixeira <eduardo@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 9a6c426e3647 - main - devel/root: Fix building on 12.3, 13.2 and restore post-patch step
Message-ID:  <202304041106.334B6Loc070328@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by eduardo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9a6c426e3647702ce67a08ce5668e2ad64a36d3d

commit 9a6c426e3647702ce67a08ce5668e2ad64a36d3d
Author:     Erik Jensen <erik@tenku.dk>
AuthorDate: 2023-04-04 10:57:58 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2023-04-04 11:06:07 +0000

    devel/root: Fix building on 12.3, 13.2 and restore post-patch step
    
    ROOT version 6.28.02 fails to build on 123amd64:
    https://pkg-status.freebsd.org/beefy6/data/123amd64-default/d55ec1db8ffa/logs/root-6.28.02.log
    This patch fixes the (sed-related) issue.
    
    I submit here - again - the post-patch step, which ensures that ROOT can
    build on LLVM/Clang 10.0.1 (used on FreeBSD 12.3).
    
    Fix plist on 13.2 (RC)
    
    PR:             270625
---
 devel/root/Makefile                                | 15 +++++++++++--
 .../root/scripts/remove-modules-from-modulemap.awk |  9 ++++++++
 .../root/scripts/remove-modules-from-modulemap.sh  | 26 +++-------------------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/devel/root/Makefile b/devel/root/Makefile
index 9d3b5d1a5ca4..b9e7ccbef2e4 100644
--- a/devel/root/Makefile
+++ b/devel/root/Makefile
@@ -76,10 +76,21 @@ PLIST_SUB+=	NOT_INSTALLED_ON_AARCH64="" ONLY_INSTALLED_ON_AARCH64="@comment " AA
 # Some files only installed with LLVM/Clang 13 (used on FreeBSD 12.4 and 13.x)
 # TODO: Introduce USES+=llvm:min=14 instead when this can be deemed not too obtrusive on supported releases
 #       -- the post-patch step further down can then be phased out as well
-.if 1204000 <= ${OSVERSION} && ${OSVERSION} < 1400000 && ${OSVERSION} != 1301507
+.if 1204000 <= ${OSVERSION} && ${OSVERSION} < 1302000 && ${OSVERSION} != 1301507
 PLIST_SUB+=	ONLY_INSTALLED_WITH_LLVM_CLANG_13=""
 .else
 PLIST_SUB+=	ONLY_INSTALLED_WITH_LLVM_CLANG_13="@comment "
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+# In LLVM/Clang 10.0.1 (used on FreeBSD 12.3), the cstdalign header is missing from the std modulemap, but it is declared included in ROOT's std modulemap - this has to be removed.
+# See https://github.com/llvm/llvm-project/blob/main/libcxx/include/module.modulemap.in#L181
+# The same seems to be the case for the other headers defined in the variable "modules" below.
+.if ${OSVERSION} < 1204000
+modules=	cstdalign cuchar experimental/string_view ext/functional ext/numeric ext/type_traits.h bits_alloc_traits_h bits/allocator.h bits/basic_ios.h bits/cpp_type_traits.h bits/exception_defines.h bits/ios_base.h bits/locale_facets.h bits_stl_algobase_h bits_stl_iterator_h bits/stl_iterator_base_types.h bits/stl_map.h bits/stl_pair.h bits_stl_tree_h bits/uniform_int_dist.h
+post-patch:
+	SCRIPTDIR=${SCRIPTDIR} MODULEMAP=${WRKSRC}/interpreter/cling/include/cling/std.modulemap ${SH} ${SCRIPTDIR}/remove-modules-from-modulemap.sh "${modules}"
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/devel/root/scripts/remove-modules-from-modulemap.awk b/devel/root/scripts/remove-modules-from-modulemap.awk
new file mode 100755
index 000000000000..adabed818d2f
--- /dev/null
+++ b/devel/root/scripts/remove-modules-from-modulemap.awk
@@ -0,0 +1,9 @@
+BEGIN {
+  exclude = exclude; #trim left and right
+  gsub(/[[:blank:]]/, "|", exclude);
+  gsub(/\//, "\\/", exclude);
+  ex_regx = "module[[:blank:]]+\"(" exclude ")\".*{[[:blank:]]*$";
+}
+
+$0 ~ ex_regx, $0 ~ /^[[:blank:]]*}[[:blank:]]*$/  { next ; }
+{print}
diff --git a/devel/root/scripts/remove-modules-from-modulemap.sh b/devel/root/scripts/remove-modules-from-modulemap.sh
index 64df1b9c2ba0..c118c7637bf0 100755
--- a/devel/root/scripts/remove-modules-from-modulemap.sh
+++ b/devel/root/scripts/remove-modules-from-modulemap.sh
@@ -1,27 +1,7 @@
 #!/bin/sh
 
 # Script removes module definition blocks in LLVM/Clang .modulemap
-# files in-place in the file path stored in the variable MODULEMAP
+# files "in-place" in the file path stored in the variable MODULEMAP
 
-sp='[[:space:]]'
-
-mdls="" ; i=0
-for m in "$@" ; do
-  i=$((i+1))
-  mdls="$mdls($m)"
-  [ $i -ne $# ] && mdls="$mdls|"
-done
-
-script="\
-/^$sp*(explicit)?$sp*module$sp*\"$mdls\"$sp*\{$sp*\$/ {
-  :l
-    N
-    s/}/}/
-    tx
-    bl
-  :x
-    d
-}\
-"
-
-sed -i '' -E "$script" "$MODULEMAP"
+modules=$1
+tmp=${MODULEMAP}.tmp && awk -f ${SCRIPTDIR}/remove-modules-from-modulemap.awk -v exclude="${modules}" ${MODULEMAP} > ${tmp} && mv ${tmp} ${MODULEMAP} || rm ${tmp}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304041106.334B6Loc070328>