1 |
On 27/03/12 08:37, Nathan Phillip Brink wrote: |
2 |
> On Tue, Mar 27, 2012 at 05:43:43AM +0300, Nikos Chantziaras wrote: |
3 |
>> I have an ebuild that uses jam as its build system. jam supports |
4 |
>> parallel builds with -jN. However, other make options are not |
5 |
>> recognized. So in the ebuild, I can't just pass ${MAKEOPTS}. |
6 |
>> |
7 |
>> Is there a way to filter out just the "-jN" part of MAKEOPTS and pass it on? |
8 |
> |
9 |
> It looks like some eclasses just resort to sed for that: |
10 |
> |
11 |
> ohnobinki@ohnopublishing ~/portage $ grep -Re 'MAKEOPTS.*-j' /usr/portage/eclass |
12 |
> /usr/portage/eclass/toolchain.eclass: export MAKEOPTS="${MAKEOPTS} -j1" |
13 |
> /usr/portage/eclass/waf-utils.eclass: local jobs=$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/--jobs=\2/" ) |
14 |
> /usr/portage/eclass/perl-module.eclass: export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" ) |
15 |
> |
16 |
> So if you did something dirty like that, it would be enough to make |
17 |
> people happy ;-). |
18 |
|
19 |
Mr. Bones pointed out that the ebuild for games-simulation/lincity-ng |
20 |
provides a usable sed line I can use: |
21 |
|
22 |
$(echo "${MAKEOPTS}" | sed -ne "/-j/ { |
23 |
s/.*\(-j[[:space:]]*[0-9]\+\).*/\1/; p }") |
24 |
|
25 |
Indeed it does the job. |