aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2018-04-05 23:11:59 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2018-04-05 23:11:59 +0100
commit393e1cd0c6d3ac81fa166bafe6065d42849f622c (patch)
treec7ee1c452a70ed128ca0511de9ae6793454409b1 /wrappers
parentemerge-wrapper: add a note that 'package.provided' are normally incomplete (diff)
downloadcrossdev-393e1cd0c6d3ac81fa166bafe6065d42849f622c.tar.gz
crossdev-393e1cd0c6d3ac81fa166bafe6065d42849f622c.tar.bz2
crossdev-393e1cd0c6d3ac81fa166bafe6065d42849f622c.zip
wrappers: create profile/ and override ARCH, LIBC and KERNEL there
Need for make.defaults: portage does not allow ARCH override in make.conf anymore Need for use.force: embedded profile enforces linux target on us. It's ok as a default but would be nice to be able to override it with nothing (bare-metal) or other OS without existing profile. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'wrappers')
-rwxr-xr-xwrappers/emerge-wrapper21
-rw-r--r--wrappers/etc/portage/make.conf11
-rw-r--r--wrappers/etc/portage/profile/make.defaults3
-rw-r--r--wrappers/etc/portage/profile/use.force1
4 files changed, 29 insertions, 7 deletions
diff --git a/wrappers/emerge-wrapper b/wrappers/emerge-wrapper
index 2a3a91d..d23d00e 100755
--- a/wrappers/emerge-wrapper
+++ b/wrappers/emerge-wrapper
@@ -38,7 +38,11 @@ cross_wrap_etc()
cp -a "${PREFIX}"/share/crossdev/etc ${SYSROOT}/ || return 1
- local conf=${SYSROOT}/etc/portage/make.conf
+ local confs=(
+ ${SYSROOT}/etc/portage/make.conf
+ ${SYSROOT}/etc/portage/profile/make.defaults
+ ${SYSROOT}/etc/portage/profile/use.force
+ )
# Re-use existing CHOST->portage ARCH mapping code
ARCH=$(
@@ -58,12 +62,25 @@ cross_wrap_etc()
*) emit_setup_warning "No LIBC is known for this target." ;;
esac
+ KERNEL="__KERNEL__"
+ case ${CHOST} in
+ *linux*) KERNEL=linux ;;
+ *) emit_setup_warning "No KERNEL is known for this target." ;;
+ esac
+ if [[ -n ${KERNEL} ]]; then
+ USE_FORCE_KERNEL="kernel_${KERNEL}"
+ else
+ USE_FORCE_KERNEL=""
+ fi
+
sed -i \
-e "s:__LIBC__:${LIBC}:g" \
-e "s:__ARCH__:${ARCH}:g" \
+ -e "s:__KERNEL__:${KERNEL}:g" \
+ -e "s:__USE_FORCE_KERNEL__:${USE_FORCE_KERNEL}:g" \
-e "s:__CHOST__:${CHOST}:g" \
-e "s:__CBUILD__:${CBUILD}:g" \
- "${conf}"
+ "${confs[@]}"
# Try to figure out the libc version & os headers to avoid installing over top of it.
# XXX: Would be nice to use virtual/libc and virtual/os-headers here ...
diff --git a/wrappers/etc/portage/make.conf b/wrappers/etc/portage/make.conf
index 573ead0..eac5138 100644
--- a/wrappers/etc/portage/make.conf
+++ b/wrappers/etc/portage/make.conf
@@ -1,12 +1,15 @@
+# Note: profile variables are set/overridden in profile/ files:
+# etc/portage/profile/use.force (overrides kernel_* USE variables)
+# etc/portage/profile/make.defaults (overrides ARCH, KERNEL, ELIBC variables)
+
CHOST=__CHOST__
CBUILD=__CBUILD__
-ARCH=__ARCH__
-HOSTCC=__CBUILD__-gcc
+HOSTCC=${CBUILD}-gcc
ROOT=@GENTOO_PORTAGE_EPREFIX@/usr/${CHOST}/
-ACCEPT_KEYWORDS="__ARCH__ ~__ARCH__"
+ACCEPT_KEYWORDS="${ARCH} ~${ARCH}"
USE="${ARCH} -pam"
@@ -18,7 +21,5 @@ FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
PKGDIR=${ROOT}packages/
PORTAGE_TMPDIR=${ROOT}tmp/
-ELIBC="__LIBC__"
-
PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
#PORTDIR_OVERLAY="/usr/portage/local/"
diff --git a/wrappers/etc/portage/profile/make.defaults b/wrappers/etc/portage/profile/make.defaults
new file mode 100644
index 0000000..bf53068
--- /dev/null
+++ b/wrappers/etc/portage/profile/make.defaults
@@ -0,0 +1,3 @@
+ARCH="__ARCH__"
+KERNEL="-linux __KERNEL__"
+ELIBC="__LIBC__"
diff --git a/wrappers/etc/portage/profile/use.force b/wrappers/etc/portage/profile/use.force
new file mode 100644
index 0000000..155b31d
--- /dev/null
+++ b/wrappers/etc/portage/profile/use.force
@@ -0,0 +1 @@
+-kernel_linux __USE_FORCE_KERNEL__