From c211d9d33f3a582bf123eda2afce1d26d848bbfb Mon Sep 17 00:00:00 2001 From: Florent Thoumie Date: Sun, 8 Jan 2006 12:38:49 +0000 Subject: Add ldconfig_compat, a port that installs a ldconfig compatibility script to reflect latest changes to /etc/rc.d/ldconfig which are the use of ldconfig directories (${PREFIX}/libdata/ldconfig{,32}). This change is meant to remove so-called ldconfig startup scripts installed by ports as 000.${foo}.sh. The bsd.ldconfig.mmk file is only temporary as this should move quickly to bsd.port.mk. Anyway, to use it, just define the following in your ports' Makefile : USE_LDCONFIG= dir1 dir2 and (before bsd.ldconfig.mk moves to bsd.port.mk) : post-install: install-rc-script --- misc/Makefile | 1 + misc/ldconfig_compat/Makefile | 54 ++++++++++++++++++++++++ misc/ldconfig_compat/bsd.ldconfig.mk | 29 +++++++++++++ misc/ldconfig_compat/files/ldconfig_compat.sh.in | 48 +++++++++++++++++++++ misc/ldconfig_compat/pkg-descr | 5 +++ 5 files changed, 137 insertions(+) create mode 100644 misc/ldconfig_compat/Makefile create mode 100644 misc/ldconfig_compat/bsd.ldconfig.mk create mode 100644 misc/ldconfig_compat/files/ldconfig_compat.sh.in create mode 100644 misc/ldconfig_compat/pkg-descr (limited to 'misc') diff --git a/misc/Makefile b/misc/Makefile index ddc88452b730..787262bcee1a 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -276,6 +276,7 @@ SUBDIR += kwatch SUBDIR += latex-mk SUBDIR += lc + SUBDIR += ldconfig_compat SUBDIR += lesspipe SUBDIR += libhome SUBDIR += libmcal diff --git a/misc/ldconfig_compat/Makefile b/misc/ldconfig_compat/Makefile new file mode 100644 index 000000000000..b3d75aee009d --- /dev/null +++ b/misc/ldconfig_compat/Makefile @@ -0,0 +1,54 @@ +# New ports collection makefile for: ldconfig_compat +# Date created: 30 Dec 2005 +# Whom: Florent Thoumie +# +# $FreeBSD$ +# + +PORTNAME= ldconfig_compat +PORTVERSION= 1.0 +CATEGORIES= misc +MASTER_SITES= # none +DISTFILES= # none + +MAINTAINER= flz@FreeBSD.org +COMMENT= Ldconfig compatibility script + +NO_BUILD= yes +SUB_FILES= ldconfig_compat.sh +USE_RC_SUBR= yes + +LOCAL_DIRS= ${LDCONFIG_DIR} \ + ${LDCONFIG32_DIR} + +.include +.include "${.CURDIR}/bsd.ldconfig.mk" + +.if ${OSVERSION} >= 700012 +IGNORE= isn't needed (part of base rc.d) +.endif + +do-fetch: + @${DO_NADA} + +do-install: +.if ${OSVERSION} >= 600101 + @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh ${PREFIX}/etc/rc.d/ldconfig_compat + @${ECHO_CMD} "etc/rc.d/ldconfig_compat" >> ${TMPPLIST} +.elif ${OSVERSION} >= 500037 + @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh /etc/rc.d/ldconfig_compat + @${ECHO_CMD} "@cwd /" >> ${TMPPLIST} + @${ECHO_CMD} "etc/rc.d/ldconfig_compat" >> ${TMPPLIST} +.else + @${INSTALL_SCRIPT} ${WRKDIR}/ldconfig_compat.sh ${PREFIX}/etc/rc.d/000.ldconfig_compat.sh + @${ECHO_CMD} "etc/rc.d/000.ldconfig_compat.sh" >> ${TMPPLIST} +.endif +.for prefix in ${PREFIX} ${X11BASE} + @${ECHO_CMD} "@cwd ${prefix}" >> ${TMPPLIST} +.for dir in ${LOCAL_DIRS} + @${MKDIR} ${prefix}/${dir} + @${ECHO_CMD} "@dirrm ${dir}" >> ${TMPPLIST} +.endfor +.endfor + +.include diff --git a/misc/ldconfig_compat/bsd.ldconfig.mk b/misc/ldconfig_compat/bsd.ldconfig.mk new file mode 100644 index 000000000000..17896abb4bf8 --- /dev/null +++ b/misc/ldconfig_compat/bsd.ldconfig.mk @@ -0,0 +1,29 @@ +LDCONFIG_DIR= libdata/ldconfig +LDCONFIG32_DIR= libdata/ldconfig32 + +.if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32) +.if (${OSVERSION} < 700012) +RUN_DEPENDS+= ${LDCONFIG_DIR}:${PORTSDIR}/misc/ldconfig_compat +.endif +.endif + +.if !target(install-ldconfig-file) +install-ldconfig-file: +.if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32) + @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST} +.if defined(USE_LDCONFIG) + @${ECHO_MSG} "===> Installing ldconfig configuration file" + @${ECHO_CMD} ${USE_LDCONFIG} | ${TR} ' ' '\n' \ + > ${PREFIX}/${LDCONFIG_DIR}/${UNIQUENAME} + @${ECHO_CMD} ${LDCONFIG_DIR}/${UNIQUENAME} >> ${TMPPLIST} +.endif +.if defined(USE_LDCONFIG32) + @${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 +.else + @${DO_NADA} +.endif +.endif diff --git a/misc/ldconfig_compat/files/ldconfig_compat.sh.in b/misc/ldconfig_compat/files/ldconfig_compat.sh.in new file mode 100644 index 000000000000..fe8abc2d2a61 --- /dev/null +++ b/misc/ldconfig_compat/files/ldconfig_compat.sh.in @@ -0,0 +1,48 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: ldconfig_compat +# REQUIRE: mountcritremote ldconfig +# BEFORE: DAEMON + +. /etc/rc.subr + +name="ldconfig" +ldconfig_command="/sbin/ldconfig" +start_cmd="ldconfig_start" +stop_cmd=":" + +ldconfig_start() +{ + _ins= + ldconfig=${ldconfig_command} + checkyesno ldconfig_insecure && _ins="-i" + if [ -x "${ldconfig_command}" ]; then + ldconfig_paths="" + for i in ${ldconfig_local_dirs}; do + if [ -d "${i}" ]; then + ldconfig_paths="${ldconfig_paths} `find ${i} -type f`" + fi + done + echo 'Local ldconfig path:' ${ldconfig_paths} + ${ldconfig} -m ${_ins} ${ldconfig_paths} + + case `sysctl -n hw.machine_arch` in + amd64) + ldconfig32_paths="" + for i in ${ldconfig_local32_dirs}; do + if [ -d "${i}" ]; then + ldconfig32_paths="${ldconfig32_paths} `find ${i} -type f`" + fi + done + echo 'Local 32-bits ldconfig path:' ${ldconfig32_paths} + ${ldconfig} -32 -m ${_ins} ${ldconfig32_paths} + ;; + esac + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/misc/ldconfig_compat/pkg-descr b/misc/ldconfig_compat/pkg-descr new file mode 100644 index 000000000000..8c931e93dddf --- /dev/null +++ b/misc/ldconfig_compat/pkg-descr @@ -0,0 +1,5 @@ +This port installs a compatibility script that enable old +FreeBSD systems to use ldconfig local directories. + +- Florent Thoumie +flz@FreeBSD.org -- cgit v1.2.3