Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 1998 21:32:16 -0400 (EDT)
From:      Tim Vanderhoek <ac199@hwcn.org>
To:        Satoshi Asami <asami@FreeBSD.ORG>
Cc:        ports@FreeBSD.ORG
Subject:   Re: cvs commit: ports/x11-wm/afterstep/pkg PLIST (more bsd.port.mk mods)
Message-ID:  <Pine.BSF.3.96.980824210617.233B-100000@localhost>
In-Reply-To: <199808200732.AAA04189@silvia.hip.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 20 Aug 1998, Satoshi Asami wrote:

>  * This isn't strictly true.  Almost all of the lang-specific ports
>  * still need updating.
> 
> You're right.  As of now, these are the manpages still remaining (just
> a rough count, look at the command line):
> 
> ===
> ## grep -c man/man */*/pkg/PLIST | grep -v ':0$'
> astro/sunclock/pkg/PLIST:1
[...]
> net/rshell/pkg/PLIST:1

Well, it was sometime while fixing this one that I finally got
fed-up with all the ports that require an MLINKS variable...

These are diffs to the last proposed bsd.port.mk.  I see Satoshi
(you) has changed the proposed bsd.port.mk again which means he's
probably running through the package-build test-run again, so
even I haven't tested this quite as much I would like, I'll post
this now in hopes of saving a testrun.

[I'll read those latest diffs right after this...  :-]

Actually, I did test it fairly well, just not with real ports.  :-)

It should correctly handle,

MAN2PREFIX=	/hokey
MANLANG= ja en ""
MLINKS=	var.1		->		nvar.2 \
	/var/qmail/man/man1/ds.1 ->	sync.l \
	qlink.conf.3qt -> qlink.234.l

Absolute paths will be linked using symlinks instead of
hardlinks.  It doesn't handle the case where MANxPREFIXs point to
such strange locations that a symlink is necessary, but any ports
that do this can just set SYMMLINKS.

It is intentionally designed so that ports can set _FMLINKS,
_TMLINKS, and _HMLINKS directly, in case they can't use MLINKS.
In theory this should never be necessary, but theory is shit,
so....

This actually became a little more complex than I had expected...

These patches apply to the last proposed bsd.port.mk (not the
currently proposed one).

It might be worthwhile protecting the related variable
assignments with ``.if make(compress-man) ||
make(generate-plist)'' to make things faster.

Thoughts, vetoes, comments, curses?  ;-)

--- bsd.port.mk.orig	Mon Aug 24 13:00:55 1998
+++ bsd.port.mk	Mon Aug 24 20:18:42 1998
@@ -679,10 +679,14 @@
 SETENV?=	/usr/bin/env
 SH?=		/bin/sh
 TR?=		/usr/bin/tr
+WC?=		/usr/bin/wc
 
 # Used to print all the '===>' style prompts - override this to turn them off.
 ECHO_MSG?=		${ECHO}
 
+# Parses space-delimited lists
+_WORD=	`${ECHO} "SENT" | ${SED} -e 's/\([^ ]* *\)\{'$$((NUMB-1))'\}\([^ ]*\).*/\2/'`
+
 .for sub in ${PLIST_SUB}
 _sedsubplist!=	sym=`${ECHO} "${sub}" | ${SED} -e 's/=.*//'`; \
 		val=`${ECHO} "${sub}" | ${SED} -e 's/^[^=][^=]*=//'`; \
