Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  1 Mar 2006 20:21:05 +0100 (CET)
From:      Jean-Yves Lefort <jylefort@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/93993: Fix libtool shared library versioning
Message-ID:  <20060301192105.15670C151@jsite.lefort.net>
Resent-Message-ID: <200603011930.k21JU6iq078482@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         93993
>Category:       ports
>Synopsis:       Fix libtool shared library versioning
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 01 19:30:06 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Sat Feb 11 20:20:04 CET 2006 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
On FreeBSD, libtool incorrectly versions shared libraries. Major
version numbers should only change when the ABI breaks, but because of
this bug, they change when the maintainer of a software package bumps
the "current" number (which is defined in the libtool manual as "the
most recent interface number that this library implements").

To fix this problem, I propose the following strategy:

1) Apply the attached patch.
2) Issue a heads-up telling people to add FIX_LIBTOOL_VERSIONS=yes to
   their libtool-using ports the next time they update them. At the same
   time, allow (and encourage) committers to add FIX_LIBTOOL_VERSIONS
   (without maintainer approval) to libtool-using ports they encounter.
3) Once all ports have been fixed, unconditionally patch the libtool
   files, and obsolete the FIX_LIBTOOL_VERSIONS variable.
>How-To-Repeat:
>Fix:
--- /usr/ports/Mk/bsd.autotools.mk	Thu Feb 23 11:43:34 2006
+++ bsd.autotools.mk	Wed Mar  1 19:40:25 2006
@@ -181,6 +181,14 @@
 .if defined(AUTOTOOL_libtool)
 GNU_CONFIGURE?=			YES
 AUTOTOOL_libtool_env=	${AUTOTOOL_libtool}
+
+. if defined(FIX_LIBTOOL_VERSIONS)
+EXTERNAL_LIBTOOL?=	${WRKDIR}/.libtool-fixed
+EXTERNAL_LTMAIN?=	${WRKDIR}/.ltmain.sh-fixed
+. else
+EXTERNAL_LIBTOOL?=	${LIBTOOL}
+EXTERNAL_LTMAIN?=	${LTMAIN}
+. endif
 .endif
 
 .if defined(AUTOTOOL_libtool_env)
@@ -215,6 +223,14 @@
 
 .endif
 
+.if defined(FIX_LIBTOOL_VERSIONS)
+. if defined(AUTOTOOL_libtool)
+LIBTOOLVERFILES?=	${EXTERNAL_LIBTOOL} ${EXTERNAL_LTMAIN}
+. else
+LIBTOOLVERFILES?=	ltmain.sh libtool
+. endif
+.endif
+
 #---------------------------------------------------------------------------
 # Environmental handling
 # Now that we've got our environments defined for autotools, add them
@@ -311,15 +327,31 @@
 .if !target(patch-autotools)
 patch-autotools::
 . if defined(AUTOTOOL_libtool)
+.  if defined(FIX_LIBTOOL_VERSIONS)
+	@${CP} -pf ${LTMAIN} ${EXTERNAL_LTMAIN}
+	@${CP} -pf ${LIBTOOL} ${EXTERNAL_LIBTOOL}
+.  endif
 	@(cd ${PATCH_WRKSRC}; \
 	for file in ${LIBTOOLFILES}; do \
 		${CP} $$file $$file.tmp; \
-		${SED} -e "/^ltmain=/!s^\$$ac_aux_dir/ltmain.sh^${LIBTOOLFLAGS} ${LTMAIN}^g" \
-			     -e '/^LIBTOOL=/s^\$$(top_builddir)/libtool^${LIBTOOL}^g' \
+		${SED} -e "/^ltmain=/!s^\$$ac_aux_dir/ltmain.sh^${LIBTOOLFLAGS} ${EXTERNAL_LTMAIN}^g" \
+			     -e '/^LIBTOOL=/s^\$$(top_builddir)/libtool^${EXTERNAL_LIBTOOL}^g' \
 			$$file.tmp > $$file; \
 		${RM} $$file.tmp; \
 	done);
-. else
+. endif
+. if defined(FIX_LIBTOOL_VERSIONS)
+	@(cd ${PATCH_WRKSRC}; \
+	for file in ${LIBTOOLVERFILES}; do \
+		if [ -f $$file ]; then \
+			${REINPLACE_CMD} -e \
+				'/freebsd-elf)/,/;;/ s|major="\.$$current"|major=.`expr $$current - $$age`|; \
+				 /freebsd-elf)/,/;;/ s|versuffix="\.$$current"|versuffix="$$major"|' \
+				$$file; \
+		fi; \
+	done);
+. endif
+. if !defined(AUTOTOOL_libtool) && !defined(FIX_LIBTOOL_VERSIONS)
 	@${DO_NADA}
 . endif
 .endif
--- /usr/ports/Mk/bsd.port.mk	Thu Feb 23 16:37:20 2006
+++ bsd.port.mk	Wed Mar  1 19:34:28 2006
@@ -1816,7 +1816,7 @@
 .include "${PORTSDIR}/Mk/bsd.apache.mk"
 .endif
 
-.if defined(USE_AUTOTOOLS)
+.if defined(USE_AUTOTOOLS) || defined(FIX_LIBTOOL_VERSIONS)
 .include "${PORTSDIR}/Mk/bsd.autotools.mk"
 .endif
 
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060301192105.15670C151>