From flz@xbsd.org  Wed Jan 18 01:15:40 2006
Return-Path: <flz@xbsd.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 066F016A41F;
	Wed, 18 Jan 2006 01:15:40 +0000 (GMT)
	(envelope-from flz@xbsd.org)
Received: from smtp.xbsd.org (xbsd.org [82.233.2.192])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 40C5543D45;
	Wed, 18 Jan 2006 01:15:39 +0000 (GMT)
	(envelope-from flz@xbsd.org)
Received: from localhost (localhost.xbsd.org [127.0.0.1])
	by smtp.xbsd.org (Postfix) with ESMTP id 923A811A53;
	Wed, 18 Jan 2006 02:15:31 +0100 (CET)
Received: from smtp.xbsd.org ([127.0.0.1])
 by localhost (srv1.xbsd.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 78726-09; Wed, 18 Jan 2006 02:14:59 +0100 (CET)
Received: by smtp.xbsd.org (Postfix, from userid 2001)
	id 9F36311AC6; Wed, 18 Jan 2006 02:14:56 +0100 (CET)
Message-Id: <20060118011456.9F36311AC6@smtp.xbsd.org>
Date: Wed, 18 Jan 2006 02:14:56 +0100 (CET)
From: Florent Thoumie <flz@FreeBSD.org>
Reply-To: Florent Thoumie <flz@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: ale@FreeBSD.org
Subject: Mk/bsd.port.mk - introduce USE_LDCONFIG{,32} and deprecate INSTALLS_SHLIB/LDCONFIG_DIRS
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:    marcus
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 18 01:20:04 GMT 2006
>Closed-Date:    Sun Aug 06 21:44:59 GMT 2006
>Last-Modified:  Sun Aug 06 21:44:59 GMT 2006
>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@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,^,@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:

From: Edwin Groothuis <edwin@mavetju.org>
To: Florent Thoumie <flz@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/91933: Mk/bsd.port.mk - introduce USE_LDCONFIG{, 32} and deprecate INSTALLS_SHLIB/LDCONFIG_DIRS
Date: Wed, 18 Jan 2006 14:07:13 +1100

 On Wed, Jan 18, 2006 at 02:14:56AM +0100, Florent Thoumie wrote:
 > >Synopsis:       Mk/bsd.port.mk - introduce USE_LDCONFIG{,32} and deprecate INSTALLS_SHLIB/LDCONFIG_DIRS
 
 After commiting, please assign this PR to the authors of portlint
 for addition in their checks.
 
 Edwin
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: garga 
Responsible-Changed-When: Wed Jan 18 12:36:13 UTC 2006 
Responsible-Changed-Why:  
portmgr territory 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91933 
State-Changed-From-To: open->analyzed 
State-Changed-By: linimon 
State-Changed-When: Mon Jun 5 19:32:13 UTC 2006 
State-Changed-Why:  
Accepted for testing on the cluster. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91933 
State-Changed-From-To: analyzed->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 16 04:56:35 UTC 2006 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91933 
State-Changed-From-To: closed->open 
State-Changed-By: vd 
State-Changed-When: Mon Jun 19 08:38:58 UTC 2006 
State-Changed-Why:  
Assign to the portlint maintainer for addition in their checks. 


Responsible-Changed-From-To: portmgr->marcus 
Responsible-Changed-By: vd 
Responsible-Changed-When: Mon Jun 19 08:38:58 UTC 2006 
Responsible-Changed-Why:  
Assign to the portlint maintainer for addition in their checks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91933 
State-Changed-From-To: open->feedback 
State-Changed-By: marcus 
State-Changed-When: Tue Jul 18 05:11:32 UTC 2006 
State-Changed-Why:  
Exactly what kind of portlint check are you looking for? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91933 

From: linimon@lonesome.com (Mark Linimon)
To: freebsd-gnats-submit@FreeBSD.org
Cc: linimon@FreeBSD.org, flz@FreeBSD.org, marcus@FreeBSD.org
Subject: Re: ports/91933: Mk/bsd.port.mk - introduce USE_LDCONFIG{,32} and deprecate INSTALLS_SHLIB/LDCONFIG_DIRS
Date: Mon, 24 Jul 2006 19:41:05 -0500

 I presume that what should be flagged is the usage of the obsolete Makevars?
 
 > deprecating INSTALLS_SHLIB and LDCONFIG_DIRS
 
 mcl
State-Changed-From-To: feedback->closed 
State-Changed-By: marcus 
State-Changed-When: Sun Aug 6 21:44:49 UTC 2006 
State-Changed-Why:  
Check has been added. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91933 
>Unformatted:
