aboutsummaryrefslogtreecommitdiff
path: root/Mk/Uses/libtool.mk
diff options
context:
space:
mode:
authorTijl Coosemans <tijl@FreeBSD.org>2014-01-28 18:25:52 +0000
committerTijl Coosemans <tijl@FreeBSD.org>2014-01-28 18:25:52 +0000
commit64a034726843b6a58a06e0345edf32e60663baff (patch)
tree22bae8895816f100941fd695136ead7096b40e27 /Mk/Uses/libtool.mk
parente0b8be39b6e124c2cf8cc9c6e62bc645bb817cbe (diff)
downloadports-64a034726843b6a58a06e0345edf32e60663baff.tar.gz
ports-64a034726843b6a58a06e0345edf32e60663baff.zip
Introduce USES=libtool to replace USE_AUTOTOOLS=libtool.
Unlike USE_AUTOTOOLS=libtool which makes a port use libtool from devel/libtool, this just patches the copy of libtool included in the port. This allows adding it to all ports that use libtool including ports that build Fortran libraries and ports that use different compilers or binutils than the ones used to build devel/libtool. USES=libtool also changes the library naming specification similar to what USE_GNOME=ltverhack does. Given the libtool version info $current:$revision:$age and $major=$current-$age the library will be named libname.so.$major.$age.$revision instead of libname.so.$current and libname.so.$major becomes a symlink. Because $major increases less frequently than $current this reduces the number of library version bumps which means fewer rebuilds of dependent packages. To ease the conversion from USE_AUTOTOOLS=libtool this naming spec can be disabled with USES=libtool:oldver but the intention is that all libtool ports eventually use the new naming. Another change is that only libraries that are listed on the command line will be linked into executables. Normally libtool would link in the entire tree of library dependencies. This reduces the number of direct dependencies on a given library which means fewer packages need to be rebuilt on a library version bump. Approved by: portmgr (bapt)
Notes
Notes: svn path=/head/; revision=341646
Diffstat (limited to 'Mk/Uses/libtool.mk')
-rw-r--r--Mk/Uses/libtool.mk41
1 files changed, 41 insertions, 0 deletions
diff --git a/Mk/Uses/libtool.mk b/Mk/Uses/libtool.mk
new file mode 100644
index 000000000000..70677e3417e2
--- /dev/null
+++ b/Mk/Uses/libtool.mk
@@ -0,0 +1,41 @@
+# $FreeBSD$
+#
+# Bring libtool scripts up to date.
+#
+# MAINTAINER: autotools@FreeBSD.org
+#
+# Feature: libtool
+# Usage: USES=libtool
+
+.if !defined(_INCLUDE_USES_LIBTOOL_MK)
+_INCLUDE_USES_LIBTOOL_MK= yes
+_USES_POST+= libtool
+.endif
+
+.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_LIBTOOL_POST_MK)
+_INCLUDE_USES_LIBTOOL_POST_MK= yes
+
+patch-libtool:
+ @${FIND} ${WRKDIR} -type f -name configure | \
+ ${XARGS} ${REINPLACE_CMD} \
+ -e '/link_all_deplibs=/s/=unknown/=no/' \
+ -e '/objformat=/s/echo aout/echo elf/'
+
+.if "${libtool_ARGS}" != oldver
+ @${FIND} ${WRKDIR} -type f -name configure | \
+ ${XARGS} ${REINPLACE_CMD} \
+ -e "/freebsd-elf\*)/,+1 s/library_names_spec=.*/ \
+ library_names_spec='\$$libname\$$release.so\$$versuffix \
+ \$$libname\$$release.so\$$major \$$libname.so' \
+ soname_spec='\$$libname\$$release.so\$$major'/"
+
+ @${FIND} ${WRKDIR} -type f -name ltmain.sh | \
+ ${XARGS} ${REINPLACE_CMD} \
+ -e '/case $$version_type in/,+2 \
+ s/darwin|linux|/darwin|freebsd-elf|linux|/' \
+ -e '/freebsd-elf)/,+2 { \
+ /major=/s/=.*/=.$$(($$current - $$age))/; \
+ /versuffix=/s/=.*/="$$major.$$age.$$revision"/; }'
+.endif
+
+.endif