On 20-06-28 08:18:23, Michael Orlitzky wrote:
> As many of you probably know, ago@ has been expanding the scope of our
> CFLAGS/CC support to include some other common build variables:
> 
>   * CC
>   * CXX
>   * AR
>   * CPP
>   * NM
>   * RANLIB
>   * AS
>   * LD
> 
> Some of those are POSIX standards[0],
> 
>   * CC
>   * AR
> 
> Others are de-facto GNU make standards[1],
> 
>   * CXX
>   * CPP
>   * AS
> 
> and a few are de-facto GNU libtool standards[2]:
> 
>   * NM
>   * RANLIB
>   * LD
> 
> If we expect them all to work properly in Gentoo, we have to agree on
> what they mean, and thus how they should be injected into build systems.
> For example, we had a problem with sci-mathematics/pari, whose upstream
> is using the LD environment variable for something other than what GNU
> libtool uses it for. With LD set to something libtooly in the
> environment, the pari build fails. We can solve that by unsetting LD in
> the ebuild, but for that to be The Right Thing To Do, we should be
> expecting LD to contain something libtooly, and thus something
> inappropriate to be passed to the pari build.
> 
> To avoid these issues, I suggest creating a list of "Gentoo environment
> variables" in the devmanual with descriptions of how they should be used
> and pointers to the references (for why we chose that meaning). That way
> a user can export LD, for example, and know that it will be used how he
> thinks it will be used.
> 
> 
> [0] https://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html
> 
> [1]
> https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
> 
> [2] https://www.gnu.org/software/libtool/manual/libtool.html
> 

I'd like to suggest allowing only approved variables in the build
environment, having portage unset all variables and setting only what is
needed (or configured).

I'd like to see some variable like this used in make.conf (or maybe one
exists that I don't know about...).

# set the default bash array if GENTOO_EMERGE_ENV is not defined as an array
if ! declare -p GENTOO_EMERGE_ENV  2> /dev/null | grep -q '^declare \-a'; then
    declare -a GENTOO_EMERGE_ENV
    GENTOO_EMERGE_ENV+=("USE=\"-build\"")
    GENTOO_EMERGE_ENV+=("FEATURES=\"binpkg-multi-instance buildpkg 
parallel-fetch parallel-install\"")
    GENTOO_EMERGE_ENV+=("PKGDIR=\"/tmp/portage-pkgdir\"")
    GENTOO_EMERGE_ENV+=("DISTDIR=\"/tmp/portage-distdir\"")
    GENTOO_EMERGE_ENV+=("PORTDIR=\"/tmp/portage-portdir\"")
    export GENTOO_EMERGE_ENV
fi
# itterate over the array, exporting each 'line'
for (( i=0; i<${#GENTOO_EMERGE_ENV[@]}; i++ )); do
    eval export "${GENTOO_EMERGE_ENV[i]}"
done

-- 
Matthew Thode (prometheanfire)

Attachment: signature.asc
Description: PGP signature

Reply via email to