2014-01-28 19:25:52 +01:00
|
|
|
# Bring libtool scripts up to date.
|
|
|
|
#
|
|
|
|
# Feature: libtool
|
2014-04-23 15:25:16 +02:00
|
|
|
# Usage: USES=libtool or USES=libtool:args
|
2014-09-15 20:23:21 +02:00
|
|
|
# Valid args: keepla Don't remove libtool libraries (*.la) from the stage
|
|
|
|
# directory. Some ports need them at runtime (e.g. ports
|
|
|
|
# that call lt_dlopen from libltdl).
|
2014-08-10 15:41:19 +02:00
|
|
|
# build Add a build dependency on devel/libtool. This can
|
|
|
|
# be used when a port does not generate its own libtool
|
|
|
|
# script and relies on the system to provide one.
|
2014-03-15 11:31:54 +01:00
|
|
|
#
|
2017-12-23 14:58:40 +01:00
|
|
|
# MAINTAINER: tijl@FreeBSD.org
|
2014-01-28 19:25:52 +01:00
|
|
|
|
|
|
|
.if !defined(_INCLUDE_USES_LIBTOOL_MK)
|
|
|
|
_INCLUDE_USES_LIBTOOL_MK= yes
|
|
|
|
_USES_POST+= libtool
|
2014-08-10 15:41:19 +02:00
|
|
|
|
|
|
|
.if ${libtool_ARGS:Mbuild}
|
2016-03-27 03:23:25 +02:00
|
|
|
BUILD_DEPENDS+= libtool:devel/libtool
|
2014-08-10 15:41:19 +02:00
|
|
|
.endif
|
2014-01-28 19:25:52 +01:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_LIBTOOL_POST_MK)
|
|
|
|
_INCLUDE_USES_LIBTOOL_POST_MK= yes
|
|
|
|
|
Rewrite the target ordering code.
The targets now have priority assigned to them, and, when the dependency
ordering magic is done at the end of bsd.port.mk, they are sorted
according to their priority.
This allows USES to add targets easily and have them run whenever they
want without touching bsd.port.mk.
To add a target that runs just before post-configure run, do:
_USES_configure+= 695:my-post-configure
my-post-configure:
do something
To fine tune when the target is ran, look at the values in the *_SEQ
variables at the end of bsd.port.mk, and the other USES.
Allow ports Makefiles to override the priority of targets with the
TARGET_ORDER_OVERRIDE variable. For example, to get post-install
running earlier, (its default is 700) do:
TARGET_ORDER_OVERRIDE= 650:post-install
While there, add options target helpers for the do-* targets when they
exist.
Reviewed by: antoine, bapt
Exp-run by: antoine
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D3099
2015-08-17 15:31:25 +02:00
|
|
|
_USES_configure+= 480:patch-libtool
|
2014-01-28 19:25:52 +01:00
|
|
|
patch-libtool:
|
2014-02-09 23:00:35 +01:00
|
|
|
@${FIND} ${WRKDIR} \( -name configure -or -name ltconfig \) \
|
2015-02-16 08:56:47 +01:00
|
|
|
-type f | while read i; do ${SED} -i.libtool.bak \
|
2014-03-03 15:10:31 +01:00
|
|
|
-e '/dragonfly\*/!s/^ *freebsd\*[ )]/dragonfly* | &/' \
|
2014-02-27 10:51:45 +01:00
|
|
|
-e '/gcc_dir=\\`/s/gcc /$$CC /' \
|
|
|
|
-e '/gcc_ver=\\`/s/gcc /$$CC /' \
|
2014-02-14 23:29:05 +01:00
|
|
|
-e '/link_all_deplibs[0-9A-Z_]*=/s/=unknown/=no/' \
|
2015-08-02 17:03:19 +02:00
|
|
|
-e '/archive_expsym_cmds[0-9A-Z_]*=.$$CC.*-retain-/ { \
|
|
|
|
s/-retain-symbols-file/-version-script/; \
|
|
|
|
s/$$export_symbols/$$lib-ver/; \
|
|
|
|
s/$$CC/echo "{ global:" > $$lib-ver~ \
|
|
|
|
sed -e "s|$$|;|" < $$export_symbols >> $$lib-ver~ \
|
|
|
|
echo "local: *; };" >> $$lib-ver~&/; }' \
|
2014-02-14 23:29:05 +01:00
|
|
|
-e '/objformat=/s/echo aout/echo elf/' \
|
2015-06-08 07:59:13 +02:00
|
|
|
-e '/STRIP -V/s/"GNU strip"/"strip"/' \
|
2014-02-14 23:29:05 +01:00
|
|
|
-e "/freebsd-elf\\*)/,/;;/ { \
|
2014-12-08 17:48:38 +01:00
|
|
|
/deplibs_check_method=/s/=.*/=pass_all/; \
|
2014-02-09 23:00:35 +01:00
|
|
|
/library_names_spec=.*\\.so/ \
|
|
|
|
s/=.*/='\$$libname\$$release.so\$$versuffix \
|
|
|
|
\$$libname\$$release.so\$$major \$$libname.so' \
|
|
|
|
soname_spec='\$$libname\$$release.so\$$major'/; \
|
|
|
|
/library_names_spec=.*shared_ext/ \
|
|
|
|
s/=.*/='\$$libname\$$release\$$shared_ext\$$versuffix \
|
|
|
|
\$$libname\$$release\$$shared_ext\$$major \
|
|
|
|
\$$libname\$$shared_ext' \
|
2014-09-05 17:31:31 +02:00
|
|
|
soname_spec='\$$libname\$$release\$$shared_ext\$$major'/; \
|
2015-02-16 08:56:47 +01:00
|
|
|
}" $${i} && ${TOUCH} -mr $${i}.libtool.bak $${i}; done
|
2014-01-28 19:25:52 +01:00
|
|
|
|
|
|
|
@${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))/; \
|
2014-12-08 17:48:38 +01:00
|
|
|
/versuffix=/s/=.*/="$$major.$$age.$$revision"/; }' \
|
|
|
|
-e '/if.*linkmode.*prog.*mode.*!= relink/s/if.*;/if :;/'\
|
|
|
|
-e '/if.*prog.*linkmode.*relink !=.*mode/s/if.*;/if :;/'\
|
|
|
|
-e '/if.*linkmode.*prog.*mode.* = relink/s/||.*;/;/' \
|
|
|
|
-e '/if.*prog.*linkmode.*relink = .*mode/s/||.*;/;/' \
|
2017-12-26 18:20:15 +01:00
|
|
|
-e 's/|-p|-pg|/|-B*|-fstack-protector*|-fuse-ld=*|-p|-pg|/'
|
2014-01-28 19:25:52 +01:00
|
|
|
|
Rewrite the target ordering code.
The targets now have priority assigned to them, and, when the dependency
ordering magic is done at the end of bsd.port.mk, they are sorted
according to their priority.
This allows USES to add targets easily and have them run whenever they
want without touching bsd.port.mk.
To add a target that runs just before post-configure run, do:
_USES_configure+= 695:my-post-configure
my-post-configure:
do something
To fine tune when the target is ran, look at the values in the *_SEQ
variables at the end of bsd.port.mk, and the other USES.
Allow ports Makefiles to override the priority of targets with the
TARGET_ORDER_OVERRIDE variable. For example, to get post-install
running earlier, (its default is 700) do:
TARGET_ORDER_OVERRIDE= 650:post-install
While there, add options target helpers for the do-* targets when they
exist.
Reviewed by: antoine, bapt
Exp-run by: antoine
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D3099
2015-08-17 15:31:25 +02:00
|
|
|
_USES_stage+= 790:patch-lafiles
|
2014-04-23 15:25:16 +02:00
|
|
|
patch-lafiles:
|
2014-12-08 17:48:38 +01:00
|
|
|
.if ${libtool_ARGS:Mkeepla}
|
2014-04-23 15:25:16 +02:00
|
|
|
@${FIND} ${STAGEDIR} -type f -name '*.la' | \
|
|
|
|
${XARGS} ${SED} -i '' -e "/dependency_libs=/s/=.*/=''/"
|
|
|
|
.else
|
2014-09-08 14:21:50 +02:00
|
|
|
@${FIND} ${STAGEDIR} -type l -exec ${SH} -c \
|
2014-09-14 20:41:53 +02:00
|
|
|
'case `${REALPATH} -q "{}"` in \
|
2014-09-08 14:21:50 +02:00
|
|
|
*.la) ${ECHO_CMD} "{}" ;; esac' \; | \
|
|
|
|
${XARGS} ${GREP} -l 'libtool library' | ${XARGS} ${RM}
|
2014-04-23 15:25:16 +02:00
|
|
|
@${FIND} ${STAGEDIR} -type f -name '*.la' | \
|
|
|
|
${XARGS} ${GREP} -l 'libtool library' | ${XARGS} ${RM}
|
|
|
|
.endif
|
|
|
|
|
2014-01-28 19:25:52 +01:00
|
|
|
.endif
|