summaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2013-03-06 14:28:57 +0000
committerbapt <bapt@FreeBSD.org>2013-03-06 14:28:57 +0000
commit60001306c379d81bf9d2a62ded5df2f3a26a3381 (patch)
treeff1c99fff77ba1d8a0c6327b2caa4d142ff34781 /Mk
parentdd0d94aabe3f01b4cd362dc8387b6c5615181817 (diff)
downloadFreeBSD-ports-60001306c379d81bf9d2a62ded5df2f3a26a3381.zip
FreeBSD-ports-60001306c379d81bf9d2a62ded5df2f3a26a3381.tar.gz
New USES macros that loads "features" on demand.
First feature implemented: pathfix which will lookup in WRKSRC for Makefile.in and configure and fix common path that doesn't fit with FreeBSD hier(7) This is an extract of bsd.gnome.mk's gnomehack to avoid porters to have to load the full bsd.gnome.mk just for this feature More features to come...
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/pathfix.mk26
-rw-r--r--Mk/bsd.port.mk10
2 files changed, 36 insertions, 0 deletions
diff --git a/Mk/Uses/pathfix.mk b/Mk/Uses/pathfix.mk
new file mode 100644
index 0000000..37df6cf
--- /dev/null
+++ b/Mk/Uses/pathfix.mk
@@ -0,0 +1,26 @@
+# $FreeBSD$
+# Lookup in Makefile.in and configure for common incorrect paths and set them
+# to respect FreeBSD hier
+#
+# MAINTAINER: portmgr@FreeBSD.org
+#
+.if !defined(_INCLUDE_PATHFIX_MK)
+_INCLUDE_PATHFIX_MK= yes
+
+PATHFIX_MAKEFILEIN?= Makefile.in
+
+pre-patch: pathfix-pre-patch
+
+pathfix-pre-patch:
+ @${FIND} ${WRKSRC} -name "${PATHFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} -e \
+ 's|[(]libdir[)]/locale|(prefix)/share/locale|g ; \
+ s|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
+ s|[(]datadir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
+ s|[(]prefix[)]/lib/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
+ s|[$$][(]localstatedir[)]/scrollkeeper|${SCROLLKEEPER_DIR}|g ; \
+ s|[(]libdir[)]/bonobo/servers|(prefix)/libdata/bonobo/servers|g' ; \
+ ${FIND} ${WRKSRC} -name "configure" -type f | ${XARGS} ${REINPLACE_CMD} -e \
+ 's|DATADIRNAME=lib|DATADIRNAME=share|g ; \
+ s|{libdir}/locale|{prefix}/share/locale|g'
+
+.endif
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 5d71ce5..7d8b891 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1153,6 +1153,7 @@ DISTDIR?= ${PORTSDIR}/distfiles
_DISTDIR?= ${DISTDIR}/${DIST_SUBDIR}
INDEXDIR?= ${PORTSDIR}
SRC_BASE?= /usr/src
+USESDIR?= ${PORTSDIR}/Mk/Uses
.include "${PORTSDIR}/Mk/bsd.commands.mk"
@@ -1544,6 +1545,15 @@ check-makefile::
_POSTMKINCLUDED= yes
+# Loading features
+.for f in ${USES}
+_f=${f:C/\:.*//g}
+.if ${_f} != ${f}
+${_f}_ARGS:= ${f:C/^[^\:]*\://g}
+.endif
+.include "${USESDIR}/${_f}.mk"
+.endfor
+
WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work
.if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB)
WRKSRC?= ${WRKDIR}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT}
OpenPOWER on IntegriCloud