aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred Persson Forsberg <cat@catcream.org>2022-08-18 23:16:38 +0200
committerSam James <sam@gentoo.org>2022-08-18 22:57:25 +0100
commitc4cf9b41b4b7b7bc36d3878383666a77d51c804b (patch)
tree62e3a1d11d40eee3da01c13bdab74ad26aeb6e70
parentcrossdev: Fix matching of stable keywords (diff)
downloadcrossdev-c4cf9b41b4b7b7bc36d3878383666a77d51c804b.tar.gz
crossdev-c4cf9b41b4b7b7bc36d3878383666a77d51c804b.tar.bz2
crossdev-c4cf9b41b4b7b7bc36d3878383666a77d51c804b.zip
wrappers/cross-ebuild: new file
Crossdev currently installs a dead symlink to cross-ebuild. This commit creates it. Mostly copied from cross-emerge. Signed-off-by: Alfred Persson Forsberg <cat@catcream.org> Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--wrappers/Makefile2
-rw-r--r--wrappers/cross-ebuild41
2 files changed, 42 insertions, 1 deletions
diff --git a/wrappers/Makefile b/wrappers/Makefile
index 19a1da3..79f47aa 100644
--- a/wrappers/Makefile
+++ b/wrappers/Makefile
@@ -4,7 +4,7 @@
include ../settings.mk
PORTDIR ?= $(shell portageq envvar PORTDIR)
-FNAMES = cross-emerge cross-fix-root cross-pkg-config emerge-wrapper
+FNAMES = cross-ebuild cross-emerge cross-fix-root cross-pkg-config emerge-wrapper
SITEDIR = $(PREFIX)/share/crossdev/include/site
ETC_SITEDIR = $(EPREFIX)/etc/crossdev/include/site
diff --git a/wrappers/cross-ebuild b/wrappers/cross-ebuild
new file mode 100644
index 0000000..6f47cb8
--- /dev/null
+++ b/wrappers/cross-ebuild
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright 2008-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+if [ -z "${CHOST}" ] ; then
+ CHOST=${0##*/}
+ CHOST=${CHOST%-ebuild}
+ CHOST=${CHOST#ebuild-}
+fi
+export CHOST
+
+BROOT="@GENTOO_PORTAGE_EPREFIX@"
+if [ "${BROOT}" = "@"GENTOO_PORTAGE_EPREFIX"@" ] ; then
+ BROOT=""
+fi
+
+: ${EPREFIX=}
+: ${SYSROOT=${BROOT}/usr/${CHOST}}
+: ${PORTAGE_CONFIGROOT=${SYSROOT}${EPREFIX}}
+export EPREFIX SYSROOT PORTAGE_CONFIGROOT
+
+if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
+ echo "cross-ebuild: CHOST is not set properly"
+ exit 1
+fi
+
+# Portage defaults CBUILD to CHOST, so we have to remove CHOST
+# from the env to get a "good" value for CBUILD
+query_vars="CBUILD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS"
+clean_vars="${query_vars} CHOST SYSROOT PORTAGE_CONFIGROOT"
+eval $(env $(printf -- '-u %s ' ${clean_vars}) \
+ portageq envvar -v ${query_vars} | sed s:^:_E_:)
+: ${CBUILD=${_E_CBUILD}}
+: ${BUILD_CFLAGS=${_E_CFLAGS}}
+: ${BUILD_CXXFLAGS=${_E_CXXFLAGS}}
+: ${BUILD_CPPFLAGS=${_E_CPPFLAGS}}
+: ${BUILD_LDFLAGS=${_E_LDFLAGS}}
+export CBUILD BUILD_CFLAGS BUILD_CXXFLAGS BUILD_CPPFLAGS BUILD_LDFLAGS
+
+: ${CROSS_CMD:=ebuild}
+exec ${CROSS_CMD} "$@"