From 838db6befea221431a8d349e919217241613689c Mon Sep 17 00:00:00 2001
From: Clive Lin <clive@FreeBSD.org>
Date: Tue, 2 Jan 2001 23:16:11 +0000
Subject: o Hornor ${PREFIX} more o Really install its tiny search scripts o
 Build package with or without apache installed (hacky hacky) o Fix
 pkg-message, tell users to copy bk2site *.gif and *.pl manually   when build
 without apache or install via package o Hide perlre in post-patch target,
 which looks like "Panic ! Help !" o Remove patch file. (Now handled simply by
 perlre) o Shorten pkg-comment (portlint doesn't like the longer one) o Bump
 PORTREVISION

For systems with apache installed, now it's
ready-to-run-without-manually-doing-anything.
---
 www/bk2site/Makefile    | 34 +++++++++++++++++++++++++++++++---
 www/bk2site/pkg-comment |  2 +-
 www/bk2site/pkg-message | 23 +++++++++++++----------
 www/bk2site/pkg-plist   | 34 ++++++++++++++++++++--------------
 4 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/www/bk2site/Makefile b/www/bk2site/Makefile
index 5e33475015d2..422837dd2847 100644
--- a/www/bk2site/Makefile
+++ b/www/bk2site/Makefile
@@ -8,25 +8,53 @@
 
 PORTNAME=	bk2site
 PORTVERSION=	1.1.6
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
 
 MAINTAINER=	clive@FreeBSD.org
 
+.include <bsd.port.pre.mk>
+APXS=		${LOCALBASE}/sbin/apxs
+.if exists(${APXS})
+RUN_DEPENDS=	${LOCALBASE}/sbin/apxs:${PORTSDIR}/www/apache13
+
+# Specify these directories in relative paths to ${PREFIX}.
+.if !exists(${PREFIX}/www) && exists(${PREFIX}/share/apache)
+CGIDIR?=	share/apache/cgi-bin
+ICONSDIR?=	share/apache/icons
+.else
+CGIDIR?=	www/cgi-bin/${PORTNAME}
+ICONSDIR?=	www/icons/${PORTNAME}
+.endif
+
+.else # No apache installed.
+CGIDIR?=	share/${PORTNAME}
+ICONSDIR?=	share/${PORTNAME}
+.endif
+
 MAN1=		bk2site.1
 USE_GMAKE=	yes
 
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--prefix="${PREFIX}" --enable-standard-datadir
 
+PLIST_SUB=	CGIDIR="${CGIDIR}" ICONSDIR="${ICONSDIR}"
+
 post-patch:
-	${PERL} -pi -e 's,%%PREFIX%%,${PREFIX},' ${WRKSRC}/dot.bk2siterc
+	@${PERL} -pi -e 's,/etc/bk2site,${PREFIX}/etc/bk2site,' \
+	${WRKSRC}/dot.bk2siterc ${WRKSRC}/search.pl ${WRKSRC}/bk2site.1 \
+	${WRKSRC}/bk2site.html
+	@${PERL} -pi -e 's,/icons/,/icons/bk2site/,' ${WRKSRC}/*
 
 post-install:
 	${MKDIR} ${PREFIX}/etc/${PORTNAME}
+	${MKDIR} ${PREFIX}/${ICONSDIR}
+	${MKDIR} ${PREFIX}/${CGIDIR}
 	${CP} ${WRKSRC}/*.html ${PREFIX}/etc/${PORTNAME}
-	${CP} ${WRKSRC}/*.gif ${PREFIX}/share/${PORTNAME}
+	${CP} ${WRKSRC}/*.gif ${PREFIX}/${ICONSDIR}
+	${CP} ${WRKSRC}/*.pl ${PREFIX}/${CGIDIR}
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/www/bk2site/pkg-comment b/www/bk2site/pkg-comment
index 9fcf07b3cd30..9774630af6cd 100644
--- a/www/bk2site/pkg-comment
+++ b/www/bk2site/pkg-comment
@@ -1 +1 @@
-Transforms Netscape bookmarks into a Yahoo-like website with slashdot-like news
+Transforms Netscape bookmarks into a Yahoo-like website
diff --git a/www/bk2site/pkg-message b/www/bk2site/pkg-message
index 9463fc86f705..612e5a2fb50d 100644
--- a/www/bk2site/pkg-message
+++ b/www/bk2site/pkg-message
@@ -1,10 +1,13 @@
-*==========================================================================*
-| Bk2site would look for your ~/.netscape/bookmarks.html and convert it to |
-| your ~/public_html/bk2site as Yahoo-like web site !                      |
-|                                                                          |
-| !! Don't forget manually copy ${PREFIX}/share/bk2site/*.gif into icons/  |
-| directory related with your web root directory.                          |
-|                                                                          |
-| !! If you want to search your Yahoo-like web just like Yahoo!, copy *.pl |
-| into cgi-bin/ directory related with your web root directory             |
-*==========================================================================*
+========================================================================
+o You have to create ~/public_html/bk2site MANUALLY before using bk2site.
+o Example ~/.bk2siterc is at ${PREFIX}/share/bk2site/dot.bk2siterc.
+
+o If you install bk2site without apache installed, or via package, you
+  have to do these 2 things manually:
+
+  1) Copy ${PREFIX}/share/bk2site/*.gif into icons/bk2site directory
+     related with your web root directory.
+
+  2) Copy ${PREFIX}/share/bk2site/*.pl into cgi-bin/bk2site directory
+     related with your web root directory.
+========================================================================
diff --git a/www/bk2site/pkg-plist b/www/bk2site/pkg-plist
index 7db324a3dcef..f0fad1a0dc25 100644
--- a/www/bk2site/pkg-plist
+++ b/www/bk2site/pkg-plist
@@ -5,18 +5,24 @@ etc/bk2site/newbase.html
 etc/bk2site/indexbase.html
 etc/bk2site/bk2site.html
 share/bk2site/dot.bk2siterc
-share/bk2site/smiley.gif
-share/bk2site/question.gif
-share/bk2site/note.gif
-share/bk2site/news.gif
-share/bk2site/new.gif
-share/bk2site/mana_red.gif
-share/bk2site/mailto.gif
-share/bk2site/ltbulb.gif
-share/bk2site/earth.gif
-share/bk2site/disk.gif
-share/bk2site/cool2.gif
-share/bk2site/cool.gif
-share/bk2site/closeup.gif
-share/bk2site/thumbs_down.gif
+%%CGIDIR%%/check-meta.pl
+%%CGIDIR%%/redirect.pl
+%%CGIDIR%%/search.pl
+%%ICONSDIR%%/closeup.gif
+%%ICONSDIR%%/smiley.gif
+%%ICONSDIR%%/question.gif
+%%ICONSDIR%%/note.gif
+%%ICONSDIR%%/news.gif
+%%ICONSDIR%%/new.gif
+%%ICONSDIR%%/mana_red.gif
+%%ICONSDIR%%/mailto.gif
+%%ICONSDIR%%/ltbulb.gif
+%%ICONSDIR%%/earth.gif
+%%ICONSDIR%%/disk.gif
+%%ICONSDIR%%/cool2.gif
+%%ICONSDIR%%/cool.gif
+%%ICONSDIR%%/thumbs_down.gif
+@dirrm etc/bk2site
 @dirrm share/bk2site
+@unexec /bin/rm -r %D/%%CGIDIR%%
+@unexec /bin/rm -r %D/%%ICONSDIR%%
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0