On Thu, Dec 25, 2014 at 01:46:18AM +0100, 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.
>
...
Something like the attached for fossil?
--
James Turner
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/fossil/Makefile,v
retrieving revision 1.44
diff -u -p -r1.44 Makefile
--- Makefile 13 Jun 2014 02:30:31 -0000 1.44
+++ Makefile 27 Dec 2014 20:00:13 -0000
@@ -4,6 +4,7 @@ COMMENT = simple distributed software c
DISTNAME = fossil-src-20140612172556
PKGNAME = fossil-1.29
+REVISION = 0
EPOCH = 0
CATEGORIES = devel www
@@ -34,12 +35,15 @@ PREFIX = ${VARBASE}/www
CONFLICT_MARKER = fossil-*-static
.endif
-SUBST_VARS += CONFLICT_MARKER
+SUBST_VARS += CONFLICT_MARKER STATIC
TEST_DEPENDS = ${MODTCL_RUN_DEPENDS}
post-extract:
@rm -f ${WRKSRC}/src/sqlite3.h
+
+pre-configure:
+ ${SUBST_CMD} ${WRKSRC}/auto.def
do-test:
@cd ${WRKSRC} && ${MODTCL_BIN} test/tester.tcl fossil
Index: patches/patch-auto_def
===================================================================
RCS file: patches/patch-auto_def
diff -N patches/patch-auto_def
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-auto_def 27 Dec 2014 20:00:13 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- auto.def.orig Sat Dec 27 14:33:25 2014
++++ auto.def Sat Dec 27 14:34:05 2014
+@@ -88,7 +88,7 @@ if {[opt-bool json]} {
+
+ if {[opt-bool static]} {
+ # XXX: This will not work on all systems.
+- define-append EXTRA_LDFLAGS -static
++ define-append EXTRA_LDFLAGS ${STATIC}
+ }
+
+ set tclpath [opt-val with-tcl]