As most readers know by now, ports requiring WX mappings must now
be annotated when the binaries are created. Because there are many
build systems in ports (sometimes even different ones within a
single port) this is an utter pain to setup, so for the jdk ports
I've used a wrapper installed to ${WRKDIR}/bin/ld that adds the
relevant flag.

This factors out the wrapper so it can be generated by ports
infrastructure instead (by setting USE_WXNEEDED=Yes), and adds
it to the sqlports database so we can spot them more easily.

Any comments?

OK?

Index: ports/infrastructure/mk/bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1319
diff -u -p -r1.1319 bsd.port.mk
--- ports/infrastructure/mk/bsd.port.mk 10 Jul 2016 18:51:03 -0000      1.1319
+++ ports/infrastructure/mk/bsd.port.mk 18 Aug 2016 09:06:19 -0000
@@ -110,7 +110,7 @@ _ALL_VARIABLES += HOMEPAGE DISTNAME \
        SHARED_LIBS TARGETS PSEUDO_FLAVOR \
        MAINTAINER AUTOCONF_VERSION AUTOMAKE_VERSION CONFIGURE_ARGS \
        GH_ACCOUNT GH_COMMIT GH_PROJECT GH_TAGNAME PORTROACH \
-       PORTROACH_COMMENT MAKEFILE_LIST
+       PORTROACH_COMMENT MAKEFILE_LIST USE_WXNEEDED
 _ALL_VARIABLES_PER_ARCH += BROKEN
 # and stuff needing to be MULTI_PACKAGE'd
 _ALL_VARIABLES_INDEXED += COMMENT PKGNAME \
@@ -361,6 +361,7 @@ BASELOCALSTATEDIR ?= ${VARBASE}
 LOCALSTATEDIR ?= ${BASELOCALSTATEDIR}
 
 RCDIR ?= /etc/rc.d
+USE_WXNEEDED ?= No
 USE_GMAKE ?= No
 .if ${USE_GMAKE:L} == "yes"
 BUILD_DEPENDS += devel/gmake
@@ -2595,6 +2596,10 @@ ${_PATCH_COOKIE}: ${_EXTRACT_COOKIE}
                if $$error; then exit 1; fi; \
        fi
 # End of PATCH.
+.endif
+.if ${USE_WXNEEDED:L} == "yes"
+       @printf '#!/bin/sh\nexec /usr/bin/ld -z wxneeded $$*\n' > 
${WRKDIR}/bin/ld
+       @chmod 555 ${WRKDIR}/bin/ld
 .endif
 .if target(post-patch)
        @${_MAKESYS} post-patch
Index: ports/databases/sqlports/Makefile
===================================================================
RCS file: /cvs/ports/databases/sqlports/Makefile,v
retrieving revision 1.61
diff -u -p -r1.61 Makefile
--- ports/databases/sqlports/Makefile   20 Mar 2016 20:03:07 -0000      1.61
+++ ports/databases/sqlports/Makefile   18 Aug 2016 09:09:47 -0000
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.61 2016/03/20 20:03:07 naddy Exp $
 
 CATEGORIES =           databases
-V =                    5.0
+V =                    6.0
 DISTNAME =             sqlports-$V
 DISTFILES =
 COMMENT =              sqlite database of ports
Index: ports/databases/sqlports/files/Info.pm
===================================================================
RCS file: /cvs/ports/databases/sqlports/files/Info.pm,v
retrieving revision 1.18
diff -u -p -r1.18 Info.pm
--- ports/databases/sqlports/files/Info.pm      20 Mar 2016 20:03:07 -0000      
1.18
+++ ports/databases/sqlports/files/Info.pm      18 Aug 2016 09:09:47 -0000
@@ -95,6 +95,7 @@ our $vars = {
     USE_GMAKE => 'YesNoVar',
     USE_GROFF => 'YesNoVar',
     USE_LIBTOOL => 'YesNoGnuVar',
+    USE_WXNEEDED => 'YesNoVar',
     WANTLIB => 'WantlibVar',
     # XXX those variables are part of the dump for dpb, but really should
     # not end up in sqlports. But make sure we know about them.
Index: src/share/man/man5/bsd.port.mk.5
===================================================================
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.437
diff -u -p -r1.437 bsd.port.mk.5
--- src/share/man/man5/bsd.port.mk.5    1 Aug 2016 00:48:22 -0000       1.437
+++ src/share/man/man5/bsd.port.mk.5    18 Aug 2016 09:06:19 -0000
@@ -2922,6 +2922,13 @@ and not intended to be a user setting.
 See
 .Ev WRKOBJDIR_MFS
 for configuration.
+.It Ev USE_WXNEEDED
+Set to
+.Sq Yes
+if this port needs to disable the default W^X enforcement on memory
+mappings.
+Adds a wrapper script to ${WRKDIR}/bin/ld in
+.Cm post-patch .
 .It Ev USE_X11
 Normally, presence of ${X11BASE} is enforced by default for building ports.
 But there is an experimental way to hook the xenocara build into
Index: ports/devel/jdk/1.7/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/1.7/Makefile,v
retrieving revision 1.82
diff -u -p -r1.82 Makefile
--- ports/devel/jdk/1.7/Makefile        17 Aug 2016 21:36:47 -0000      1.82
+++ ports/devel/jdk/1.7/Makefile        18 Aug 2016 09:06:19 -0000
@@ -1,6 +1,7 @@
 # $OpenBSD: Makefile,v 1.82 2016/08/17 21:36:47 sthen Exp $
 
 ONLY_FOR_ARCHS=        i386 amd64
+USE_WXNEEDED=  Yes
 
 COMMENT-main=  Java2(TM) SE Dev Kit v${V}
 COMMENT-jre=   Java2(TM) SE Runtime Environment v${V}
@@ -136,8 +137,6 @@ COPYFILES=  hotspot/src/os/linux/vm/decod
 
 # create initial bsd src from linux src
 post-extract:
-       @printf '#!/bin/sh\nexec /usr/bin/ld -z wxneeded $$*\n' > 
${WRKDIR}/bin/ld
-       @chmod 755 ${WRKDIR}/bin/ld
        @for f in ${COPYFILES}; do \
                t=`echo $$f | sed 's/linux/bsd/g'`; \
                sed 's/linux/bsd/g; s/Linux/Bsd/g' < ${WRKDIST}/$$f > 
${WRKDIST}/$$t; \
Index: ports/devel/jdk/1.8/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/1.8/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- ports/devel/jdk/1.8/Makefile        17 Aug 2016 21:58:36 -0000      1.10
+++ ports/devel/jdk/1.8/Makefile        18 Aug 2016 09:06:19 -0000
@@ -1,6 +1,7 @@
 # $OpenBSD: Makefile,v 1.10 2016/08/17 21:58:36 sthen Exp $
 
 ONLY_FOR_ARCHS=        i386 amd64
+USE_WXNEEDED=  Yes
 
 COMMENT-main=  OpenJDK Software Development Kit v${V}
 COMMENT-jre=   OpenJDK Runtime Environment v${V}
@@ -106,8 +107,6 @@ JREIMAGEDIR=        ${BUILDDIR}/j2re-image
  
 post-extract:
        chmod +x ${WRKDIST}/configure
-       printf '#!/bin/sh\nexec /usr/bin/ld -z wxneeded $$*\n' > 
${WRKDIR}/bin/ld; \
-               chmod 755 ${WRKDIR}/bin/ld
 
 post-build:
        @rm -rf ${JDKIMAGEDIR}/man/ja ${JDKIMAGEDIR}/man/ja_JP.UTF-8 \

Reply via email to