On 2014/12/25 01:46, Christian Weisgerber wrote: > The idea is that ports that build static executables should switch > from specifying "-static" to "${STATIC}" (available in bsd.port.mk, > defined in bsd.own.mk), so they can become static PIE executables > on the archs that support this. > > There may be a few things that really need "-static", but the usual > instances of rescue utilities or chroot binaries should switch to > PIE. > > A quick grep over the ports tree revealed these candidates; some more > are likely hiding: > > Straightforward replacement -static -> ${STATIC} in the port Makefile: > > archivers/gtar,static > archivers/star,static > misc/screen,static > net/cnupm,static > net/nslint,static > shells/dash,static > shells/tcsh,static > www/cgit > www/haserl,static > www/mimetex > > These make references to components that are built static, but the > details aren't in the port Makefile; they may require patches: > > devel/fossil > mail/femail > mail/mini_sendmail > net/icinga/core > www/fcgi-cgi
devel/fossil has scaffolding inside autoconf to build static and probably needs patching. net/icinga/core, www/fcgi-cgi, mail/mini_sendmail, mail/femail add -static to LDFLAGS or to linker command lines in patches. fcgi-cgi uses "pkg-config --libs --static glib-2.0" to fetch static linking instructions, this just adds the shared library dependencies but doesn't add -static to the linker flags, so I don't think we need to do anything special there, just change fcgi_cgi_static_LDFLAGS=-static to fcgi_cgi_static_LDFLAGS=${STATIC}. $ pkg-config --libs --static glib-2.0 -L/usr/local/lib -pthread -lglib-2.0 -lintl -liconv -lpcre $ pkg-config --libs glib-2.0 -L/usr/local/lib -lglib-2.0 -lintl Does this diff look reasonable? Index: Makefile =================================================================== RCS file: /cvs/ports/www/fcgi-cgi/Makefile,v retrieving revision 1.13 diff -u -p -r1.13 Makefile --- Makefile 22 Jul 2014 10:55:41 -0000 1.13 +++ Makefile 27 Dec 2014 13:47:53 -0000 @@ -8,7 +8,7 @@ DISTNAME= fcgi-cgi-$V PKGNAME-main= fcgi-cgi-$V PKGNAME-static= fcgi-cgi-static-$V REVISION-main= 4 -REVISION-static=5 +REVISION-static= 6 CATEGORIES= www HOMEPAGE= http://redmine.lighttpd.net/projects/fcgi-cgi/wiki @@ -39,6 +39,7 @@ MODULES= devel/gettext CONFIGURE_STYLE= gnu PREFIX-static= ${VARBASE}/www/${TRUEPREFIX} +MAKE_FLAGS= STATIC="${STATIC}" CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" Index: patches/patch-Makefile_am =================================================================== RCS file: /cvs/ports/www/fcgi-cgi/patches/patch-Makefile_am,v retrieving revision 1.3 diff -u -p -r1.3 patch-Makefile_am --- patches/patch-Makefile_am 28 Mar 2013 23:40:56 -0000 1.3 +++ patches/patch-Makefile_am 27 Dec 2014 13:47:53 -0000 @@ -10,5 +10,5 @@ $OpenBSD: patch-Makefile_am,v 1.3 2013/0 fcgi_cgi_SOURCES=fastcgi.c fcgi-cgi.c + +fcgi_cgi_static_LDADD=$(GLIB_LIBS_STATIC) -+fcgi_cgi_static_LDFLAGS=-static ++fcgi_cgi_static_LDFLAGS=${STATIC} +fcgi_cgi_static_SOURCES=$(fcgi_cgi_SOURCES) > Finally, I have no idea if there is a valid reason why this wants > to be static: > > benchmarks/bonnie This was present in Makefile in the initial import. No idea if it's required.. > There remain the somewhat connected questions when to throw the > switch and whether the affected ports should have a revision bump. I think we want to make sure there has been at least one bump between 5.6 and 5.7, especially for these static things which don't all have WANTLIBs so may be quite old on some systems. Probably makes sense to throw the switch after the most common arch have been updated..