From 60001306c379d81bf9d2a62ded5df2f3a26a3381 Mon Sep 17 00:00:00 2001 From: bapt Date: Wed, 6 Mar 2013 14:28:57 +0000 Subject: 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... --- Mk/Uses/pathfix.mk | 26 ++++++++++++++++++++++++++ Mk/bsd.port.mk | 10 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Mk/Uses/pathfix.mk diff --git a/Mk/Uses/pathfix.mk b/Mk/Uses/pathfix.mk new file mode 100644 index 000000000000..37df6cfa9ae4 --- /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 5d71ce564e79..7d8b8919fec7 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} -- cgit