From owner-freebsd-ports Mon Aug 24 19:49:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA19624 for freebsd-ports-outgoing; Mon, 24 Aug 1998 19:49:16 -0700 (PDT) (envelope-from owner-freebsd-ports@FreeBSD.ORG) Received: from localhost.my.domain (ppp1663.on.bellglobal.com [206.172.249.127]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA19588; Mon, 24 Aug 1998 19:49:09 -0700 (PDT) (envelope-from hoek@FreeBSD.ORG) Received: from localhost (tim@localhost) by localhost.my.domain (8.8.8/8.8.8) with SMTP id WAA25321; Mon, 24 Aug 1998 22:48:00 -0400 (EDT) (envelope-from ac199@hwcn.org) X-Authentication-Warning: localhost.my.domain: tim owned process doing -bs Date: Mon, 24 Aug 1998 22:47:59 -0400 (EDT) From: Tim Vanderhoek X-Sender: tim@localhost Reply-To: ac199@hwcn.org To: Satoshi Asami cc: ports@FreeBSD.ORG Subject: Re: cvs commit: ports/x11-wm/afterstep/pkg PLIST (more bsd.port.mk mods) In-Reply-To: <199808250146.SAA00195@silvia.hip.berkeley.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, 24 Aug 1998, Satoshi Asami wrote: > I only sent that do you because I had the feeling that we're just > boring everyone else on the list. ;) As opposed to the never-ending stream of PRs changes and bugreports? ;-) > * 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... :-] > > I think mine are child's play compared to your stuff. Hehe. You _did_ ask for an MLINKS variable. :) Seriously, when I started I thought it would be just a simple shell script tacked onto generate-plist: and man-compress:. I hadn't intended to write some 94 lines. :( > Do we really need the "->"? The ones in /usr/src don't have that and > will just link even-numbered entries to odd-numbered ones. (*) I hate reading the ones that use bsd.man.mk. This was an attempt at an improvement. :-) +__fl!= ${ECHO} '${MLINKS:S/ / /g}' | \ + ${SED} -e 's/\([^ ]*\) *\-\> *\([^ ]*\)/\1/g' +__tl!= ${ECHO} '${MLINKS:S/ / /g}' | \ + ${SED} -e 's/\([^ ]*\) *\-\> *\([^ ]*\)/\2/g' Those are the only two lines that require it. It _should_ work fine if you just delete the arrows or make them optional, although that will make an already minimal amount of error checking even more minimal. > Anyway, the patch did apply to my latest bsd.port.mk. The build is > still humming along despite me doing a "make install" from > /usr/src/share/mk, so it hasn't broken anything obvious (yet). All my new variables do seem to slow things down a little, though. :-( > * Thoughts, vetoes, comments, curses? ;-) > > Not sure what to say. If you can send me some patches to Makefiles, > I'll test it. (And an answer to * above too....) There's a missing line (Sorry...). :( What currently reads generate-plist: [...] ${SED} ${_sedsubplist} ${PLIST} >> ${TMPPLIST} @for link in ${_HMLINKS}; do \ should read generate-plist: [...] ${SED} ${_sedsubplist} ${PLIST} >> ${TMPPLIST} @${ECHO} @cwd / >> ${TMPPLIST} @for link in ${_HMLINKS}; do \ That ``@cwd'' is a little evil, but it's not too easy to avoid it. A simple hack to avoid it would just ${AppropriateVariables:S/${PREFIX}//} but... I'll give you some diffs to make some current ports use MLINKS for testing. How many do you want? Okay, since as you point-out, this isn't entirely obvious to the casual reader, I'll make some comments on how it's _supposed_ to work... Hopefully this'll encourage a couple lurkers on -ports to offer their opinions on whether or not this is worthwhile. :) +# Parses space-delimited lists +_WORD= `${ECHO} "SENT" | ${SED} -e 's/\([^ ]* *\)\{'$$((NUMB-1))'\}\([^ ]*\).*/\2/'` + So given a list like list= aaa bbb ccc One can do @${ECHO} ${WORD:S/SENT/${list}/:S/NUMB/2/} and print "bbb". +.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' Break the MLINKS variable up into __fl -- the _list_ of each manpage on the left of a "->" __tl -- the _list_ of each manpage on the right of a "->" __fs -- A _list_ of man sections (1-9ln), corresponding to __fl __ts -- A _list_ of man sections (1-9ln), corresponding to __tl For a manpage such as qt.234.6qt, we grab the "6". [This doesn't handle something like "iamnotamanpage" at all---I should fix this...] +__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}/} Loop once for each set of two manpages. __fname --- grab the appropriate left-side manpage (as per __count) __fsect --- man section ${__fname} belongs to __tname --- grab the appropriate right-side manpage (as per __count) __tsect --- man section ${__tname} belongs to +.if defined(SYMMLINKS) +__defln:= -fs +.else +__defln:= -f +.endif Default linking style. Duh. ;-) +.else defined(NOMANCOMPRESS) [...] The goal here is to produce variables _FMLINKS= /full/path/from.1 /full/path/from.2 [...] _TMLINKS= /full/path/to.1 /full/path/to.2 [...] _HMLINKS= -fs -fs [...] +.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 This expands the short path "man.1" to its full path (as necessary) and adds it to the appropriate list. Don't even ask why that inner .for loop is necessary... +.endif defined(NOMANCOMPRESS) +_HMLINKS+= ${__defln} +_HMLINKS:= ${_HMLINKS} Add the link style to the appropriate list. +.endfor __fsect in ${__fs} +.endif defined(MLINKS) +.endfor lang in ${MANLANG} Loop again for the next pair of manpages. End of conditional MLINKS section. Loop again for next MANLANG. Easy. :-) +__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 Make sure nobody is trying to go behind our back and cause trouble. Now that our variables _HMLINKS, _FMLINKS, and _TMLINKS are setup, the rest is easy. Pop one value off each, combine, do appropriate thing for generate-plist: or man-compress:, repeat until finished. How's that? -- 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