Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-osx
Navigation:
Lists: gentoo-osx: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-osx@g.o
From: Christopher Chan <cchan@...>
Subject: [PREFIX] first cut prefix.eclass
Date: Tue, 25 Apr 2006 18:43:11 -0700
>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 [ "${dir}" != "$(strip_prefix ${dir})" ]; then
        ewarn "${dir} is already prefixed"
    else
        ## make sure only one "/"
        if [ "${dir:0:1}" = "/" ]; then
            dir=${EPREFIX}${dir}
        else
            dir=${EPREFIX}/${dir}
        fi
        echo "${dir}"
    fi
}

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

    echo "${dir}" | sed -e "s:^${EPREFIX}::"
}



-- 
gentoo-osx@g.o mailing list


Replies:
Re: [PREFIX] first cut prefix.eclass
-- Grobian
Navigation:
Lists: gentoo-osx: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: [PREFIX] More prefixed ebuilds
Next by thread:
Re: [PREFIX] first cut prefix.eclass
Previous by date:
Re: [PREFIX] More prefixed ebuilds
Next by date:
Re: [PREFIX] first cut prefix.eclass


Updated Jun 17, 2009

Summary: Archive of the gentoo-osx mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.