On Friday 06 July 2007, Andrew Gaffney wrote:
> Philipp Riegger wrote:
> > On Thu, 2007-07-05 at 13:45 -0700, Chris Gianelloni wrote:
> >>> I'm working on the GSoC project which aims at enabling gnap builds
> >>
> >> on
> >>
> >>> non-x86 and which enables cross-compiling for gnap. I did not work
> >>> that much on the last point so far, since i'd like to know what is
> >>> already done, first.
> >>>
> >>> So... How's the status on this one?
> >>
> >> What is the status of what?  Cross-compiling?
> >
> > I was talking about the status of vapiers' cross compile patches for
> > catalyst. I talked to him since and he said he would file a bug with the
> > patches. Catalyst should be able to cross cmpile stage1 he said, only
> > not all stage1 packages work with cross compilation.
> >
> > I'm still waiting for the bug.
>
> Vapier's original cross-compilation patches to catalyst from 6 months or so
> ago only added the foundation for cross-compiling and none of the guts,
> afaict. He has been pretty busy lately, and none of the catalyst devs
> really have any idea what he was intending or the time/inclination to work
> on it ourselves. If you require catalyst cross-compiling functionality for
> your SoC project, you'd better start working on it yourself or just give up
> on your project :)

what he's referring to is me dragging my feet
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Index: catalyst
===================================================================
--- catalyst	(revision 1234)
+++ catalyst	(working copy)
@@ -91,6 +91,10 @@
 			print "Setting",x,"to default value \""+confdefaults[x]+"\""
 			conf_values[x]=confdefaults[x]
 
+	# use local stuff if we're running out of a svn dir
+	if os.path.isdir(os.path.join(os.path.dirname(sys.argv[0]), ".svn")):
+		conf_values["sharedir"] = os.path.dirname(sys.argv[0]);
+	
 	# parse out the rest of the options from the config file
 	if "autoresume" in string.split(conf_values["options"]):
 		print "Autoresuming support enabled."
Index: targets/stage1/stage1-preclean-chroot.sh
===================================================================
--- targets/stage1/stage1-preclean-chroot.sh	(revision 1234)
+++ targets/stage1/stage1-preclean-chroot.sh	(working copy)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-. /tmp/chroot-functions.sh
+. ./tmp/chroot-functions.sh
 
 # Now, some finishing touches to initialize gcc-config....
 unset ROOT
@@ -9,12 +9,12 @@
 setup_binutils
 
 # Stage1 is not going to have anything in zoneinfo, so save our Factory timezone
-if [ -d /usr/share/zoneinfo ]
+if [ -d ./usr/share/zoneinfo ]
 then
-	rm -f /etc/localtime
-	cp /usr/share/zoneinfo/Factory /etc/localtime
+	rm -f ./etc/localtime
+	cp ./usr/share/zoneinfo/Factory ./etc/localtime
 else
-	echo UTC > /etc/TZ
+	echo UTC > ./etc/TZ
 fi
 
 #if [ -n "${clst_CCACHE}" ]
Index: targets/stage1/stage1-chroot.sh
===================================================================
--- targets/stage1/stage1-chroot.sh	(revision 1234)
+++ targets/stage1/stage1-chroot.sh	(working copy)
@@ -1,13 +1,15 @@
 #!/bin/bash
 
-. /tmp/chroot-functions.sh
+. ./tmp/chroot-functions.sh
 
+set -x
+
 update_env_settings
 
 setup_myfeatures
 
 # Setup our environment
-export clst_buildpkgs="$(/tmp/build.py)"
+export clst_buildpkgs="$(./tmp/build.py)"
 export STAGE1_USE="$(portageq envvar STAGE1_USE)"
 export USE="-* build ${STAGE1_USE}"
 export FEATURES="${clst_myfeatures} nodoc noman noinfo"
@@ -25,7 +27,7 @@
 clst_root_path=/ setup_portage
 
 run_emerge "--noreplace --oneshot ${clst_buildpkgs}"
-rm -f /var/lib/portage/world
-touch /var/lib/portage/world
+rm -f ./var/lib/portage/world
+touch ./var/lib/portage/world
 
