Gentoo Archives: gentoo-devhelp

From: Michael Orlitzky <mjo@g.o>
To: gentoo-devhelp@l.g.o
Subject: Re: [gentoo-devhelp] Building project twice in the same ebuild
Date: Tue, 17 Feb 2015 17:48:45
Message-Id: 54E37EEF.7060402@gentoo.org
In Reply to: [gentoo-devhelp] Building project twice in the same ebuild by Nikos Chantziaras
1 On 02/15/2015 09:32 PM, Nikos Chantziaras wrote:
2 > I need to build a project (which uses cmake) twice and install it twice.
3 > Each time with a different configuration. The files it generates in each
4 > configuration do not conflict with each other (except for share/doc/).
5 >
6 > Which configs are built depends on USE flags. Either qt4, qt5 or both.
7 >
8 > How would I go on about this? The project's build system *can not* build
9 > both sets in the same build. When building normally, outside of portage,
10 > this is built with:
11 >
12 > mkdir build && cd build
13 > cmake -DQT_VERSION=4 ../
14 > make && make install
15 > rm -r *
16 > cmake -DQT_VERSION=5 ../
17 > make && make install
18 >
19 > I'm not sure I can do something like that in an ebuild.
20 >
21
22 I would set S="${WORKDIR}" and then in src_prepare(), make a copy of the
23 entire package directory. The configure, compile, etc. phases would look
24 something like,
25
26 src_compile() {
27 for qt in 4 5; do # Make this list from the user's USE flags
28 cd "${WORKDIR}/${P}-qt${qt}" || die
29 cmake -DQT_VERSION=${qt} || die
30 emake
31 done
32 }