List Info

Thread: first cut prefix.eclass




first cut prefix.eclass
user name
2006-04-26 01:43:11
>Maybe you can make the first version of $(prefix
[package]) function in
>that case.  It should return the prefix that was used
when installing
>package, or when no package given, the default prefix,
so it can be used
>also in --with-xxxxx=$(prefix xxxxxx)/usr/bin/xxxxxx or
something.
>
>There has been some discussions on this issue on this
list before.  Not
>sure if I reword the idea correctly.

Here's my initial stab at one.  Don't know if I completely
understood the fcn
you had in mind with $(prefix [package]), if not. please
explain.

============================================================
===============

inherit eutils

# EXPORTED FUNCTION - FOR USE IN EBUILDS
#
#
------------------------------------------------------------
------------
# Adds EPREFIX to the parameter, it will check to see if
prefix is
# already added
#
# param    $1 - directory path to add EPREFIX
#
#
------------------------------------------------------------
------------

function prefix () {
    local dir="$1"

    ## check for already existing prefix
    if [ "$" != "$(strip_prefix
$)" ]; then
        ewarn "$ is already prefixed"
    else
        ## make sure only one "/"
        if [ "${dir:0:1}" = "/" ];
then
            dir=$$
        else
            dir=$/$
        fi
        echo "$"
    fi
}

#
------------------------------------------------------------
------------
# Strips EPREFIX from the parameter.
#
# param    $1 - directory path to remove prefix
#
#
------------------------------------------------------------
------------
function strip_prefix () {
    local dir="$1"

    echo "$" | sed -e
"s:^$::"
}



-- 
gentoo-osxgentoo.org mailing list

first cut prefix.eclass
user name
2006-04-26 07:45:54
On 25-04-2006 19:43:11 -0700, Christopher Chan wrote:
> Here's my initial stab at one.  Don't know if I
completely understood the fcn
> you had in mind with $(prefix [package]), if not.
please explain.

Your functions look ok to me.  Here is the thread that deals
with the
idea I talked about:

http://thread.gmane.org/gmane.linux.gentoo.macosx
/809/focus=809

thanks!

-- 
Fabian Groffen
Gentoo for Mac OS X Project
-- 
gentoo-osxgentoo.org mailing list

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )