From e90080ca9a427a5264fb6298cfac410f133ff1f0 Mon Sep 17 00:00:00 2001 From: Steve Wills Date: Sun, 25 May 2014 12:23:00 +0000 Subject: [PATCH] - Add STAGE support - Depend on xmlto to generate man pages. Add DOCS option PR: ports/189787 Submitted by: "Mikhail T." (maintainer) --- databases/pgbouncer/Makefile | 49 ++++++++++------------ databases/pgbouncer/files/pkg-deinstall.in | 21 ---------- databases/pgbouncer/files/pkg-install.in | 26 ------------ databases/pgbouncer/pkg-plist | 14 +++++-- 4 files changed, 31 insertions(+), 79 deletions(-) delete mode 100644 databases/pgbouncer/files/pkg-deinstall.in delete mode 100644 databases/pgbouncer/files/pkg-install.in diff --git a/databases/pgbouncer/Makefile b/databases/pgbouncer/Makefile index ae17119086cf..bb2cab5df6d2 100644 --- a/databases/pgbouncer/Makefile +++ b/databases/pgbouncer/Makefile @@ -10,34 +10,32 @@ MASTER_SITES= http://pgfoundry.org/frs/download.php/3393/ MAINTAINER= m.tsatsenko@gmail.com COMMENT= Lightweight connection pooler for PostgreSQL -LICENSE= BSD +LICENSE= BSD2CLAUSE LIB_DEPENDS= libevent-2.0.so:${PORTSDIR}/devel/libevent2 +OPTIONS_DEFINE= DOCS + +.include + +.if ${PORT_OPTIONS:MDOCS} +BUILD_DEPENDS+= xmlto:${PORTSDIR}/textproc/xmlto +.endif + PORTSCOUT= site:http://pgfoundry.org/frs/?group_id=1000258 USERS= pgbouncer GROUPS= pgbouncer USE_RC_SUBR= pgbouncer -SUB_FILES= pkg-message pkg-install pkg-deinstall GNU_CONFIGURE= yes -USE_GMAKE= yes - -.if ! defined(NO_INSTALL_MANPAGES) -MAN1= pgbouncer.1 -MAN5= pgbouncer.5 -.endif +USES= gmake CONFIGURE_ARGS= --with-libevent=${LOCALBASE} --enable-evdns CONFIGURE_ENV+= PTHREAD_CFLAGS=${PTHREAD_CFLAGS} \ PTHREAD_LIBS=${PTHREAD_LIBS} -PKGINSTALL= ${WRKDIR}/pkg-install -PKGDEINSTALL= ${WRKDIR}/pkg-deinstall -PKGMESSAGE= ${WRKDIR}/pkg-message - PGBOUNCER_USER?= pgbouncer PGBOUNCER_GROUP?= pgbouncer @@ -46,14 +44,12 @@ PGBOUNCER_LOGDIR?= /var/log/pgbouncer BUILD_DEPENDS+= ${LOCALBASE}/bin/gsed:${PORTSDIR}/textproc/gsed -NO_STAGE= yes .include SUB_LIST+= PGBOUNCER_USER="${USERS}" \ PGBOUNCER_GROUP="${GROUPS}" \ PGBOUNCER_LOGDIR="${PGBOUNCER_LOGDIR}" \ - PGBOUNCER_RUNDIR="${PGBOUNCER_RUNDIR}" \ - CHMOD="${CHMOD}" CHOWN="${CHOWN}" MKDIR="${MKDIR}" PW="${PW}" + PGBOUNCER_RUNDIR="${PGBOUNCER_RUNDIR}" post-patch: @${REINPLACE_CMD} -e "s|= pgbouncer.log|= ${PGBOUNCER_LOGDIR}/pgbouncer.log|g" \ @@ -62,20 +58,17 @@ post-patch: @${REINPLACE_CMD} -e "s|sed -n|${LOCALBASE}/bin/gsed -n|g" \ ${WRKSRC}/lib/find_modules.sh -do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/pgbouncer ${PREFIX}/bin/ -.if ! defined(NO_INSTALL_MANPAGES) - ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.1 ${PREFIX}/man/man1/ - ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.5 ${PREFIX}/man/man5/ +.if empty(PORT_OPTIONS:MDOCS) + ${REINPLACE_CMD} -e "s| = doc| = |g" ${WRKSRC}/Makefile .endif - ${INSTALL_DATA} ${WRKSRC}/etc/pgbouncer.ini ${PREFIX}/etc/pgbouncer.ini.sample - ${INSTALL_DATA} ${WRKSRC}/etc/userlist.txt ${PREFIX}/etc/pgbouncer.users.sample -post-install: - @if [ ! -f ${PREFIX}/etc/pgbouncer.ini ]; then \ - ${CP} -p ${PREFIX}/etc/pgbouncer.ini.sample ${PREFIX}/etc/pgbouncer.ini ; \ - fi - @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL - @${CAT} ${PKGMESSAGE} +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/pgbouncer ${STAGEDIR}${PREFIX}/bin/ +.if ${PORT_OPTIONS:MDOCS} + ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.1 ${STAGEDIR}${PREFIX}/man/man1/ + ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.5 ${STAGEDIR}${PREFIX}/man/man5/ +.endif + ${INSTALL_DATA} ${WRKSRC}/etc/pgbouncer.ini ${STAGEDIR}${PREFIX}/etc/pgbouncer.ini.sample + ${INSTALL_DATA} ${WRKSRC}/etc/userlist.txt ${STAGEDIR}${PREFIX}/etc/pgbouncer.users.sample .include diff --git a/databases/pgbouncer/files/pkg-deinstall.in b/databases/pgbouncer/files/pkg-deinstall.in deleted file mode 100644 index f117735996a2..000000000000 --- a/databases/pgbouncer/files/pkg-deinstall.in +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh -# $FreeBSD$ - -if [ "$2" != "POST-DEINSTALL" ]; then - exit 0 -fi - -pgbouncer_user=%%PGBOUNCER_USER%% -pgbouncer_group=%%PGBOUNCER_GROUP%% - -PGBOUNCER_RUNDIR=%%PGBOUNCER_RUNDIR%% -PGBOUNCER_LOGDIR=%%PGBOUNCER_LOGDIR%% - -PW="%%PW%%" - -for DIR in ${PGBOUNCER_RUNDIR} ${PGBOUNCER_LOGDIR}; do - if test -d "${DIR}"; then - echo "==> You should manually remove the directory: ${DIR}" - fi -done -exit 0 diff --git a/databases/pgbouncer/files/pkg-install.in b/databases/pgbouncer/files/pkg-install.in deleted file mode 100644 index d433210fb81e..000000000000 --- a/databases/pgbouncer/files/pkg-install.in +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh -# $FreeBSD$ - -if [ "$2" != "POST-INSTALL" ]; then - exit 0 -fi - -pgbouncer_user="%%PGBOUNCER_USER%%" -pgbouncer_group="%%PGBOUNCER_GROUP%%" - -PGBOUNCER_RUNDIR="%%PGBOUNCER_RUNDIR%%" -PGBOUNCER_LOGDIR="%%PGBOUNCER_LOGDIR%%" - -CHMOD="%%CHMOD%%" -CHOWN="%%CHOWN%%" -MKDIR="%%MKDIR%%" -PW=%%PW%% - -for DIR in ${PGBOUNCER_RUNDIR} ${PGBOUNCER_LOGDIR}; do - echo "==> Creating directory ${DIR}" - ${MKDIR} ${DIR} - echo "==> Changing ownership of ${DIR}" - ${CHOWN} -R ${pgbouncer_user}:${pgbouncer_group} ${DIR} - echo "==> Changing permissions of ${DIR}" - ${CHMOD} -R 770 ${DIR} -done diff --git a/databases/pgbouncer/pkg-plist b/databases/pgbouncer/pkg-plist index b4127b2fecf2..77fbce87e276 100644 --- a/databases/pgbouncer/pkg-plist +++ b/databases/pgbouncer/pkg-plist @@ -1,5 +1,11 @@ bin/pgbouncer -@unexec if cmp -s %D/etc/pgbouncer.ini %D/etc/pgbouncer.ini.sample; then rm -f %D/etc/pgbouncer.ini; fi -etc/pgbouncer.ini.sample -@exec [ -f %B/pgbouncer.ini ] || cp %B/%f %B/pgbouncer.ini -etc/pgbouncer.users.sample +man/man1/pgbouncer.1.gz +man/man5/pgbouncer.5.gz +@sample etc/pgbouncer.ini.sample +@sample etc/pgbouncer.users.sample +@exec [ -d %%PGBOUNCER_LOGDIR%% ] || mkdir -p %%PGBOUNCER_LOGDIR%% +@exec chown %%PGBOUNCER_USER%%:%%PGBOUNCER_GROUP%% %%PGBOUNCER_LOGDIR%% +@unexec if [ -z ${UPGRADE_PORT} ] ; then rmdir %%PGBOUNCER_LOGDIR%% 2>/dev/null; fi +@exec [ -d %%PGBOUNCER_RUNDIR%% ] || mkdir -p %%PGBOUNCER_RUNDIR%% +@exec chown %%PGBOUNCER_USER%%:%%PGBOUNCER_GROUP%% %%PGBOUNCER_RUNDIR%% +@unexec if [ -z ${UPGRADE_PORT} ] ; then rmdir %%PGBOUNCER_RUNDIR%% 2>/dev/null; fi