| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.94 2004/08/13 15:39:40 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.97 2004/08/31 09:05:24 lv Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass is for general purpose functions that most ebuilds |
7 | # This eclass is for general purpose functions that most ebuilds |
| 8 | # have to implement themselves. |
8 | # have to implement themselves. |
| … | |
… | |
| 13 | INHERITED="$INHERITED $ECLASS" |
13 | INHERITED="$INHERITED $ECLASS" |
| 14 | |
14 | |
| 15 | DEPEND="!bootstrap? ( sys-devel/patch )" |
15 | DEPEND="!bootstrap? ( sys-devel/patch )" |
| 16 | |
16 | |
| 17 | DESCRIPTION="Based on the ${ECLASS} eclass" |
17 | DESCRIPTION="Based on the ${ECLASS} eclass" |
|
|
18 | |
|
|
19 | # This function simply returns the desired lib directory. With portage |
|
|
20 | # 2.0.51, we now have support for installing libraries to lib32/lib64 |
|
|
21 | # to accomidate the needs of multilib systems. It's no longer a good idea |
|
|
22 | # to assume all libraries will end up in lib. Replace any (sane) instances |
|
|
23 | # where lib is named directly with $(get_libdir) if possible. |
|
|
24 | # |
|
|
25 | # Travis Tilley <lv@gentoo.org> (24 Aug 2004) |
|
|
26 | get_libdir() { |
|
|
27 | if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then |
|
|
28 | # if there is an override, we want to use that... always. |
|
|
29 | CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" |
|
|
30 | elif portageq has_version / '<sys-apps/portage-2.0.51_pre20' ; then |
|
|
31 | # and if there isnt an override, and we're using a version of |
|
|
32 | # portage without CONF_LIBDIR support, force the use of lib. dolib |
|
|
33 | # and friends from portage 2.0.50 wont be too happy otherwise. |
|
|
34 | CONF_LIBDIR="lib" |
|
|
35 | fi |
|
|
36 | # and of course, default to lib if CONF_LIBDIR isnt set |
|
|
37 | echo ${CONF_LIBDIR:=lib} |
|
|
38 | } |
|
|
39 | |
|
|
40 | # Sometimes you need to override the value returned by get_libdir. A good |
|
|
41 | # example of this is xorg-x11, where lib32 isnt a supported configuration, |
|
|
42 | # and where lib64 -must- be used on amd64 (for applications that need lib |
|
|
43 | # to be 32bit, such as adobe acrobat). Note that this override also bypasses |
|
|
44 | # portage version sanity checking. |
|
|
45 | # get_libdir_override expects one argument, the result get_libdir should |
|
|
46 | # return: |
|
|
47 | # |
|
|
48 | # get_libdir_override lib64 |
|
|
49 | # |
|
|
50 | # Travis Tilley <lv@gentoo.org> (31 Aug 2004) |
|
|
51 | get_libdir_override() { |
|
|
52 | CONF_LIBDIR="$1" |
|
|
53 | CONF_LIBDIR_OVERRIDE="$1" |
|
|
54 | } |
| 18 | |
55 | |
| 19 | # This function generate linker scripts in /usr/lib for dynamic |
56 | # This function generate linker scripts in /usr/lib for dynamic |
| 20 | # libs in /lib. This is to fix linking problems when you have |
57 | # libs in /lib. This is to fix linking problems when you have |
| 21 | # the .so in /lib, and the .a in /usr/lib. What happens is that |
58 | # the .so in /lib, and the .a in /usr/lib. What happens is that |
| 22 | # in some cases when linking dynamic, the .a in /usr/lib is used |
59 | # in some cases when linking dynamic, the .a in /usr/lib is used |
| … | |
… | |
| 33 | # to point to the latest version of the library present. |
70 | # to point to the latest version of the library present. |
| 34 | # |
71 | # |
| 35 | # <azarah@gentoo.org> (26 Oct 2002) |
72 | # <azarah@gentoo.org> (26 Oct 2002) |
| 36 | # |
73 | # |
| 37 | gen_usr_ldscript() { |
74 | gen_usr_ldscript() { |
| 38 | |
|
|
| 39 | # Just make sure it exists |
75 | # Just make sure it exists |
| 40 | dodir /usr/lib |
76 | dodir /usr/$(get_libdir) |
| 41 | |
77 | |
| 42 | cat > ${D}/usr/lib/$1 <<"END_LDSCRIPT" |
78 | cat > ${D}/usr/$(get_libdir)/$1 <<"END_LDSCRIPT" |
| 43 | /* GNU ld script |
79 | /* GNU ld script |
| 44 | Because Gentoo have critical dynamic libraries |
80 | Because Gentoo have critical dynamic libraries |
| 45 | in /lib, and the static versions in /usr/lib, we |
81 | in /lib, and the static versions in /usr/lib, we |
| 46 | need to have a "fake" dynamic lib in /usr/lib, |
82 | need to have a "fake" dynamic lib in /usr/lib, |
| 47 | otherwise we run into linking problems. |
83 | otherwise we run into linking problems. |
| 48 | See bug #4411 on http://bugs.gentoo.org/ for |
84 | See bug #4411 on http://bugs.gentoo.org/ for |
| 49 | more info. */ |
85 | more info. */ |
| 50 | GROUP ( /lib/libxxx ) |
|
|
| 51 | END_LDSCRIPT |
86 | END_LDSCRIPT |
| 52 | |
87 | |
|
|
88 | echo "GROUP ( /$(get_libdir)/libxxx )" >> ${D}/usr/$(get_libdir)/$1 |
| 53 | dosed "s:libxxx:$1:" /usr/lib/$1 |
89 | dosed "s:libxxx:$1:" /usr/$(get_libdir)/$1 |
| 54 | |
90 | |
| 55 | return 0 |
91 | return 0 |
| 56 | } |
92 | } |
| 57 | |
93 | |
| 58 | # Simple function to draw a line consisting of '=' the same length as $* |
94 | # Simple function to draw a line consisting of '=' the same length as $* |