On 2018/10/24 16:16, Stuart Henderson wrote:
> If you are adding ports which use c++, please make sure they have a
> COMPILER line that prefers ports-gcc on architectures which haven't
> moved to clang.
> 
> Standard:
> 
> COMPILER = base-clang ports-gcc base-gcc

Here's a portcheck diff that should warn about the most common problems.
Comments? OK?


Index: portcheck
===================================================================
RCS file: /cvs/ports/infrastructure/bin/portcheck,v
retrieving revision 1.124
diff -u -p -r1.124 portcheck
--- portcheck   20 Oct 2018 17:14:03 -0000      1.124
+++ portcheck   24 Oct 2018 15:13:33 -0000
@@ -856,9 +856,11 @@ sub_checks() {
                        vars="$vars PKG_ARCH$subpkg $wantlib_var WANTLIB-"
                        vars="$vars PERMIT_PACKAGE_CDROM${subpkg%-}"
                        vars="$vars PERMIT_PACKAGE_FTP${subpkg%-}"
+                       vars="$vars COMPILER"
                        make "${make_args[@]}" show="$vars" | {
                                local comment fullpkgname modules pkg_arch
                                local wantlib perm_pkg_cdrom perm_pkg_ftp
+                               local compiler
                                read -r comment
                                read -r fullpkgname
                                read -r modules
@@ -867,6 +869,7 @@ sub_checks() {
                                read -r wantlib_ss
                                read -r perm_pkg_cdrom
                                read -r perm_pkg_ftp
+                               read -r compiler
 
                                if [[ $comment == @(a|an|the)" "* ]]; then
                                        err "${portref}no leading articles in" \
@@ -880,7 +883,7 @@ sub_checks() {
                                        fi
                                fi
 
-                               check_wantlib "$portref" "$modules" $wantlib
+                               check_wantlib "$portref" "$modules" "$compiler" 
$wantlib
                                check_permit_subpkg "$portref" "$subpkg" \
                                    "$perm_pkg_cdrom" "$perm_pkg_ftp"
 
@@ -1299,6 +1302,7 @@ check_plist() {
 check_wantlib() {
        local portref="$1"; shift
        local modules="$1"; shift
+       local compiler="$1"; shift
 
        local phonon_s_wantlib=false
 
@@ -1307,6 +1311,9 @@ check_wantlib() {
        local phonon_module=false
        local gcc4_module=false
 
+       local ports_gcc=false
+       local clang_compiler=false
+
        local v
 
        for v in $modules; do case $v in
@@ -1316,6 +1323,11 @@ check_wantlib() {
                x11/kde4)               kde4_module=true;;
        esac; done
 
+       for v in $compiler; do case $v in
+               ports-gcc)              ports_gcc=true;;
+               *-clang)                clang_compiler=true;;
+       esac; done
+
        for v; do case $v in
                phonon_s?(?(">")=+([0-9])))
                        phonon_s_wantlib=true
@@ -1343,7 +1355,18 @@ check_wantlib() {
                                    "in MODULES (check other libs, too!)"
                        fi
                        ;;
+               c++?(?('>')=+([0-9])))
+                       if ! $ports_gcc; then
+                               err "$portref$v in WANTLIB; add ports-gcc" \
+                                   "to COMPILER to avoid problems on" \
+                                   "non-clang arches"
+                       fi
+                       ;;
                stdc++?(?('>')=+([0-9])))
+                       if $clang_compiler; then
+                               err "$portref$v in WANTLIB but clang used as" \
+                                   "compiler"
+                       fi
                        if $gcc4_module; then
                                err "$portref$v in WANTLIB when gcc4 is" \
                                    "in MODULES; run port-lib-depends-check" \

Reply via email to