Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/crossdev:master commit in: wrappers/etc/portage/, wrappers/, wrappers/etc/portage/profile/
Date: Thu, 05 Apr 2018 22:16:17
Message-Id: 1522966319.393e1cd0c6d3ac81fa166bafe6065d42849f622c.slyfox@gentoo
1 commit: 393e1cd0c6d3ac81fa166bafe6065d42849f622c
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 5 22:11:59 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 5 22:11:59 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=393e1cd0
7
8 wrappers: create profile/ and override ARCH, LIBC and KERNEL there
9
10 Need for make.defaults:
11 portage does not allow ARCH override in make.conf anymore
12
13 Need for use.force:
14 embedded profile enforces linux target on us. It's ok as a default
15 but would be nice to be able to override it with nothing (bare-metal)
16 or other OS without existing profile.
17
18 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
19
20 wrappers/emerge-wrapper | 21 +++++++++++++++++++--
21 wrappers/etc/portage/make.conf | 11 ++++++-----
22 wrappers/etc/portage/profile/make.defaults | 3 +++
23 wrappers/etc/portage/profile/use.force | 1 +
24 4 files changed, 29 insertions(+), 7 deletions(-)
25
26 diff --git a/wrappers/emerge-wrapper b/wrappers/emerge-wrapper
27 index 2a3a91d..d23d00e 100755
28 --- a/wrappers/emerge-wrapper
29 +++ b/wrappers/emerge-wrapper
30 @@ -38,7 +38,11 @@ cross_wrap_etc()
31
32 cp -a "${PREFIX}"/share/crossdev/etc ${SYSROOT}/ || return 1
33
34 - local conf=${SYSROOT}/etc/portage/make.conf
35 + local confs=(
36 + ${SYSROOT}/etc/portage/make.conf
37 + ${SYSROOT}/etc/portage/profile/make.defaults
38 + ${SYSROOT}/etc/portage/profile/use.force
39 + )
40
41 # Re-use existing CHOST->portage ARCH mapping code
42 ARCH=$(
43 @@ -58,12 +62,25 @@ cross_wrap_etc()
44 *) emit_setup_warning "No LIBC is known for this target." ;;
45 esac
46
47 + KERNEL="__KERNEL__"
48 + case ${CHOST} in
49 + *linux*) KERNEL=linux ;;
50 + *) emit_setup_warning "No KERNEL is known for this target." ;;
51 + esac
52 + if [[ -n ${KERNEL} ]]; then
53 + USE_FORCE_KERNEL="kernel_${KERNEL}"
54 + else
55 + USE_FORCE_KERNEL=""
56 + fi
57 +
58 sed -i \
59 -e "s:__LIBC__:${LIBC}:g" \
60 -e "s:__ARCH__:${ARCH}:g" \
61 + -e "s:__KERNEL__:${KERNEL}:g" \
62 + -e "s:__USE_FORCE_KERNEL__:${USE_FORCE_KERNEL}:g" \
63 -e "s:__CHOST__:${CHOST}:g" \
64 -e "s:__CBUILD__:${CBUILD}:g" \
65 - "${conf}"
66 + "${confs[@]}"
67
68 # Try to figure out the libc version & os headers to avoid installing over top of it.
69 # XXX: Would be nice to use virtual/libc and virtual/os-headers here ...
70
71 diff --git a/wrappers/etc/portage/make.conf b/wrappers/etc/portage/make.conf
72 index 573ead0..eac5138 100644
73 --- a/wrappers/etc/portage/make.conf
74 +++ b/wrappers/etc/portage/make.conf
75 @@ -1,12 +1,15 @@
76 +# Note: profile variables are set/overridden in profile/ files:
77 +# etc/portage/profile/use.force (overrides kernel_* USE variables)
78 +# etc/portage/profile/make.defaults (overrides ARCH, KERNEL, ELIBC variables)
79 +
80 CHOST=__CHOST__
81 CBUILD=__CBUILD__
82 -ARCH=__ARCH__
83
84 -HOSTCC=__CBUILD__-gcc
85 +HOSTCC=${CBUILD}-gcc
86
87 ROOT=@GENTOO_PORTAGE_EPREFIX@/usr/${CHOST}/
88
89 -ACCEPT_KEYWORDS="__ARCH__ ~__ARCH__"
90 +ACCEPT_KEYWORDS="${ARCH} ~${ARCH}"
91
92 USE="${ARCH} -pam"
93
94 @@ -18,7 +21,5 @@ FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
95 PKGDIR=${ROOT}packages/
96 PORTAGE_TMPDIR=${ROOT}tmp/
97
98 -ELIBC="__LIBC__"
99 -
100 PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
101 #PORTDIR_OVERLAY="/usr/portage/local/"
102
103 diff --git a/wrappers/etc/portage/profile/make.defaults b/wrappers/etc/portage/profile/make.defaults
104 new file mode 100644
105 index 0000000..bf53068
106 --- /dev/null
107 +++ b/wrappers/etc/portage/profile/make.defaults
108 @@ -0,0 +1,3 @@
109 +ARCH="__ARCH__"
110 +KERNEL="-linux __KERNEL__"
111 +ELIBC="__LIBC__"
112
113 diff --git a/wrappers/etc/portage/profile/use.force b/wrappers/etc/portage/profile/use.force
114 new file mode 100644
115 index 0000000..155b31d
116 --- /dev/null
117 +++ b/wrappers/etc/portage/profile/use.force
118 @@ -0,0 +1 @@
119 +-kernel_linux __USE_FORCE_KERNEL__