Gentoo Archives: gentoo-dev

From: Nathan Phillip Brink <binki@g.o>
To: Willian Vale da Rocha <will.vdr@×××××.com>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Linking Stage, building a ebuild
Date: Fri, 02 Dec 2011 03:42:32
Message-Id: 20111202033725.GB10880@ohnopublishing.net
In Reply to: [gentoo-dev] Linking Stage, building a ebuild by Willian Vale da Rocha
1 On Fri, Dec 02, 2011 at 12:22:30AM -0300, Willian Vale da Rocha wrote:
2 > I'm writing a ebuild for GNU Radio, just to learn how to write and i
3 > doesn't found any where(or i was looking for wrong) how to define a LDFLAGS
4 > for the linking stage. GNU Radio need this because they use their library.
5 > If i don't explain correct, i going to show the line command that i trying
6 > to explain
7 > <pre>
8 > ./configure --prefix=$HOME/image LDFLAGS="-L$HOME/image/lib64
9 > <\pre>
10 > If i need to define prefix, how can i do it, and How can i use the LDFLAGS
11 > in ebuild
12 >
13 > Sorry about the english
14
15 Just so you know, such questions generally belong on the
16 gentoo-devhelp mailing list or in
17 irc://chat.freenode.net/gentoo-dev-help.
18
19 In an attempt to answer your question, you should use the flag-o-matic
20 eclass to append directives to LDFLAGS. For example:
21
22 inherit flag-o-matic multilib
23
24 src_configure() {
25 append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/special_package \
26 -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/special_package
27
28 econf
29 }
30
31 But you appear to be trying to link to something outside of a normal
32 Gentoo install. If a user wanted to link a program against his own
33 compiled copy of the library, he would instead just invoke emerge with
34 the proper LDFLAGS:
35
36 # LDFLAGS=-L"${HOME}"/image/lib64\ -Wl,-rpath,"${HOME}"/images/lib64 emerge -v my_package
37
38 If you are writing your ebuild to compile against a package/library
39 which is not available in portage, your first step should be to write
40 an ebuild for _that_ package. I.e., write the ebuild for the library
41 your program needs before writing the ebuild for the program. Then the
42 library would be properly installed into /usr/$(get_libdir) and appear
43 in GCC's normal searchpaths.
44
45 If this does not help, please ask again in #gentoo-dev-help or the
46 gentoo-devhelp ML :-).
47
48 --
49 binki
50
51 Look out for missing or extraneous apostrophes!