Hello Brad,

On 29/12/2021 01:04, Brad Smith wrote:
Hi Alessandro,

It looks like the issue mentioned in the Debian
bug report was fixed a bit under 2 years ago.


The issue with this port was very similar to that bug report, but the root cause identified when we initially imported cad/magic was a different Clang's pre-processor behavior w.r.t. GCC's one in line continuation symbol treatment.

I see that you added lang/python as dependency (very good catch!); my understanding is that when python is found during the config step, a pre-processing script is used instead of CPP (I didn't notice that in the past...), so this should solve the issue.

I would add a note in the commit log, in order to remember this point!

Regarding your diff, please see my comments in-line.

Can you please test this to make sure it works
as expected?


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/cad/magic/Makefile,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 Makefile
--- Makefile    6 Mar 2021 11:59:59 -0000       1.6
+++ Makefile    28 Dec 2021 22:53:21 -0000
@@ -2,6 +2,7 @@
COMMENT = interactive system for VLSI circuit layouts
  DISTNAME =    magic-8.3.137
+REVISION =     0
  EXTRACT_SUFX =        .tgz
CATEGORIES = cad
@@ -11,16 +12,17 @@ MAINTAINER =        Alessandro De Laurenzis <ju
  # MIT (Magic, scmos), GPLv2 only (readline)
  PERMIT_PACKAGE =      Yes
-WANTLIB = ${MODTK_WANTLIB} c cairo fontconfig freetype m GL GLU X11
+WANTLIB =      ${MODTK_WANTLIB} GL GLU X11 Xext Xi Xmu c cairo fontconfig \
+               freetype m
MASTER_SITES = http://opencircuitdesign.com/magic/archive/ -# The cpp preprocessor is used to generate .tech files; clang's breaks
-# newlines: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698760
-COMPILER =     ports-gcc
+COMPILER =     base-clang ports-gcc
  COMPILER_LANGS = c
-MODULES = x11/tk
+MODULES =      lang/python \
+               x11/tk
+MODPY_RUNDEP = No
LIB_DEPENDS = ${MODTK_LIB_DEPENDS} \
                graphics/cairo
@@ -31,16 +33,16 @@ WRKCONF =           ${WRKSRC}/scripts
  CONFIGURE_STYLE =     gnu
  CONFIGURE_ARGS +=     --with-distdir=${PREFIX} \
                        --with-tcl=${MODTCL_LIBDIR} \
-                       --with-tk=${MODTK_LIBDIR} \
-                       --with-cairo=${LOCALBASE}/include \

Removing --with-cairo=${LOCALBASE}/include I see the following warnings during configure step:

checking cairo/cairo.h presence... no
configure: WARNING: cairo/cairo.h: accepted by the compiler, rejected by the 
preprocessor!
configure: WARNING: cairo/cairo.h: proceeding with the compiler's result

so I would like to preserve that line.

-                       --enable-cairo-offscreen

This breaks OpenGL support, we definitely need that option.

+                       --with-tk=${MODTK_LIBDIR}
+CONFIGURE_ENV +=       LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib"
+
+CFLAGS +=      -I${LOCALBASE}/include -I${X11BASE}/include

The Clang compile log is much more noisy, so - considering that cad/magic codebase is very old - I would add also the following:

# Really really not C99
CFLAGS +=       -Wno-return-type -Wno-parentheses
USE_GMAKE = Yes NO_TEST = Yes post-patch:
-       @${SUBST_CMD} ${WRKSRC}/scripts/configure
        @${SUBST_CMD} ${WRKSRC}/utils/paths.h
post-install:
Index: patches/patch-scripts_configure
===================================================================
RCS file: /home/cvs/ports/cad/magic/patches/patch-scripts_configure,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-scripts_configure
--- patches/patch-scripts_configure     6 Mar 2021 11:59:59 -0000       1.3
+++ patches/patch-scripts_configure     28 Dec 2021 21:50:55 -0000
@@ -21,20 +21,19 @@ Index: scripts/configure
         # Not available on all versions:  check for include file.
         ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" 
"$ac_includes_default"
   if test "x$ac_cv_header_dlfcn_h" = xyes; then :
-@@ -8050,6 +8050,12 @@ fi
+@@ -8050,6 +8050,11 @@ fi
         fi
         ;;
+ *-openbsd*)
  +      SHLIB_CFLAGS="-fPIC"
  +      LDDL_FLAGS="-shared ${LIB_SPEC}"
-+      CFLAGS="${CFLAGS} -I${X11BASE}/include"
  +      ;;
  +
       *-nextstep*)
         LDDL_FLAGS="-nostdlib -r"
         ;;
