Date: 07 Jun 2000 03:32:14 -0700 From: asami@FreeBSD.org (Satoshi - Ports Wraith - Asami) To: Maxim Sobolev <sobomax@FreeBSD.org> Cc: lioux@uol.com.br, "Scot W. Hetzel" <hetzels@westbend.net>, ports@FreeBSD.org Subject: Re: NOPORTDOCS handling Message-ID: <vqc3dmpok7l.fsf@silvia.hip.berkeley.edu> In-Reply-To: Maxim Sobolev's message of "Mon, 05 Jun 2000 11:50:23 %2B0300" References: <200006021931.MAA67682@silvia.hip.berkeley.edu> <200006031234.OAA13213@peedub.muc.de> <20000603144658.A7092@Fedaykin.here> <00a901bfcd8a$e6b0f180$8dfee0d1@westbend.net> <20000604012453.A446@Fedaykin.here> <393B69CF.44614467@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
* From: Maxim Sobolev <sobomax@FreeBSD.org> * I rather like to see something like the following in the port's Makefile: * USE_LDCONFIG=yes * and optional: * LDCONFIG_DIRS=/foo/lib /bar/lib (defaulting to ${PREFIX}/lib of course). * * which would add all necessary magic to the PLIST. Ok, how about this one. The comments describe what you should do. Note that LDCONFIG_DIRS is treated like part of PLIST, so you are recommended to use the %%VAR%% form for variable substitution. === Index: bsd.port.mk =================================================================== RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v retrieving revision 1.338 diff -u -r1.338 bsd.port.mk --- bsd.port.mk 2000/05/06 10:45:35 1.338 +++ bsd.port.mk 2000/06/07 10:23:31 @@ -409,6 +410,16 @@ # (default: ${WRKDIR}/.PLIST.mktmp). # PLIST_SUB - List of "variable=value" pair for substitution in ${PLIST} # (default: see below). +# INSTALLS_SHLIBS - If set, bsd.port.mk will automatically run ldconfig commands +# from post-install and also add appropriate @exec/@unexec +# directives to directories listed in LDCONFIG_DIRS. +# LDCONFIG_DIRS - List of directories to run ldconfig if +# INSTALLS_SHLIBS is set (default: %%PREFIX%%/lib). +# Note that this is passed through sed just like the +# rest of PLIST, so ${PLIST_SUB} substitutions also +# apply here. It is recommended that you use +# %%PREFIX%% for ${PREFIX}, %%LOCALBASE%% for +# ${LOCALBASE} and %%X11BASE%% for ${X11BASE}. # # Note that the install target will automatically add manpages (see # above) and also substitute special sequences of characters (delimited @@ -599,6 +610,8 @@ PREFIX?= ${LOCALBASE} .endif +PLIST_SUB+= PREFIX=%D LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} + .if defined(USE_OPENSSL) .if ${OSVERSION} >= 400014 .if !exists(/usr/lib/libcrypto.so) @@ -1322,6 +1348,14 @@ _MANPAGES:= ${_MANPAGES:S/$/.gz/} .endif +# Put this for down as possible so it will catch all PLIST_SUB definitions. + +.if defined(INSTALLS_SHLIBS) +LDCONFIG_DIRS?= %%PREFIX%%/lib +LDCONFIG_PLIST!= ${ECHO} ${LDCONFIG_DIRS} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} +LDCONFIG_RUNLIST!= ${ECHO} ${LDCONFIG_PLIST} | ${SED} -e "s!%D!${PREFIX}!" +.endif + .MAIN: all ################################################################ @@ -1944,6 +1978,10 @@ .if make(real-install) && (defined(_MANPAGES) || defined(_MLINKS)) @cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} compress-man .endif +.if make(real-install) && defined(INSTALLS_SHLIBS) + @${ECHO_MSG} "===> Running ldconfig" + ${LDCONFIG} -m ${LDCONFIG_RUNLIST} +.endif .if make(real-install) && !defined(NO_PKG_REGISTER) @cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} fake-pkg .endif @@ -2732,6 +2770,10 @@ .endfor @${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${PLIST} >> ${TMPPLIST} @${ECHO} "@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi" >> ${TMPPLIST} +.if defined(INSTALLS_SHLIBS) + @${ECHO} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST} + @${ECHO} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST} +.endif .if !defined(NO_FILTER_SHLIBS) .if (${PORTOBJFORMAT} == "aout") @${SED} -e 's,\(/lib.*\.so\.[0-9]*\)$$,\1.0,' ${TMPPLIST} > ${TMPPLIST}.tmp === It was much harder than I thought, since I need %%PREFIX%% to expand to ${PREFIX} when running it (${LDCONFIG_RUNLIST}) while I want to substitute it with %D in PLIST (${LDCONFIG_PLIST}). At the end, I just chickened out and sed'ed ${LDCONFIG_PLIST} again to get ${PREFIX}. So sue me. I can go the other way and try to replace ${PREFIX} with %D, etc., but the problem is that bsd.port.mk won't be able to differentiate ${PREFIX} (this port) with one of ${LOCALBASE}/${X11BASE} (some other port). Using the %%VAR%% form helps this. Satoshi 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?vqc3dmpok7l.fsf>