-rm -f /var/log/emerge.log
+rm -f ./var/log/emerge.log
Index: targets/support/functions.sh
===================================================================
--- targets/support/functions.sh	(revision 1234)
+++ targets/support/functions.sh	(working copy)
@@ -9,7 +9,7 @@
 		chmod 755 ${dest_dir}/${file_name}
 	else
 		echo "copying ${file_name} to ${clst_chroot_path}/tmp"
-		mkdir -p ${chroot_path}/tmp
+		mkdir -p ${clst_chroot_path}/tmp
 		cp -pPR ${1} ${clst_chroot_path}/tmp
 		chmod 755 ${clst_chroot_path}/tmp/${file_name}
 	fi
@@ -36,15 +36,31 @@
 		chroot_path=${clst_chroot_path}${subdir}
 		copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
 			${subdir}/tmp/
-		echo "Running ${file_name} in chroot ${chroot_path}" 
-		${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1
+		echo "Running ${file_name} in chroot ${chroot_path}"
+		if ${clst_crosscompile} ; then
+			pushd ${chroot_path} > /dev/null || exit 1
+			export CFLAGS="$(portageq envvar CFLAGS) --sysroot=${chroot_path}"
+			export CPPFLAGS="$(portageq envvar CPPFLAGS) --sysroot=${chroot_path}"
+			ROOT=${chroot_path} ./tmp/${file_name} || exit 1
+			popd > /dev/null
+		else
+			${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1
+		fi
 	else
 		copy_to_chroot ${1} tmp/
 		chroot_path=${clst_chroot_path}
 		copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
 			tmp/
 		echo "Running ${file_name} in chroot ${chroot_path}" 
-		${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1
+		if ${clst_crosscompile} ; then
+			pushd ${chroot_path} > /dev/null || exit 1
+			export CFLAGS="$(portageq envvar CFLAGS) --sysroot=${chroot_path}"
+			export CPPFLAGS="$(portageq envvar CPPFLAGS) --sysroot=${chroot_path}"
+			ROOT=${chroot_path} ./tmp/${file_name} || exit 1
+			popd > /dev/null
+		else
+			${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1
+		fi
 	fi
 
 	rm -f ${chroot_path}/tmp/${file_name}
@@ -217,6 +233,4 @@
 	esac
 }																												
 
-run_crossdev() {
-	crossdev ${clst_CHOST}
-}
+. ${clst_sharedir}/targets/support/cross-functions.sh
Index: targets/support/chroot-functions.sh
===================================================================
--- targets/support/chroot-functions.sh	(revision 1234)
+++ targets/support/chroot-functions.sh	(working copy)
@@ -96,9 +96,9 @@
 }
 
 setup_gcc(){
-	if [ -x /usr/bin/gcc-config ]
+	if [ -x ./usr/bin/gcc-config ]
 	then
-		mythang=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
+		mythang=$( cd ./etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
 		if [ -z "${mythang}" ]
 		then
 			mythang=1
@@ -108,9 +108,9 @@
 }
 
 setup_binutils(){
-	if [ -x /usr/bin/binutils-config ]
+	if [ -x ./usr/bin/binutils-config ]
 	then
-		mythang=$( cd /etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
+		mythang=$( cd ./etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
 		if [ -z "${mythang}" ]
 		then
 			mythang=1
@@ -120,31 +120,24 @@
 }
 
 cleanup_distcc() {
-	rm -rf /etc/distcc/hosts
+	rm -rf ./etc/distcc/hosts
 }
 
 update_env_settings(){
 	/usr/sbin/env-update
-	source /etc/profile
-	[ -f /tmp/envscript ] && source /tmp/envscript
+	${clst_crosscompile} || source /etc/profile
+	[ -f ./tmp/envscript ] && source ./tmp/envscript
 }
 
 die() {
-	echo "$1"
+	echo "$*"
 	exit 1
 }
 
 make_destpath() {
-	if  [ "${1}" = "" ]
-	then
-		export ROOT=/
-	else
-		export ROOT=${1}
-		if [ ! -d ${ROOT} ]
-		then
-			install -d ${ROOT}
-		fi
-	fi
+	export ROOT=${1:-/}
+	${clst_crosscompile} && export ROOT=${clst_chroot_path}${ROOT}
+	[ ! -d ${ROOT} ] && install -d ${ROOT}
 }
 
 run_emerge() {

Reply via email to