-@@ -9485,16 +9491,5 @@ else
+@@ -9485,16 +9490,5 @@ else
        echo
      fi
   fi
I see that the line "BUILD_DEPENDS = devel/m4" got lost in one of the recent updates (but it is still needed AFAICS), so I would re-add it.

With the above modifications (except the additional CFLAGS line, which I consider optional), this is OK maintainer.

Please find attached a modified patch for your convenience. Adding ports@ in case other developers wants to chime in.

Also, I'm currently testing a newer upstream version, but that would require a bit more time.

All the best

--
Alessandro De Laurenzis
[mailto:jus...@atlantide.mooo.com]
Web: http://www.atlantide.mooo.com
LinkedIn: http://it.linkedin.com/in/delaurenzis
Index: Makefile
===================================================================
RCS file: /cvs/ports/cad/magic/Makefile,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 Makefile
--- Makefile	6 Mar 2021 11:59:59 -0000	1.6
+++ Makefile	29 Dec 2021 15:33:00 -0000
@@ -2,6 +2,7 @@
 
 COMMENT =	interactive system for VLSI circuit layouts
 DISTNAME =	magic-8.3.137
+REVISION =	0
 EXTRACT_SUFX =	.tgz
 
 CATEGORIES =	cad
@@ -9,22 +10,25 @@ HOMEPAGE =	http://opencircuitdesign.com/
 MAINTAINER =	Alessandro De Laurenzis <jus...@atlantide.mooo.com>
 
 # MIT (Magic, scmos), GPLv2 only (readline)
-PERMIT_PACKAGE =	Yes
+PERMIT_PACKAGE = Yes
 
-WANTLIB =	${MODTK_WANTLIB} c cairo fontconfig freetype m GL GLU X11
+WANTLIB =	${MODTK_WANTLIB} GL GLU X11 Xext Xi Xmu c cairo fontconfig \
+		freetype m
 
 MASTER_SITES =	http://opencircuitdesign.com/magic/archive/
 
-# The cpp preprocessor is used to generate .tech files; clang's breaks
-# newlines: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698760
-COMPILER =	ports-gcc
+COMPILER =	base-clang ports-gcc
 COMPILER_LANGS = c
 
-MODULES =	x11/tk
+MODULES =	lang/python \
+		x11/tk
+MODPY_RUNDEP =	No
 
 LIB_DEPENDS =	${MODTK_LIB_DEPENDS} \
 		graphics/cairo
 
+BUILD_DEPENDS =	devel/m4
+
 RUN_DEPENDS =	shells/bash
 
 WRKCONF =		${WRKSRC}/scripts
@@ -34,13 +38,18 @@ CONFIGURE_ARGS +=	--with-distdir=${PREFI
 			--with-tk=${MODTK_LIBDIR} \
 			--with-cairo=${LOCALBASE}/include \
 			--enable-cairo-offscreen
+CONFIGURE_ENV +=	LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib"
+
+CFLAGS +=	-I${LOCALBASE}/include -I${X11BASE}/include
+
+# Really really not C99
+CFLAGS +=	-Wno-return-type -Wno-parentheses
 
 USE_GMAKE =	Yes
 
 NO_TEST =	Yes
 
 post-patch:
-	@${SUBST_CMD} ${WRKSRC}/scripts/configure
 	@${SUBST_CMD} ${WRKSRC}/utils/paths.h
 
 post-install:
Index: patches/patch-scripts_configure
===================================================================
RCS file: /cvs/ports/cad/magic/patches/patch-scripts_configure,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-scripts_configure
--- patches/patch-scripts_configure	6 Mar 2021 11:59:59 -0000	1.3
+++ patches/patch-scripts_configure	29 Dec 2021 15:33:00 -0000
@@ -21,20 +21,19 @@ Index: scripts/configure
        # Not available on all versions:  check for include file.
        ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
  if test "x$ac_cv_header_dlfcn_h" = xyes; then :
-@@ -8050,6 +8050,12 @@ fi
+@@ -8050,6 +8050,11 @@ fi
        fi
        ;;
  
 +    *-openbsd*)
 +      SHLIB_CFLAGS="-fPIC"
 +      LDDL_FLAGS="-shared ${LIB_SPEC}"
-+      CFLAGS="${CFLAGS} -I${X11BASE}/include"
 +      ;;
 +
      *-nextstep*)
        LDDL_FLAGS="-nostdlib -r"
        ;;
-@@ -9485,16 +9491,5 @@ else
+@@ -9485,16 +9490,5 @@ else
       echo
     fi
  fi

Reply via email to