1 |
>Maybe you can make the first version of $(prefix [package]) function in |
2 |
>that case. It should return the prefix that was used when installing |
3 |
>package, or when no package given, the default prefix, so it can be used |
4 |
>also in --with-xxxxx=$(prefix xxxxxx)/usr/bin/xxxxxx or something. |
5 |
> |
6 |
>There has been some discussions on this issue on this list before. Not |
7 |
>sure if I reword the idea correctly. |
8 |
|
9 |
Here's my initial stab at one. Don't know if I completely understood the fcn |
10 |
you had in mind with $(prefix [package]), if not. please explain. |
11 |
|
12 |
=========================================================================== |
13 |
|
14 |
inherit eutils |
15 |
|
16 |
# EXPORTED FUNCTION - FOR USE IN EBUILDS |
17 |
# |
18 |
# ------------------------------------------------------------------------ |
19 |
# Adds EPREFIX to the parameter, it will check to see if prefix is |
20 |
# already added |
21 |
# |
22 |
# @param $1 - directory path to add EPREFIX |
23 |
# |
24 |
# ------------------------------------------------------------------------ |
25 |
|
26 |
function prefix () { |
27 |
local dir="$1" |
28 |
|
29 |
## check for already existing prefix |
30 |
if [ "${dir}" != "$(strip_prefix ${dir})" ]; then |
31 |
ewarn "${dir} is already prefixed" |
32 |
else |
33 |
## make sure only one "/" |
34 |
if [ "${dir:0:1}" = "/" ]; then |
35 |
dir=${EPREFIX}${dir} |
36 |
else |
37 |
dir=${EPREFIX}/${dir} |
38 |
fi |
39 |
echo "${dir}" |
40 |
fi |
41 |
} |
42 |
|
43 |
# ------------------------------------------------------------------------ |
44 |
# Strips EPREFIX from the parameter. |
45 |
# |
46 |
# @param $1 - directory path to remove prefix |
47 |
# |
48 |
# ------------------------------------------------------------------------ |
49 |
function strip_prefix () { |
50 |
local dir="$1" |
51 |
|
52 |
echo "${dir}" | sed -e "s:^${EPREFIX}::" |
53 |
} |
54 |
|
55 |
|
56 |
|
57 |
-- |
58 |
gentoo-osx@g.o mailing list |