ports/126626: [patch] www/squidguard - improve Makefile
Edwin Groothuis
edwin at FreeBSD.org
Mon Aug 18 13:40:04 UTC 2008
>Number: 126626
>Category: ports
>Synopsis: [patch] www/squidguard - improve Makefile
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Aug 18 13:40:04 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Edwin Groothuis
>Release: FreeBSD 7.0-RELEASE-p1 i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 7.0-RELEASE-p1 FreeBSD 7.0-RELEASE-p1 #2: Wed May 28 08:12:56 EST 2008 edwin at k7.mavetju:/usr/src/sys/i386/compile/k7 i386
>Description:
Redo Makefile:
- split pre-install in post-build with regarding to extracting of blacklists.
- Make targets easier to read.
- Merge pkg-plist and pkg-plist.blacklist and use PLIST_SUB.
- Add files/pkg-message.in
>How-To-Repeat:
>Fix:
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/www/squidguard/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- Makefile 18 Aug 2008 06:58:12 -0000 1.17
+++ Makefile 18 Aug 2008 13:31:10 -0000
@@ -30,10 +30,22 @@
SQUID_GID?= squid
DATADIR?= /var/db/${PORTNAME}
+_DATADIR= ${WRKDIR}/data
LOGDIR?= /var/log
-PLIST:= ${WRKDIR}/PLIST
-PLIST_SUB= DATADIR=${DATADIR}
+SUB_FILES= pkg-message
+SUB_LIST= PORTNAME=${PORTNAME}
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
+.include <bsd.port.pre.mk>
+
+.if !exists(${DATADIR})
+PLIST_SUB+= BLACKLIST=""
+INSTALL_BL= yes
+.else
+PLIST_SUB+= BLACKLIST="@comment "
+INSTALL_BL= no
+.endif
pre-fetch:
@if [ ${SQUID_UID} = "squid" -o ${SQUID_GID} = "squid" ] ; then \
@@ -50,31 +62,39 @@
${WRKSRC}/configure ; \
fi
-pre-install:
- @${CP} ${PKGDIR}/pkg-plist ${PLIST}
-
-### Install blacklists
+post-build:
+.if ${INSTALL_BL} == "yes"
+ @${ECHO_MSG} "===> Building blacklists"
+ ${MKDIR} ${_DATADIR}
+ @${TAR} -C ${_DATADIR} --exclude *.diff -pxzf \
+ ${WRKSRC}/samples/dest/blacklists.tar.gz
+ @${MV} -f ${_DATADIR}/blacklists/README ${WRKDIR}/README.blacklists
+ @${MV} -f ${_DATADIR}/blacklists/* ${_DATADIR}/
+ @${RM} -r ${_DATADIR}/blacklists
+ @${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${_DATADIR}
+.endif
-.if !exists(${DATADIR})
+pre-install:
+#
+# Install blacklists
+#
+.if ${INSTALL_BL} == "yes"
@${ECHO_MSG} "===> Installing blacklists"
@${MKDIR} ${DATADIR}
- @${TAR} -C ${DATADIR} --exclude *.diff -pxzf ${WRKSRC}/samples/dest/blacklists.tar.gz
- @${MV} -f ${DATADIR}/blacklists/README ${WRKDIR}/README.blacklists
- @${MV} -f ${DATADIR}/blacklists/* ${DATADIR}/
- @${RM} -r ${DATADIR}/blacklists
- @${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${DATADIR}
+ @${CP} -Rpf ${_DATADIR}/* ${DATADIR}/
@${CHMOD} -R 550 ${DATADIR}
- @${CAT} ${PKGDIR}/pkg-plist.blacklist >> ${PLIST}
@${ECHO_MSG} " -> Blacklists installed in: ${DATADIR}"
.else
@${ECHO_MSG} "===> Found existing datadirectory - skipping blacklist installation"
.endif
-### Create sample configuration file
-
+#
+# Create sample configuration file
+#
@if [ ! -f "${PREFIX}/etc/squid/${PORTNAME}.conf" ] ; then \
${ECHO_MSG} "===> Installing sample configuration file" ; \
- BLACKLIST_DIRS=`(cd ${DATADIR} && ${FIND} . -type d | ${SED} '/^\.$$/d; s/^\.\//!/' | ${XARGS} ${ECHO_CMD})`; \
+ BLACKLIST_DIRS=`(cd ${DATADIR} && ${FIND} . -type d | \
+ ${SED} '/^\.$$/d; s/^\.\//!/' | ${XARGS} ${ECHO_CMD})`; \
for I in `${ECHO_CMD} $${BLACKLIST_DIRS} | ${SED} 's/!//g'`; do \
${ECHO_CMD} "dest $${I} {"; \
${TEST} -f ${DATADIR}/$${I}/domains && \
@@ -85,33 +105,38 @@
${ECHO_CMD} " expressionlist $${I}/expressions"; \
${ECHO_CMD} "}"; \
done > ${WRKDIR}/${PORTNAME}.conf.dests ; \
- ${SED} "s|DATADIR|${DATADIR}|;s|LOGDIR|${LOGDIR}|;s|BLACKLIST_DIRS|$${BLACKLIST_DIRS}|;/DEST_CLASSES/r ${WRKDIR}/${PORTNAME}.conf.dests" \
+ ${SED} -e "s|DATADIR|${DATADIR}|" -e "s|LOGDIR|${LOGDIR}|" \
+ -e "s|BLACKLIST_DIRS|$${BLACKLIST_DIRS}|;" \
+ -e "/DEST_CLASSES/r ${WRKDIR}/${PORTNAME}.conf.dests" \
${CFGINPUT} | \
${SED} "/DEST_CLASSES/d" > \
${PREFIX}/etc/squid/${PORTNAME}.conf.sample ; \
- ${CHOWN} ${SQUID_UID}:${SQUID_GID} ${PREFIX}/etc/squid/${PORTNAME}.conf.sample ; \
+ ${CHOWN} ${SQUID_UID}:${SQUID_GID} \
+ ${PREFIX}/etc/squid/${PORTNAME}.conf.sample ; \
${ECHO_MSG} " -> Sample configuration file installed in: ${PREFIX}/etc/squid" ; \
else \
${ECHO_MSG} "===> Existing configuration file found - sample not installed" ; \
fi
-### Create blacklist databases (assume fresh install if we only have a sample config)
-
- @if [ ! -f "${PREFIX}/etc/squid/${PORTNAME}.conf" -a \
- -f "${PREFIX}/etc/squid/${PORTNAME}.conf.sample" ] ; then \
- ${ECHO_MSG} "===> Creating blacklist databases" ; \
- ${WRKSRC}/src/${PORTNAME} -d -c ${PREFIX}/etc/squid/${PORTNAME}.conf.sample -C all ; \
- ${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${DATADIR} ; \
- ${FIND} ${DATADIR} -type f -name *.db -exec ${CHMOD} 660 {} \; ; \
- ${ECHO_MSG} " -> Blacklist databases installed in: ${DATADIR}" ; \
- else \
- ${ECHO_MSG} "===> Existing configuration file found - blacklist databases not created" ; \
- fi
+#
+# Create blacklist databases (assume fresh install if we only have a
+# sample config)
+#
+.if ${INSTALL_BL} == "yes"
+ @${ECHO_MSG} "===> Creating blacklist databases" ; \
+ ${WRKSRC}/src/${PORTNAME} -d -c \
+ ${PREFIX}/etc/squid/${PORTNAME}.conf.sample -C all ; \
+ ${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${DATADIR} ; \
+ ${FIND} ${DATADIR} -type f -name *.db -exec ${CHMOD} 660 {} \; ; \
+ ${ECHO_MSG} " -> Blacklist databases installed in: ${DATADIR}"
+.else
+ ${ECHO_MSG} "===> Existing configuration file found - blacklist databases not created"
+.endif
post-install:
-
-### Install documentation
-
+#
+# Install documentation
+#
.if !defined(NOPORTDOCS)
@${ECHO_MSG} "===> Installing ${PORTNAME} documentation"
-@${MKDIR} ${DOCSDIR}
@@ -129,16 +154,6 @@
@${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${LOGDIR}
.endif
-### View short howto message
-
- @${ECHO_MSG} " "
- @${ECHO_MSG} "==================================================================="
- @${ECHO_MSG} "= In order to activate ${PORTNAME} you have to edit squid.conf"
- @${ECHO_MSG} "= To the contain \"url_rewrite_program ${PREFIX}/bin/${PORTNAME}\""
- @${ECHO_MSG} "= and create a configuration file for ${PORTNAME}."
- @${ECHO_MSG} "="
- @${ECHO_MSG} "= To activate the changes do a ${PREFIX}/sbin/squid -k reconfigure"
- @${ECHO_MSG} "==================================================================="
- @${ECHO_MSG} " "
+ @${CAT} ${PKGMESSAGE}
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/www/squidguard/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- pkg-plist 29 Mar 2008 05:32:13 -0000 1.3
+++ pkg-plist 18 Aug 2008 13:31:10 -0000
@@ -1,19 +1,80 @@
bin/squidGuard
-share/doc/squidGuard/LDAPFlow.txt
-share/doc/squidGuard/README
-share/doc/squidGuard/configuration.html
-share/doc/squidGuard/configuration.txt
-share/doc/squidGuard/configure.html
-share/doc/squidGuard/configure.txt
-share/doc/squidGuard/extended.html
-share/doc/squidGuard/extended.txt
-share/doc/squidGuard/faq.html
-share/doc/squidGuard/faq.txt
-share/doc/squidGuard/index.html
-share/doc/squidGuard/install.html
-share/doc/squidGuard/install.txt
-share/doc/squidGuard/installation.html
-share/doc/squidGuard/installation.txt
-share/doc/squidGuard/squidGuard.gif
etc/squid/squidGuard.conf.sample
- at dirrm share/doc/squidGuard
+ at dirrm squidGuard
+%%PORTDOCS%%%%DOCSDIR%%/LDAPFlow.txt
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/configuration.html
+%%PORTDOCS%%%%DOCSDIR%%/configuration.txt
+%%PORTDOCS%%%%DOCSDIR%%/configure.html
+%%PORTDOCS%%%%DOCSDIR%%/configure.txt
+%%PORTDOCS%%%%DOCSDIR%%/extended.html
+%%PORTDOCS%%%%DOCSDIR%%/extended.txt
+%%PORTDOCS%%%%DOCSDIR%%/faq.html
+%%PORTDOCS%%%%DOCSDIR%%/faq.txt
+%%PORTDOCS%%%%DOCSDIR%%/index.html
+%%PORTDOCS%%%%DOCSDIR%%/install.html
+%%PORTDOCS%%%%DOCSDIR%%/install.txt
+%%PORTDOCS%%%%DOCSDIR%%/installation.html
+%%PORTDOCS%%%%DOCSDIR%%/installation.txt
+%%PORTDOCS%%%%DOCSDIR%%/squidGuard.gif
+%%PORTDOCS%%%%DOCSDIR%%/README.blacklists
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+
+%%BLACKLIST%%@cwd %%DATADIR%%
+%%BLACKLIST%%ads/domains
+%%BLACKLIST%%ads/domains.db
+%%BLACKLIST%%ads/urls
+%%BLACKLIST%%ads/urls.db
+%%BLACKLIST%%aggressive/domains
+%%BLACKLIST%%aggressive/domains.db
+%%BLACKLIST%%aggressive/urls
+%%BLACKLIST%%aggressive/urls.db
+%%BLACKLIST%%audio-video/domains
+%%BLACKLIST%%audio-video/domains.db
+%%BLACKLIST%%audio-video/urls
+%%BLACKLIST%%audio-video/urls.db
+%%BLACKLIST%%drugs/domains
+%%BLACKLIST%%drugs/domains.db
+%%BLACKLIST%%drugs/urls
+%%BLACKLIST%%drugs/urls.db
+%%BLACKLIST%%gambling/domains
+%%BLACKLIST%%gambling/domains.db
+%%BLACKLIST%%gambling/urls
+%%BLACKLIST%%gambling/urls.db
+%%BLACKLIST%%hacking/domains
+%%BLACKLIST%%hacking/domains.db
+%%BLACKLIST%%hacking/urls
+%%BLACKLIST%%hacking/urls.db
+%%BLACKLIST%%mail/domains
+%%BLACKLIST%%mail/domains.db
+%%BLACKLIST%%porn/domains
+%%BLACKLIST%%porn/domains.db
+%%BLACKLIST%%porn/urls
+%%BLACKLIST%%porn/urls.db
+%%BLACKLIST%%porn/expressions
+%%BLACKLIST%%proxy/domains
+%%BLACKLIST%%proxy/domains.db
+%%BLACKLIST%%proxy/urls
+%%BLACKLIST%%proxy/urls.db
+%%BLACKLIST%%violence/domains
+%%BLACKLIST%%violence/domains.db
+%%BLACKLIST%%violence/urls
+%%BLACKLIST%%violence/urls.db
+%%BLACKLIST%%violence/expressions
+%%BLACKLIST%%warez/domains
+%%BLACKLIST%%warez/domains.db
+%%BLACKLIST%%warez/urls
+%%BLACKLIST%%warez/urls.db
+%%BLACKLIST%%@dirrm ads
+%%BLACKLIST%%@dirrm aggressive
+%%BLACKLIST%%@dirrm audio-video
+%%BLACKLIST%%@dirrm drugs
+%%BLACKLIST%%@dirrm gambling
+%%BLACKLIST%%@dirrm hacking
+%%BLACKLIST%%@dirrm mail
+%%BLACKLIST%%@dirrm porn
+%%BLACKLIST%%@dirrm proxy
+%%BLACKLIST%%@dirrm violence
+%%BLACKLIST%%@dirrm warez
+%%BLACKLIST%%@cwd /
+%%BLACKLIST%%@dirrm %%DATADIR%%
Index: pkg-plist.blacklist
===================================================================
RCS file: pkg-plist.blacklist
diff -N pkg-plist.blacklist
--- pkg-plist.blacklist 9 Feb 2002 16:39:40 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,58 +0,0 @@
- at cwd %%DATADIR%%
-ads/domains
-ads/domains.db
-ads/urls
-ads/urls.db
-aggressive/domains
-aggressive/domains.db
-aggressive/urls
-aggressive/urls.db
-audio-video/domains
-audio-video/domains.db
-audio-video/urls
-audio-video/urls.db
-drugs/domains
-drugs/domains.db
-drugs/urls
-drugs/urls.db
-gambling/domains
-gambling/domains.db
-gambling/urls
-gambling/urls.db
-hacking/domains
-hacking/domains.db
-hacking/urls
-hacking/urls.db
-mail/domains
-mail/domains.db
-porn/domains
-porn/domains.db
-porn/urls
-porn/urls.db
-porn/expressions
-proxy/domains
-proxy/domains.db
-proxy/urls
-proxy/urls.db
-violence/domains
-violence/domains.db
-violence/urls
-violence/urls.db
-violence/expressions
-warez/domains
-warez/domains.db
-warez/urls
-warez/urls.db
- at dirrm ads
- at dirrm aggressive
- at dirrm audio-video
- at dirrm drugs
- at dirrm gambling
- at dirrm hacking
- at dirrm mail
- at dirrm porn
- at dirrm proxy
- at dirrm violence
- at dirrm warez
- at cwd /
- at dirrm %%DATADIR%%
Index: files/pkg-message.in
===================================================================
RCS file: files/pkg-message.in
diff -N files/pkg-message.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/pkg-message.in 18 Aug 2008 13:31:10 -0000
@@ -0,0 +1,7 @@
+===================================================================
+= In order to activate %%PORTNAME%% you have to edit squid.conf
+= To the contain "url_rewrite_program %%PREFIX%%/bin/%%PORTNAME%%"
+= and create a configuration file for %%PORTNAME%%.
+=
+= To activate the changes do a %%PREFIX%%/sbin/squid -k reconfigure
+===================================================================
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list