Thomas Sachau wrote:

> I see, we have a default src_unpack and a default src_compile but a
> default src_install is still missing. Here is my suggestion (taken and
> modified from bug 33544):
> 
> src_install() {
> if [ -f Makefile -o -f GNUmakefile -o -f makefile ]; then
> emake DESTDIR=${D} install || die "emake install failed"

You need to quote $D there, eg: DESTDIR="$D" as it's a parameter to a
command there, not a temporary export (as: DESTDIR=$D emake.. would be.)

> [[ -n ${DOCS} ]] && dodoc ${DOCS}
> else
> einstall || die "einstall failed"
> [[ -n ${DOCS} ]] && dodoc ${DOCS}
> fi
> }
> 
> Any comments?

It might be wise to use an array for DOCS there, so that filenames with
spaces are dealt with correctly. (I'm thinking of all those lovely GUI
apps.)

To keep compatibility with space-separated values, I use this function:

isArr() [[ $(declare -p "$1" 2>/dev/null) = 'declare -a'* ]]

(Yes I know, it's fugly.)

So this kinda logic deals with both:
if isArr DOCS; then
   (([EMAIL PROTECTED])) && dodoc "[EMAIL PROTECTED]"
else [[ $DOCS ]] && dodoc $DOCS
fi

(There's no need to repeat it, just move it to after the previous if.)

That can easily be initialised with a glob, eg DOCS=("$S"/doc/*) (although I
recommend nullglob if doing so.)

[See http://wooledge.org:8000/BashFAQ/073 (half way down) if you need to
strip prefixes or the like.]



Reply via email to