From c4cf9b41b4b7b7bc36d3878383666a77d51c804b Mon Sep 17 00:00:00 2001 From: Alfred Persson Forsberg Date: Thu, 18 Aug 2022 23:16:38 +0200 Subject: 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 Signed-off-by: Sam James --- wrappers/Makefile | 2 +- wrappers/cross-ebuild | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 wrappers/cross-ebuild (limited to 'wrappers') 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} "$@" -- cgit v1.2.3-65-gdbad