From 364c0096f6212def20620e26a07c20c4ba95da7a Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 5 Jul 2007 06:48:46 +0000 Subject: [PATCH] Clifford Wolf: Massive cross-build fixes Also create a functional c++ cross compiler Added pci and usb utils to cross build .. tested with x86_64 and PowerPC cross-builds Stefan Fiedler: rediffed (repository of libusb, build priority of hwinfo have changed) [2007070311592911841] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@8619 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- package/base/gcc/gcc.conf | 22 +++++++-- .../gcc/gcc42/fixincludes-hotfix.patch.cross | 12 +++++ package/base/gcc/parse-config | 8 +++- package/base/gcc/wrappers.in | 1 + package/base/glibc/glibc.conf | 47 +++++++++++++++---- .../glibc/glibc26/fixup-cross-libc-so.patch | 10 ++++ package/base/hwinfo/hwinfo.desc | 2 +- package/base/libusb/libusb.desc | 2 +- package/base/linux/linux.conf | 4 +- .../pciutils/ar-ranlib-hotfix.patch.cross | 13 +++++ package/base/pciutils/no-uname-m.patch.cross | 11 +++++ package/base/pciutils/pciutils.conf | 5 ++ package/base/pciutils/pciutils.desc | 2 +- package/base/udev/udev.conf | 1 + package/base/udev/udev.desc | 2 +- package/base/usbutils/usbutils.conf | 26 ---------- package/base/usbutils/usbutils.desc | 2 +- package/base/util-linux/llseek_fixes.patch | 12 ++++- 18 files changed, 131 insertions(+), 51 deletions(-) create mode 100644 package/base/gcc/gcc42/fixincludes-hotfix.patch.cross create mode 100644 package/base/glibc/glibc26/fixup-cross-libc-so.patch create mode 100644 package/base/pciutils/ar-ranlib-hotfix.patch.cross create mode 100644 package/base/pciutils/no-uname-m.patch.cross delete mode 100644 package/base/usbutils/usbutils.conf diff --git a/package/base/gcc/gcc.conf b/package/base/gcc/gcc.conf index 6b300a633..decec0213 100644 --- a/package/base/gcc/gcc.conf +++ b/package/base/gcc/gcc.conf @@ -43,8 +43,13 @@ case "$xpkg" in ;; esac -patchfiles="`ls $confdir/gcc$pkg_gcc_version/*.patch \ - $confdir/gcc$pkg_gcc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles" +patchfiles="`ls $patchfiles $confdir/gcc$pkg_gcc_version/*.patch \ + $confdir/gcc$pkg_gcc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '`" + +if [ $stagelevel -le 1 ]; then + patchfiles="`ls $patchfiles $confdir/gcc$pkg_gcc_version/*.patch.cross \ + $confdir/gcc$pkg_gcc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`" +fi create_links() { for x ; do @@ -96,8 +101,7 @@ custmain() { # if [ $stagelevel -le 1 ] ; then echo 'Setting LANGUAGES="c" in Makefile.in.' - sed -i -e 's/LANGUAGES="[^"]*"/LANGUAGES="c"/g' \ - Makefile.in + sed -i -e 's/LANGUAGES="[^"]*"/LANGUAGES="c"/g' Makefile.in elif [ "$ROCKCFG_DEBUG" = 1 ] ; then if [ -f libstdc++*/configure ] ; then echo "Setting DEBUG_FLAGS='-s' in libstdc++ configure." @@ -188,6 +192,14 @@ custmain() { hook_eval inmake eval $MAKE prefix=$root/$prefix $makeinstopt install + if [ "$ROCKCFG_CROSSBUILD" = 1 -a -d ../libstdc++-v3 ]; then + rm -rf * + var_append CXX_WRAPPER_REMOVE " " "-lstdc++" + eval $configprefix bash ../libstdc++-v3/configure $confopt + eval make prefix=/$prefix libdir=/$prefix/lib + eval make prefix=$root/$prefix $makeinstopt install + fi + # This stuff needs manual installation # echo "Creating /$prefix/${pkg_gcc_target} ..." @@ -467,7 +479,7 @@ gcc_cross() { fi if [ "$pkg_gcc_version" != "2" ]; then - if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then + if [ "$ROCKCFG_PSEUDONATIVE" = 1 -o "$ROCKCFG_CROSSBUILD" = 1 ]; then confopt="$confopt --enable-languages=c,c++" else confopt="$confopt --enable-languages=c" diff --git a/package/base/gcc/gcc42/fixincludes-hotfix.patch.cross b/package/base/gcc/gcc42/fixincludes-hotfix.patch.cross new file mode 100644 index 000000000..36f28b5cf --- /dev/null +++ b/package/base/gcc/gcc42/fixincludes-hotfix.patch.cross @@ -0,0 +1,12 @@ +--- ./fixincludes/mkheaders.in.orig 2007-06-29 11:02:37.000000000 +0200 ++++ ./fixincludes/mkheaders.in 2007-06-29 11:04:35.000000000 +0200 +@@ -62,7 +62,8 @@ + isysroot=$1 + shift + else +- isysroot= ++ isysroot=${prefix%/usr} ++ isysroot=${isysroot%/ROCK/tools.cross/*} + fi + + # Directory in which to put host dependent programs and libraries diff --git a/package/base/gcc/parse-config b/package/base/gcc/parse-config index c8525178e..b8314d0ab 100644 --- a/package/base/gcc/parse-config +++ b/package/base/gcc/parse-config @@ -53,7 +53,7 @@ for x in CC CXX F77 ; do case "$x-$stagelevel" in CC-*) z="${archprefix}gcc ${archprefix}gcc-${y#gcc}" ;; - CXX-[2-9]) + CXX-[1-9]) z="${archprefix}g++ ${archprefix}g++-${y#gcc}" ;; F77-[2-9]) z="${archprefix}g77 ${archprefix}g77-${y#gcc}" ;; @@ -152,6 +152,12 @@ fi # if [ $stagelevel -eq 1 ]; then var_insert GCC_WRAPPER_INSERT " " "--specs=specs.cross" + if [ "$ROCKCFG_CROSSBUILD" = 1 ]; then + for x in $root/usr/include/c++/*; do + var_insert CXX_WRAPPER_INSERT " " "-I$x" + var_insert CXX_WRAPPER_INSERT " " "-I$x/$arch_target" + done + fi fi # Use our chroot specs file for pseudonative diff --git a/package/base/gcc/wrappers.in b/package/base/gcc/wrappers.in index e2dc73133..d3f6aeb7b 100644 --- a/package/base/gcc/wrappers.in +++ b/package/base/gcc/wrappers.in @@ -42,6 +42,7 @@ gcc_build_wrapper() { } gcc_build_wrapper CC ${arch_target}-cc ${arch_target}-gcc{-2,-32,-33,-34,-40,-41,-42,} +gcc_build_wrapper CXX ${arch_target}-{g++,c++}{-2,-32,-33,-34,-40,-41,-42,} gcc_build_wrapper KCC ${arch_target}-kcc{-2,-32,-33,-34,-40,-41,-42,} if [ $stagelevel -gt 1 -o "$ROCKCFG_USE_CROSSCC" = 0 ]; then diff --git a/package/base/glibc/glibc.conf b/package/base/glibc/glibc.conf index 096201dcf..053c046f1 100644 --- a/package/base/glibc/glibc.conf +++ b/package/base/glibc/glibc.conf @@ -308,11 +308,32 @@ glibc_custmain() { $configure_without_tls --cache-file=config.cache \ --build=${temp_arch_build} --host=${temp_arch_target} + # No wrong absolute path in *.so linker scripts + # this must be called from glibc makefile right after installing usr/lib/libc.so + # + if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then + export ROCK_FIXUP_CROSS_LIBC_SO=$builddir/fixup-cross-libc-so.sh + cat << EOT > $builddir/fixup-cross-libc-so.sh +if [ -f $root/$prefix/lib/libc.so ]; then + echo "Fixing $root/ROCK/tools.cross/$arch_target/lib/libc.so." + rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so + sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so +fi +if [ -f $root/$prefix/lib/libpthread.so ]; then + echo "Fixing $root/ROCK/tools.cross/$arch_target/lib/libpthread.so." + rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so + sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so +fi +EOT + chmod +x $builddir/fixup-cross-libc-so.sh + fi + eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all eval $MAKE prefix=/$prefix slibdir=/lib \ sysconfdir=/etc install_root=$root install ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a + $builddir/fixup-cross-libc-so.sh # install locales # @@ -331,15 +352,6 @@ glibc_custmain() { cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/ install_init nscd $confdir/nscd.init - # No wrong absolute path in *.so linker scripts - # - if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then - rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so - rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so - sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so - sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so - fi - # Install ld.so.conf # if [ ! -f $root/etc/ld.so.conf ] @@ -390,8 +402,23 @@ glibc_stage0() { var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \ --host=\$arch_target" + # in stage 0 we do not have the cross compiler yet. + # some configure checks which would fail without + # a working cross compiler in stage 0.. + export libc_cv_mlong_double_128=yes + export libc_cv_mlong_double_128ibm=yes + export libc_cv_mabi_ibmlongdouble=yes + export libc_cv_ppc_machine=yes + + # more configure hacks: tls support everywhere + for x in $( find .. -name configure | xargs grep libc_cv_.*_tls | \ + sed -r 's,.*(libc_cv),\1,; s,(_tls).*,\1,' | sort -u; ) + do eval "export $x=yes"; done + # due to assembler check - and we do not yet have as ... - [ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode" + if [ $arch = hppa ]; then + var_append confopt " " "--enable-hacker-mode" + fi eval "../configure --enable-add-ons"$ADDONS" $confopt" diff --git a/package/base/glibc/glibc26/fixup-cross-libc-so.patch b/package/base/glibc/glibc26/fixup-cross-libc-so.patch new file mode 100644 index 000000000..f1d3bc643 --- /dev/null +++ b/package/base/glibc/glibc26/fixup-cross-libc-so.patch @@ -0,0 +1,10 @@ +--- ./Makerules 2007-06-28 16:51:02.000000000 +0200 ++++ ./Makerules 2007-06-28 16:55:36.000000000 +0200 +@@ -993,6 +993,7 @@ + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ + ) > $@.new + mv -f $@.new $@ ++ [ -z "$$ROCK_FIXUP_CROSS_LIBC_SO" ] || $$ROCK_FIXUP_CROSS_LIBC_SO + + endif + diff --git a/package/base/hwinfo/hwinfo.desc b/package/base/hwinfo/hwinfo.desc index f43d8049e..14ab29b77 100644 --- a/package/base/hwinfo/hwinfo.desc +++ b/package/base/hwinfo/hwinfo.desc @@ -36,7 +36,7 @@ [L] GPL [S] Stable [V] 13.28 -[P] X -X---5---9 213.300 +[P] X -----5---9 213.300 [D] 2713566454 hwinfo_13.28.orig.tar.gz http://ftp.debian.org/debian/pool/main/h/hwinfo/ diff --git a/package/base/libusb/libusb.desc b/package/base/libusb/libusb.desc index fc831288b..8a0648970 100644 --- a/package/base/libusb/libusb.desc +++ b/package/base/libusb/libusb.desc @@ -37,7 +37,7 @@ [L] GPL [S] Stable [V] 0.1.12 -[P] X -?---5---9 146.400 +[P] X -X---5---9 146.400 [D] 1909515266 libusb-0.1.12.tar.gz http://dl.sf.net/libusb/ diff --git a/package/base/linux/linux.conf b/package/base/linux/linux.conf index 5f60bdd00..ddf6fcaa9 100644 --- a/package/base/linux/linux.conf +++ b/package/base/linux/linux.conf @@ -60,7 +60,7 @@ lx_kernelrelease="" if [ -z "$pkg_linux_cross" ] then lx_cpu=$( echo "$arch_machine" | \ - sed -e s/x86$/i386/ -e s/powerpc/ppc/ \ + sed -e s/x86$/i386/ \ -e s/hppa/parisc/ -e s/i.86/i386/ \ -e s/sun4u/sparc64/ -e s/arm.*/arm/ \ -e s/sa110/arm/ -e s/s390x/s390/ \ @@ -73,7 +73,7 @@ then fi else lx_cpu=$( echo "$pkg_linux_cross" | \ - sed -e s/x86$/i386/ -e s/powerpc/ppc/ \ + sed -e s/x86$/i386/ \ -e s/hppa/parisc/ -e s/i.86/i386/ \ -e s/sun4u/sparc64/ -e s/arm.*/arm/ \ -e s/sa110/arm/ -e s/s390x/s390/ \ diff --git a/package/base/pciutils/ar-ranlib-hotfix.patch.cross b/package/base/pciutils/ar-ranlib-hotfix.patch.cross new file mode 100644 index 000000000..aa8919c99 --- /dev/null +++ b/package/base/pciutils/ar-ranlib-hotfix.patch.cross @@ -0,0 +1,13 @@ +--- ./lib/Makefile.orig 2007-06-30 06:39:27.000000000 +0200 ++++ ./lib/Makefile 2007-06-30 06:39:43.000000000 +0200 +@@ -53,8 +53,8 @@ + + $(PCILIB): $(OBJS) + rm -f $@ +- ar rcs $@ $^ +- ranlib $@ ++ $(AR) rcs $@ $^ ++ $(RANLIB) $@ + + access.o: access.c $(INCL) + i386-ports.o: i386-ports.c $(INCL) i386-io-hurd.h i386-io-linux.h i386-io-sunos.h diff --git a/package/base/pciutils/no-uname-m.patch.cross b/package/base/pciutils/no-uname-m.patch.cross new file mode 100644 index 000000000..e5db175e2 --- /dev/null +++ b/package/base/pciutils/no-uname-m.patch.cross @@ -0,0 +1,11 @@ +--- ./lib/configure.orig 2007-07-01 10:00:43.000000000 +0200 ++++ ./lib/configure 2007-07-01 10:03:08.000000000 +0200 +@@ -20,7 +20,7 @@ + proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1` + cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'` + else +- cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'` ++ cpu=`echo $ROCK_ARCH | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'` + fi + if [ "$sys" = "GNU/kFreeBSD" ] + then diff --git a/package/base/pciutils/pciutils.conf b/package/base/pciutils/pciutils.conf index 0a48c026a..357c1fe1c 100644 --- a/package/base/pciutils/pciutils.conf +++ b/package/base/pciutils/pciutils.conf @@ -24,6 +24,11 @@ makeopt="PREFIX=$root/$prefix $makeopt" makeinstopt="PREFIX=$root/$prefix $makeinstopt" +# see no-uname-m.patch.cross +if [ $stagelevel -le 1 ]; then + export ROCK_ARCH="$arch" +fi + # install libpci.a library pciutils_pm () { diff --git a/package/base/pciutils/pciutils.desc b/package/base/pciutils/pciutils.desc index a7a1b6368..52958b33e 100644 --- a/package/base/pciutils/pciutils.desc +++ b/package/base/pciutils/pciutils.desc @@ -36,7 +36,7 @@ [L] GPL [S] Stable [V] 2.2.5 -[P] X -?---5---9 171.100 +[P] X -X---5---9 171.100 [D] 3447994077 pciutils-2.2.5.tar.gz ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/ diff --git a/package/base/udev/udev.conf b/package/base/udev/udev.conf index b199a6101..e314e008e 100644 --- a/package/base/udev/udev.conf +++ b/package/base/udev/udev.conf @@ -69,6 +69,7 @@ hook_add postmake 1 udev_pm hook_add premake 3 udev_prem if [ $stagelevel = 1 ] ; then + export LD=$CC var_append makeopt " " "CROSS_COMPILE=$archprefix" var_append makeinstopt " " "CROSS_COMPILE=$archprefix" fi diff --git a/package/base/udev/udev.desc b/package/base/udev/udev.desc index 611abf1a5..b64863d5b 100644 --- a/package/base/udev/udev.desc +++ b/package/base/udev/udev.desc @@ -43,7 +43,7 @@ [L] GPL [S] Beta [V] 103 1 -[P] X -X-3-----9 222.600 +[P] X -X-3-----9 171.295 [D] 1588207467 udev-103.tar.bz2 ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/ # udev configuration from linuxfromscratch.org diff --git a/package/base/usbutils/usbutils.conf b/package/base/usbutils/usbutils.conf deleted file mode 100644 index 89e9e36ae..000000000 --- a/package/base/usbutils/usbutils.conf +++ /dev/null @@ -1,26 +0,0 @@ -# --- ROCK-COPYRIGHT-NOTE-BEGIN --- -# -# This copyright note is auto-generated by ./scripts/Create-CopyPatch. -# Please add additional copyright information _after_ the line containing -# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by -# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! -# -# ROCK Linux: rock-src/package/base/usbutils/usbutils.conf -# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. A copy of the GNU General Public -# License can be found at Documentation/COPYING. -# -# Many people helped and are helping developing ROCK Linux. Please -# have a look at http://www.rocklinux.org/ and the Documentation/TEAM -# file for details. -# -# --- ROCK-COPYRIGHT-NOTE-END --- - - -[ "$arch" = "x86" -a "$ROCKCFG_X86_BITS" = "64" ] && \ - preconf="cp -v $root/usr/share/automake-1.9/config.{sub,guess} ." - diff --git a/package/base/usbutils/usbutils.desc b/package/base/usbutils/usbutils.desc index 68ad37f0f..debcbdd54 100644 --- a/package/base/usbutils/usbutils.desc +++ b/package/base/usbutils/usbutils.desc @@ -37,7 +37,7 @@ [L] GPL [S] Stable [V] 0.72 -[P] X -?---5---9 221.700 +[P] X -X---5---9 221.700 [D] 1187204070 usbutils-0.72.tar.gz http://downloads.sourceforge.net/linux-usb/ diff --git a/package/base/util-linux/llseek_fixes.patch b/package/base/util-linux/llseek_fixes.patch index 9873cc62b..fc396a6eb 100644 --- a/package/base/util-linux/llseek_fixes.patch +++ b/package/base/util-linux/llseek_fixes.patch @@ -8,7 +8,7 @@ #include #include -@@ -26,27 +27,12 @@ +@@ -26,27 +27,16 @@ #else #include /* for __NR__llseek */ @@ -29,7 +29,11 @@ unsigned int origin) { - errno = ENOSYS; - return -1; ++#ifdef __NR__llseek + return syscall(__NR__llseek, fd, oh, ol, result, origin); ++#else ++ return result = lseek64(fd, (oh<<32) | ol, origin); ++#endif } -#endif @@ -47,7 +51,7 @@ #include #include /* _syscall */ #include "nls.h" -@@ -177,9 +178,11 @@ +@@ -177,9 +178,15 @@ #endif #ifndef use_lseek @@ -57,7 +61,11 @@ +static int _llseek (unsigned int fd, unsigned long oh, + unsigned long ol, long long *result, + unsigned int origin) { ++#ifdef __NR__llseek + return syscall(__NR__llseek, fd, oh, ol, result, origin); ++#else ++ return result = lseek64(fd, (oh<<32) | ol, origin); ++#endif +} #endif