Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 530382 - Add support for env/ and package.env in profile directories
Summary: Add support for env/ and package.env in profile directories
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All All
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-24 13:05 UTC by Guilherme Amadio
Modified: 2014-11-27 13:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Amadio gentoo-dev 2014-11-24 13:05:15 UTC
I am working on prefix for OS X, and on Yosemite we need only a few packages to be compiled with clang, because gcc-apple fails due to syntax changes by Apple on ObjC. Would it be possible for portage to support env/ and package.env inside profile directories? That is, I'd like to create the following:

${EPREFIX}/usr/portage/profiles/prefix/darwin/macos/10.10/env/clang:
---
CC="clang -I${EPREFIX}/usr/lib"
CXX="clang++ -I${EPREFIX}/usr/lib"
---

and

${EPREFIX}/usr/portage/profiles/prefix/darwin/macos/10.10/package.env:
---
sys-devel/binutils-apple clang
dev-lang/python clang
dev-libs/glib clang
---

This would also make sense in systems with Xeon Phi cards, where only a few packages need to be compiled with icc and/or to run on the card with the -mmic flag set, so we could provide the make.profile/env/intel and make.profile/env/intel-mic file with the necessary flags and let users add packages they want to package.env.


Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2014-11-24 17:37:47 UTC
In the master branch we have support for package.bashrc in profiles, which is similar to package.env except that is refers to bashrc files that support complete bash syntax:

https://github.com/gentoo/portage/commit/803dafc462027d6015721f40513abb5f57dc1178

The patch includes documentation in man/portage.5. You should be able to use this for your clang configuration. You can test now with portage-9999 if you like. You'll have to set "profile-formats = profile-bashrcs" in metadata/layout.conf of the repository containing your profiles.

If package.bashrc fits your needs, then we can update the description of this bug to refer to package.bashrc instead of package.env.
Comment 2 Zac Medico gentoo-dev 2014-11-24 17:43:48 UTC
It looks like that prefix branch hasn't merged the profile-bashrcs patches yet, but you can cherry pick these three commits from the master branch:

60ee4deefb701d532fdd279caa989e7a6f4b8400
1d351a59a57e018e9c79a371f0cae21505c2249c
803dafc462027d6015721f40513abb5f57dc1178
Comment 3 Guilherme Amadio gentoo-dev 2014-11-26 13:36:27 UTC
We are using the profile bashrc currently, but it looks like this:

${EPREFIX}/usr/portage/profiles/prefix/darwin/macos/10.10/profile.bashrc
---
# some packages need to be compiled with clang on 10.10
local pkgs_clang pkg

pkgs_clang=(
        dev-libs/glib
        dev-lang/python
        sys-devel/binutils-apple
)

for pkg in ${pkgs_clang[@]} ; do
        if [[ ${CATEGORY}/${PN} == ${pkg} ]]; then
                CC="clang -I${EPREFIX}/usr/include"
                CXX="clang++ -I${EPREFIX}/usr/include"
        fi
done
---

Although this solution works, it's not as nice as the split env/ and package.env system that is supported in $EPREFIX/etc/portage/

I think that if it's not hard to support the same system in profile directories, it might be worth adding.
Comment 4 Zac Medico gentoo-dev 2014-11-26 18:12:30 UTC
(In reply to Guilherme Amadio from comment #3)
> Although this solution works, it's not as nice as the split env/ and
> package.env system that is supported in $EPREFIX/etc/portage/

The package.bashrc thing that I mentioned in comment #1 is very similar to package.env. It's like a hybrid between package.env and profile.bashrc.

> I think that if it's not hard to support the same system in profile
> directories, it might be worth adding.

It's not hard. However, package.bashrc is very similar, and it is more flexible than package.env in some ways because it supports full bash syntax.
Comment 5 Guilherme Amadio gentoo-dev 2014-11-27 13:42:14 UTC
I'm sorry, I read your commit again and now I understand it correctly. I thought I'd have to create bashrc/pkg-category/package.bashrc for each package before—my bad. The per package bashrc mechanism will do just fine. I'm closing this bug. Thanks!