1 |
Thomas Sachau wrote: |
2 |
|
3 |
> I see, we have a default src_unpack and a default src_compile but a |
4 |
> default src_install is still missing. Here is my suggestion (taken and |
5 |
> modified from bug 33544): |
6 |
> |
7 |
> src_install() { |
8 |
> if [ -f Makefile -o -f GNUmakefile -o -f makefile ]; then |
9 |
> emake DESTDIR=${D} install || die "emake install failed" |
10 |
|
11 |
You need to quote $D there, eg: DESTDIR="$D" as it's a parameter to a |
12 |
command there, not a temporary export (as: DESTDIR=$D emake.. would be.) |
13 |
|
14 |
> [[ -n ${DOCS} ]] && dodoc ${DOCS} |
15 |
> else |
16 |
> einstall || die "einstall failed" |
17 |
> [[ -n ${DOCS} ]] && dodoc ${DOCS} |
18 |
> fi |
19 |
> } |
20 |
> |
21 |
> Any comments? |
22 |
|
23 |
It might be wise to use an array for DOCS there, so that filenames with |
24 |
spaces are dealt with correctly. (I'm thinking of all those lovely GUI |
25 |
apps.) |
26 |
|
27 |
To keep compatibility with space-separated values, I use this function: |
28 |
|
29 |
isArr() [[ $(declare -p "$1" 2>/dev/null) = 'declare -a'* ]] |
30 |
|
31 |
(Yes I know, it's fugly.) |
32 |
|
33 |
So this kinda logic deals with both: |
34 |
if isArr DOCS; then |
35 |
((${#DOCS[@]})) && dodoc "${DOCS[@]}" |
36 |
else [[ $DOCS ]] && dodoc $DOCS |
37 |
fi |
38 |
|
39 |
(There's no need to repeat it, just move it to after the previous if.) |
40 |
|
41 |
That can easily be initialised with a glob, eg DOCS=("$S"/doc/*) (although I |
42 |
recommend nullglob if doing so.) |
43 |
|
44 |
[See http://wooledge.org:8000/BashFAQ/073 (half way down) if you need to |
45 |
strip prefixes or the like.] |