ports/91933: Mk/bsd.port.mk - introduce USE_LDCONFIG{, 32} and deprecate INSTALLS_SHLIB/LDCONFIG_DIRS
Florent Thoumie
flz at FreeBSD.org
Wed Jan 18 01:20:06 UTC 2006
>Number: 91933
>Category: ports
>Synopsis: Mk/bsd.port.mk - introduce USE_LDCONFIG{,32} and deprecate INSTALLS_SHLIB/LDCONFIG_DIRS
>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: Wed Jan 18 01:20:04 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Florent Thoumie
>Release: FreeBSD 5.3-RELEASE i386
>Organization:
Xbsd.org
>Environment:
System: FreeBSD srv1.xbsd.org 5.3-RELEASE FreeBSD 5.3-RELEASE #2: Wed Nov 24 16:35:34 CET 2004 root at gate.xbsd.org:/usr/src/sys/i386/compile/GATE i386
>Description:
A new ldconfig mechanism has been introduced in HEAD and RELENG_[56]. For older FreeBSD
systems, a misc/ldconfig_compat has been created. A bsd.ldconfig.mk has been created to
provide USE_LDCONFIG and USE_LDCONFIG32 variables.
This patch is integrating bsd.ldconfig.mk features into bsd.port.mk and is deprecating
INSTALLS_SHLIB and LDCONFIG_DIRS.
Simple example :
misc/foo/Makefile: only runs ldconfig at install/deinstall time.
[...]
# This replaces INSTALLS_SHLIB= yes.
USE_LDCONFIG= yes
[...]
misc/bar/Makefile: runs ldconfig at install/deinstall time, and install a ldconfig file.
[...]
USE_LDCONFIG= ${PREFIX}/lib/bar/
[...]
Notes:
- You can have more than one directory in USE_LDCONFIG{,32}.
- USE_LDCONFIG32 is only for use with 64bit archs (could be used by misc/compat5x for amd64)
- These variables are already used by mysqlXX-server ports and graphviz (at least).
- I've tried to understand why LDCONFIG_DIRS uses PLIST_SUB and then replaces %D with ${PREFIX},
but haven't found an explanation, this just doesn't seem right.
>How-To-Repeat:
>Fix:
--- use-ldconfig.diff begins here ---
Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.518
diff -u -r1.518 bsd.port.mk
--- bsd.port.mk 8 Nov 2005 09:02:51 -0000 1.518
+++ bsd.port.mk 18 Jan 2006 00:31:40 -0000
@@ -812,7 +812,7 @@
# INSTALLS_SHLIB
# - 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.
+# directives to directories listed in LDCONFIG_DIRS (deprecated).
# LDCONFIG_DIRS - List of directories to run ldconfig if INSTALLS_SHLIB is set.
# Note that this is passed through sed just like the
# rest of PLIST, so ${PLIST_SUB} substitutions also
@@ -820,6 +820,17 @@
# %%PREFIX%% for ${PREFIX}, %%LOCALBASE%% for
# ${LOCALBASE} and %%X11BASE%% for ${X11BASE}.
# Default: %%PREFIX%%/lib
+# USE_LDCONFIG - If set to "yes", it replaces the old variable INSTALLS_SHLIB.
+# Otherwise, it can be set to a list of directories to be added to
+# ${PREFIX}/libdata/ldconfig/${UNIQUENAME}. Note that this
+# directory is used by ldconfig startup script, it is meant to
+# replace ldconfig scripts installed by some ports as (sometimes)
+# 000.${UNQUENAME}.sh.
+# USE_LDCONFIG32
+# - Same as USE_LDCONFIG but the target file is
+# ${PREFIX}/libdata/ldconfig32/${UNIQUENAME} instead.
+# Note: that should only be used on 64-bit architectures.
+#
# DOCSDIR - Name of the directory to install the packages docs in.
# Default: ${PREFIX}/share/doc/${PORTNAME}
# EXAMPLESDIR - Name of the directory to install the packages examples in.
@@ -1529,6 +1540,23 @@
.endif
.endif
+LDCONFIG_DIR= libdata/ldconfig
+LDCONFIG32_DIR= libdata/ldconfig32
+
+.if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32)
+.if ${OSVERSION} < 504105 || \
+ (${OSVERSION} >= 700000 && ${OSVERSION} < 700012) || \
+ (${OSVERSION} >= 600000 && ${OSVERSION} < 600104)
+RUN_DEPENDS+= ${LOCALBASE}/${LDCONFIG_DIR}:${PORTSDIR}/misc/ldconfig_compat
+.endif
+.if defined(USE_LDCONFIG) && ${USE_LDCONFIG:L} == "yes"
+USE_LDCONFIG= ${PREFIX}/lib
+.endif
+.if defined(USE_LDCONFIG32) && ${USE_LDCONFIG32:L} == "yes"
+IGNORE= has USE_LDCONFIG set to yes, which is not correct
+.endif
+.endif
+
.if defined(USE_ICONV)
LIB_DEPENDS+= iconv.3:${PORTSDIR}/converters/libiconv
.endif
@@ -3514,8 +3542,38 @@
.endif
.endif
-.if !target(run-ldconfig)
-run-ldconfig:
+.if !target(install-ldconfig-file)
+install-ldconfig-file:
+.if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32) || defined(INSTALLS_SHLIB)
+.if defined(USE_LDCONFIG)
+.if !defined(INSTALL_AS_USER)
+ @${ECHO_MSG} "===> Running ldconfig"
+ ${LDCONFIG} -m ${USE_LDCONFIG}
+.else
+ @${ECHO_MSG} "===> Running ldconfig (errors are ignored)"
+ -${LDCONFIG} -m ${USE_LDCONFIG}
+.endif
+.if ${USE_LDCONFIG:L} != "${PREFIX}/lib"
+ @${ECHO_MSG} "===> Installing ldconfig configuration file"
+ @${ECHO_CMD} ${USE_LDCONFIG} | ${TR} ' ' '\n' \
+ > ${PREFIX}/${LDCONFIG_DIR}/${UNIQUENAME}
+ @${ECHO_CMD} ${LDCONFIG_DIR}/${UNIQUENAME} >> ${TMPPLIST}
+.endif
+.endif
+.if defined(USE_LDCONFIG32)
+.if !defined(INSTALL_AS_USER)
+ @${ECHO_MSG} "===> Running ldconfig"
+ ${LDCONFIG} -32 -m ${USE_LDCONFIG32}
+.else
+ @${ECHO_MSG} "===> Running ldconfig (errors are ignored)"
+ -${LDCONFIG} -32 -m ${USE_LDCONFIG32}
+.endif
+ @${ECHO_MSG} "===> Installing 32-bit ldconfig configuration file"
+ @${ECHO_CMD} ${USE_LDCONFIG32} | ${TR} ' ' '\n' \
+ > ${PREFIX}/${LDCONFIG32_DIR}/${UNIQUENAME}
+ @${ECHO_CMD} ${LDCONFIG32_DIR}/${UNIQUENAME} >> ${TMPPLIST}
+.endif
+# This can be removed once, all ports have been converted to USE_LDCONFIG.
.if defined(INSTALLS_SHLIB)
.if !defined(INSTALL_AS_USER)
@${ECHO_MSG} "===> Running ldconfig"
@@ -3524,6 +3582,7 @@
@${ECHO_MSG} "===> Running ldconfig (errors are ignored)"
-${LDCONFIG} -m ${LDCONFIG_RUNLIST}
.endif
+.endif
.else
@${DO_NADA}
.endif
@@ -3704,7 +3763,7 @@
pre-su-install-script do-install install-desktop-entries \
post-install post-install-script add-plist-info \
add-plist-docs add-plist-post install-rc-script compress-man \
- run-ldconfig fake-pkg security-check
+ install-ldconfig-file fake-pkg security-check
_PACKAGE_DEP= install
_PACKAGE_SEQ= package-message pre-package pre-package-script \
do-package post-package-script
@@ -4861,6 +4920,7 @@
.for dir in ${PLIST_DIRS}
@${ECHO_CMD} ${dir} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} | ${SED} -e 's,^, at dirrm ,' >> ${TMPPLIST}
.endfor
+# To be removed once INSTALLS_SHLIB has been eradicated.
.if defined(INSTALLS_SHLIB) && !defined(INSTALL_AS_USER)
@${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST}
@${ECHO_CMD} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}
@@ -4868,6 +4928,24 @@
@${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST} || ${TRUE}" >> ${TMPPLIST}
@${ECHO_CMD} "@unexec ${LDCONFIG} -R || ${TRUE}" >> ${TMPPLIST}
.endif
+.if defined(USE_LDCONFIG)
+.if !defined(INSTALL_AS_USER)
+ @${ECHO_CMD} "@exec ${LDCONFIG} -m ${USE_LDCONFIG}" >> ${TMPPLIST}
+ @${ECHO_CMD} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}
+.else
+ @${ECHO_CMD} "@exec ${LDCONFIG} -m ${USE_LDCONFIG} || ${TRUE}" >> ${TMPPLIST}
+ @${ECHO_CMD} "@unexec ${LDCONFIG} -R || ${TRUE}" >> ${TMPPLIST}
+.endif
+.endif
+.if defined(USE_LDCONFIG32)
+.if !defined(INSTALL_AS_USER)
+ @${ECHO_CMD} "@exec ${LDCONFIG} -32 -m ${USE_LDCONFIG32}" >> ${TMPPLIST}
+ @${ECHO_CMD} "@unexec ${LDCONFIG} -32 -R" >> ${TMPPLIST}
+.else
+ @${ECHO_CMD} "@exec ${LDCONFIG} -32 -m ${USE_LDCONFIG32} || ${TRUE}" >> ${TMPPLIST}
+ @${ECHO_CMD} "@unexec ${LDCONFIG} -32 -R || ${TRUE}" >> ${TMPPLIST}
+.endif
+.endif
.if !defined(NO_FILTER_SHLIBS)
.if (${PORTOBJFORMAT} == "aout")
@${SED} -e 's,\(/lib.*\.so\.[0-9]*\)$$,\1.0,' ${TMPPLIST} > ${TMPPLIST}.tmp
--- use-ldconfig.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list