Hi,

Recently, i brought an update for mtpaint, and fixing the build for
a -fno-common patched llvm-10, that needs to be removed now [0].

I'm proposing to move mtpaint to gtk+3 while here, since we are
encouraged to move to gtk+3 after the final gtk+2 update [1]. I
totally missed that new feature while updating.

I had some linking error because "`-lX11' cannot be found". mtpaint's
configure script uses pkg-config(1) to get gtk+ linker flags, showing
clearly the difference:

> $ pkg-config --libs gtk+-x11-2.0 
> -L/usr/local/lib -L/usr/X11R6/lib -Wl,-rpath-link,/usr/X11R6/lib
> -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -lXrender -lXinerama -lXi
> -lXrandr -lXcursor -lXcomposite -lXdamage -lXfixes -lX11 -lXext
> -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0
> -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lfontconfig
> -lfreetype -lz
> 
> $ pkg-config --libs gtk+-x11-3.0 
> -L/usr/local/lib -Wl,-rpath-link,/usr/X11R6/lib -lgtk-3 -lgdk-3
> -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject
> -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl

The `-rpath-link' linker flag seems silently ignored by ld.lld(1), as
seen in /usr/src/gnu/llvm/lld/ELF/Options.td .

On top of that, upstream's configure does not call pkg-config(1)
against X11, but adds it to LIBS as-is, which looks wrong to me [2].

I added LDFLAGS to work around this issue.

This has been successfully built and (lightly) run tested on macppc
and amd64.


Comments/feedback are welcome,

Charlène.


[0] https://marc.info/?l=openbsd-ports&m=161204914031044&w=2
[1] https://marc.info/?l=openbsd-ports-cvs&m=160855070502243&w=2
[2]
https://github.com/wjaguar/mtPaint/blob/b0b023ba7ae231415d556ea88b2239fecf693faf/configure#L755


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/mtpaint/Makefile,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 Makefile
--- Makefile    2 Feb 2021 22:41:40 -0000       1.6
+++ Makefile    4 Jun 2021 22:43:12 -0000
@@ -1,8 +1,9 @@
 # $OpenBSD: Makefile,v 1.6 2021/02/02 22:41:40 cwen Exp $
 
-COMMENT =      simple GTK+2 raster painting program
+COMMENT =      simple GTK+3 raster painting program
 
 DISTNAME =     mtpaint-3.50
+REVISION =     0
 EXTRACT_SUFX = .tar.bz2
 
 CATEGORIES =   graphics
@@ -12,12 +13,10 @@ HOMEPAGE =  http://mtpaint.sourceforge.ne
 # GPLv3+
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
-WANTLIB += Xrandr Xrender atk-1.0 c cairo fontconfig freetype
-WANTLIB += gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0
-WANTLIB += gthread-2.0 gtk-x11-2.0 harfbuzz intl jasper jpeg lcms2
-WANTLIB += m pango-1.0 pangocairo-1.0 pangoft2-1.0 png pthread
-WANTLIB += tiff z
+WANTLIB += X11 atk-1.0 c cairo cairo-gobject gdk-3 gdk_pixbuf-2.0
+WANTLIB += gio-2.0 glib-2.0 gobject-2.0 gthread-2.0 gtk-3 harfbuzz
+WANTLIB += intl jasper jpeg lcms2 m pango-1.0 pangocairo-1.0 png
+WANTLIB += pthread tiff z
 
 MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=mtpaint/}
 
@@ -26,19 +25,16 @@ LIB_DEPENDS =       devel/gettext,-runtime \
                graphics/jasper \
                graphics/lcms2 \
                graphics/tiff \
-               x11/gtk+2
+               x11/gtk+3
 RUN_DEPENDS =  devel/desktop-file-utils
 
 USE_GMAKE =    Yes
 CONFIGURE_STYLE =      simple
 CONFIGURE_ARGS =       nogif jpeg jasper staticft tiff lcms \
-                       lcms2 intl man thread cflags \
+                       lcms2 intl man thread cflags gtk3 \
                        --mandir=${TRUEPREFIX}/man
+CONFIGURE_ENV +=       LDFLAGS="${LDFLAGS} -L${X11BASE}/lib"
 
 NO_TEST =      Yes
-
-# Remove after clang update to LLVM11. Meanwhile it avoids false positives with
-# a patched clang-10 (mtpaint uses that flag only with clang-11 and gcc-10)
-CFLAGS +=      -fcommon
 
 .include <bsd.port.mk>
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/graphics/mtpaint/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 DESCR
--- pkg/DESCR   25 Apr 2016 13:22:00 -0000      1.1.1.1
+++ pkg/DESCR   4 Jun 2021 22:43:12 -0000
@@ -1,4 +1,4 @@
-mtPaint is a simple GTK+1/2 painting program designed for creating icons and
+mtPaint is a simple GTK+3 painting program designed for creating icons and
 pixel based artwork. It can edit indexed palette or 24 bit RGB images and 
offers
 basic painting and palette manipulation tools. It also has several other more
 powerful features such as channels, layers and animation. Due to its simplicity



Reply via email to