diff options
author | mm <mm@FreeBSD.org> | 2011-06-22 16:53:29 +0800 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2011-06-22 16:53:29 +0800 |
commit | 7314ea497e25ae138adedd3b94064706d37a09bf (patch) | |
tree | a00bf4f2a859b75fe0a53845626f928c4ebf911e /devel | |
parent | 8e38f7fab644ad7d7735bd65538b23d0fe9dc82e (diff) | |
download | freebsd-ports-gnome-7314ea497e25ae138adedd3b94064706d37a09bf.tar.gz freebsd-ports-gnome-7314ea497e25ae138adedd3b94064706d37a09bf.tar.zst freebsd-ports-gnome-7314ea497e25ae138adedd3b94064706d37a09bf.zip |
Add support for channels and automatic plist generation to bsd.pear.mk
PR: ports/157269
Approved by: maintainer (timeout)
Diffstat (limited to 'devel')
-rw-r--r-- | devel/pear/bsd.pear.mk | 48 | ||||
-rw-r--r-- | devel/pear/pear-deinstall | 15 | ||||
-rw-r--r-- | devel/pear/pear-deinstall.in | 21 |
3 files changed, 67 insertions, 17 deletions
diff --git a/devel/pear/bsd.pear.mk b/devel/pear/bsd.pear.mk index 7f066c4e20b1..263aab4e44a1 100644 --- a/devel/pear/bsd.pear.mk +++ b/devel/pear/bsd.pear.mk @@ -25,11 +25,19 @@ PEARWRKSRC?= ${WRKSRC} NO_BUILD= yes .endif +.if defined(PEAR_CHANNEL) && ${PEAR_CHANNEL} != "" +PKGNAMEPREFIX= pear-${PEAR_CHANNEL}- +PEARPKGREF= ${PEAR_CHANNEL}/${PORTNAME} +.else +PEARPKGREF= ${PORTNAME} +.endif + .if exists(${LOCALBASE}/bin/php-config) PHP_BASE!= ${LOCALBASE}/bin/php-config --prefix .else PHP_BASE= ${LOCALBASE} .endif +PEAR= ${LOCALBASE}/bin/pear LPEARDIR= share/pear LPKGREGDIR= ${LPEARDIR}/packages/${PKGNAME} LDATADIR= ${LPEARDIR}/data/${PORTNAME} @@ -53,6 +61,8 @@ LINSTDIR= ${LPEARDIR} .endif INSTDIR= ${PHP_BASE}/${LINSTDIR} +SUB_LIST+= PEAR_CHANNEL=${PEAR_CHANNEL} + .if !defined(USE_PHPIZE) && !exists(${.CURDIR}/pkg-plist) PLIST= ${WRKDIR}/PLIST .endif @@ -61,7 +71,7 @@ PLIST_SUB+= PEARDIR=${LPEARDIR} PKGREGDIR=${LPKGREGDIR} \ SCRIPTFILESDIR=${LCRIPTSDIR} PKGINSTALL?= ${PORTSDIR}/devel/pear/pear-install -PKGDEINSTALL?= ${PORTSDIR}/devel/pear/pear-deinstall +PKGDEINSTALL?= ${WRKDIR}/pear-deinstall FILES?= DATA?= @@ -167,9 +177,38 @@ do-install-${t}-msg: .USE . endif . endfor -pre-install: do-generate-plist +do-autogenerate-plist: + @${ECHO_MSG} "===> Verifying plist for PREFIX" + @FILES=`${PEAR} list-files ${WRKDIR}/package.xml | ${TAIL} +4 | \ + ${AWK} '{ print $$2 }' | ${GREP} -v -E "^${PREFIX}/"` || exit 0; \ + if ${TEST} -n "$${FILES}"; then \ + echo "Package files outside PREFIX, cannot use autoinstall ..."; \ + exit 1; fi; + @${ECHO_MSG} "===> Generating packing list with pear" + @${ECHO_CMD} "${LPKGREGDIR}/package.xml" > ${PLIST} + @FILES=`${PEAR} list-files ${WRKDIR}/package.xml | ${TAIL} +4 | \ + ${AWK} '{ print $$2 }' | ${SED} -e "s|${PREFIX}/||g"`; \ + for f in $${FILES}; do ${ECHO_CMD} $${f} >> ${PLIST}; done; \ + for d in $${FILES}; do ${ECHO_CMD} $${d}; done | ${DIRFILTER} | \ + while read dir; do ${ECHO_CMD} "@dirrmtry $${dir}" >> ${PLIST}; \ + done; + @${ECHO_CMD} "@dirrm ${LPKGREGDIR}" >> ${PLIST} + @${ECHO_CMD} "@dirrmtry ${LPKGREGDIR:H}" >> ${PLIST} + +. if defined(PEAR_AUTOINSTALL) +pre-install: do-autogenerate-plist do-generate-deinstall-script +do-install: do-auto-install + +. else +pre-install: do-generate-plist do-generate-deinstall-script do-install: do-install-files do-install-docs do-install-tests do-install-sqls \ do-install-scriptfiles do-install-examples do-install-data +. endif + +do-auto-install: + @${ECHO_MSG} "===> Installing package with pear" + @${LN} -sf ${WRKDIR}/package.xml ${WRKSRC}/package.xml + @cd ${WRKSRC} && ${PEAR} install -n -f package.xml do-install-files: do-install-files-msg @${MKDIR} ${INSTDIR} @@ -253,8 +292,13 @@ do-install-examples: do-install-examples-msg . endif .endif +do-generate-deinstall-script: + @${SED} ${_SUB_LIST_TEMP} -e '/^@comment /d' ${PORTSDIR}/devel/pear/pear-deinstall.in > ${WRKDIR}/pear-deinstall + post-install: @${MKDIR} ${PKGREGDIR} @${INSTALL_DATA} ${WRKDIR}/package.xml ${PKGREGDIR} +.if !defined(PEAR_AUTOINSTALL) @${SETENV} PKG_PREFIX=${PREFIX} \ ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL +.endif diff --git a/devel/pear/pear-deinstall b/devel/pear/pear-deinstall deleted file mode 100644 index 39672a7cb577..000000000000 --- a/devel/pear/pear-deinstall +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# -# Remove package declaration from PEAR's registry. - -if [ x$2 != xDEINSTALL ]; then - exit -fi -PKG_NAME=${1%%-[0-9._]*} -PACKAGE=$(echo $PKG_NAME | sed 's/pear-//') - -PEAR=${PKG_PREFIX}/bin/pear - -${PEAR} uninstall -r -n ${PACKAGE} || true diff --git a/devel/pear/pear-deinstall.in b/devel/pear/pear-deinstall.in new file mode 100644 index 000000000000..de1886f48c4a --- /dev/null +++ b/devel/pear/pear-deinstall.in @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Remove package declaration from PEAR's registry. + +if [ x$2 != xDEINSTALL ]; then + exit +fi + +PKG_NAME=${1%%-[0-9._]*} +CHANNEL=%%PEAR_CHANNEL%% +PEAR=${PKG_PREFIX}/bin/pear + +if [ -z "$CHANNEL" ]; then + PACKAGE=$(echo $PKG_NAME | sed "s/pear-//") + ${PEAR} uninstall -r -n ${PACKAGE} || true +else + PACKAGE=$(echo $PKG_NAME | sed "s/pear-${CHANNEL}-//") + ${PEAR} uninstall -r -n ${CHANNEL}/${PACKAGE} || true +fi |