@@ -876,7 +880,77 @@
 _MANPAGES+=	${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
 .endif
 
+.if defined(MLINKS)
+__fl!=	${ECHO} '${MLINKS:S/	/ /g}' | \
+     		${SED} -e 's/\([^ ]*\) *\-\> *\([^ ]*\)/\1/g'
+__tl!=	${ECHO} '${MLINKS:S/	/ /g}' | \
+     		${SED} -e 's/\([^ ]*\) *\-\> *\([^ ]*\)/\2/g'
+__fs!=	${ECHO} ${__fl} | ${SED} -e 's/[^ ]*\.\([1-9ln]\)[^. ]*/\1/g'
+__ts!=	${ECHO} ${__tl} | ${SED} -e 's/[^ ]*\.\([1-9ln]\)[^. ]*/\1/g'
+
+__count:=	0
+.for __fsect in ${__fs}
+__count!=	${ECHO} $$((${__count}+1))
+__fname!=	${ECHO} ${_WORD:S/SENT/${__fl}/:S/NUMB/${__count}/}
+__tname!=	${ECHO} ${_WORD:S/SENT/${__tl}/:S/NUMB/${__count}/}
+__tsect!=	${ECHO} ${_WORD:S/SENT/${__ts}/:S/NUMB/${__count}/}
+
+.if defined(SYMMLINKS)
+__defln:=	-fs
+.else
+__defln:=	-f
+.endif
+
+.if defined(NOMANCOMPRESS)
+
+.if ${__fname:M/*}x == x
+_FMLINKS!=	${ECHO} ${_FMLINKS} ${MAN${__fsect:S/l/L/:S/n/N/}PREFIX}/man/${lang}/man${__fsect}/${__fname}
+.else Not an Absolute Path
+_FMLINKS!=	${ECHO} ${_FMLINKS} ${__fname}
+__defln:=	-fs
+.endif
+.if ${__tname:M/*}x == x
+.for __tsect in ${__tsect}
+_TMLINKS!=	${ECHO} ${_TMLINKS} ${MAN${__tsect:S/l/L/:S/n/N/}PREFIX}/man/${lang}/man${__tsect}/${__tname}
+.endfor
+.else Not an Absolute Path
+_TMLINKS!=	${ECHO} ${_TMLINKS} ${__tname}
+__defln:=	-fs
+.endif
+
+.else defined(NOMANCOMPRESS)
+
+.if ${__fname:M/*}x == x
+_FMLINKS!=	${ECHO} ${_FMLINKS} ${MAN${__fsect:S/l/L/:S/n/N/}PREFIX}/man/${lang}/man${__fsect}/${__fname}.gz
+.else Not an Absolute Path
+_FMLINKS!=	${ECHO} ${_FMLINKS} ${__fname}.gz
+__defln:=	-fs
+.endif
+.if ${__tname:M/*}x == x
+.for __tsect in ${__tsect}
+_TMLINKS!=	${ECHO} ${_TMLINKS} ${MAN${__tsect:S/l/L/:S/n/N/}PREFIX}/man/${lang}/man${__tsect}/${__tname}.gz
 .endfor
+.else Not an Absolute Path
+_TMLINKS!=	${ECHO} ${_TMLINKS} ${__tname}.gz
+__defln:=	-fs
+.endif
+
+.endif defined(NOMANCOMPRESS)
+_HMLINKS+=	${__defln}
+_HMLINKS:=	${_HMLINKS}
+
+.endfor __fsect in ${__fs}
+.endif defined(MLINKS)
+.endfor lang in ${MANLANG}
+
+__w1!=	${ECHO} ${_HMLINKS} | ${WC} -w
+__w2!=	${ECHO} ${_FMLINKS} | ${WC} -w
+__w3!=	${ECHO} ${_TMLINKS} | ${WC} -w
+.if ${__w1} != ${__w2} || ${__w1} != ${__w3}
+.BEGIN:
+	@${ECHO_MSG} "Error: variables derived from MLINKS are bad."
+	@${FALSE}
+.endif
 
 .if defined(_MANPAGES) && defined(NOMANCOMPRESS)
 __MANPAGES:=	${_MANPAGES:S^${PREFIX}/^^:S/""//:S^//^/^g}
@@ -1907,6 +1981,20 @@
 	@${ECHO} ${man} >> ${TMPPLIST}
 .endfor
 	@${SED} ${_sedsubplist} ${PLIST} >> ${TMPPLIST}
+	@for link in ${_HMLINKS}; do \
+		cnt=$$(($$cnt + 1)); \
+		if [ $$link = -fs ]; then \
+			${ECHO} ${_WORD:S/SENT/${_TMLINKS}/:S/NUMB/\$cnt/} >> ${TMPPLIST}; \
+		elif [ $$link = -f ]; then \
+			${ECHO} "@exec ln -f ${_WORD:S/SENT/${_FMLINKS}/:S/NUMB/\$cnt/}  \
+			                     ${_WORD:S/SENT/${_TMLINKS}/:S/NUMB/\$cnt/}" \
+				>> ${TMPPLIST}; \
+			${ECHO} "@unexec rm -f ${_WORD:S/SENT/${_TMLINKS}/:S/NUMB/\$cnt/}" \
+				>> ${TMPPLIST}; \
+		else \
+			${ECHO} "Toasted!  MLINKS was not correctly parsed."; \
+		fi; \
+	done
 .endif
 
 # Compress (or uncompress) manpages.
@@ -1922,6 +2010,11 @@
 .for manpage in ${_MANPAGES}
 	@${GZIP_CMD} ${manpage}
 .endfor
+	@for link in ${_HMLINKS}; do \
+		cnt=$$(($$cnt + 1)); \
+		${LN} $${link} ${_WORD:S/SENT/${_FMLINKS}/:S/NUMB/\$cnt/} \
+		               ${_WORD:S/SENT/${_TMLINKS}/:S/NUMB/\$cnt/}; \
+	done
 .endif
 .endif
 

-- 
This .sig is not innovative, witty, or profund.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980824210617.233B-100000>