From 61d11f34886e1102631681a462aae4e77e56dc28 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 18 Sep 2014 20:25:47 -0700 Subject: Update for cross-compilation --- .gitignore | 9 +++++ Makefile.in | 3 +- configure | 5 ++- src/sanity.hpp | 10 ++--- tools/nightly | 113 ++++++++++++++++++++++++++++++++++++++++++++++----------- 5 files changed, 111 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 77f1b19..cd2d57e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,15 @@ /Makefile /config.status /lib + # nightlies /build-x86_64-linux-gnu/ /build-i586-linux-gnu/ +# the rest are not active yet, see comments in tools/nightly +/build-x86_64-linux-gnux32/ +/build-aarch64-linux-gnu/ +/build-arm-linux-gnueabi/ +/build-arm-linux-gnueabihf/ +/build-mips-linux-gnu/ +/build-mipsel-linux-gnu/ +/build-powerpc-linux-gnu/ diff --git a/Makefile.in b/Makefile.in index 3cf1817..b057328 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,6 +44,7 @@ LDLIBS = @LIBS@ CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ GTEST_DIR = @GTEST_DIR@ +GDB = @GDB@ ENABLE_WARNINGS = @ENABLE_WARNINGS@ ENABLE_ABI6 = @ENABLE_ABI6@ @@ -441,7 +442,7 @@ obj/gtest-all.pdc.o: ${GTEST_DIR}/src/gtest-all.cc $c ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $< obj/debug-debug/test.pdc.o: override CXXFLAGS += -g -O0 -gdwarf-3 -obj/run-test-debug-debug.stamp: override TESTER=gdb -return-child-result -nx -batch -x ${SRC_DIR}/tools/debug-debug.gdb --args false +obj/run-test-debug-debug.stamp: override TESTER=${GDB} -return-child-result -nx -batch -x ${SRC_DIR}/tools/debug-debug.gdb --args false obj/run-test-debug-debug.stamp: tools/debug-debug.gdb ifeq '$(findstring clang,${CXX})' 'clang' obj/run-test-debug-debug.stamp: diff --git a/configure b/configure index ee75e6e..ee3769f 100755 --- a/configure +++ b/configure @@ -38,7 +38,7 @@ from attoconf.lib.c import Cxx from attoconf.lib.install import Install from attoconf.lib.config_hash import ConfigHash from attoconf.lib.templates import Templates -from attoconf.types import enum, filepath +from attoconf.types import enum, filepath, ShellList yesno = enum('yes', 'no') @@ -85,6 +85,9 @@ class Configuration(Cxx, Install, ConfigHash, Templates): # http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog type=filepath, check=lambda build, GTEST_DIR: None, help='Location of Google Test sources, must contain src/gtest-all.cc (linking to a precompiled library is NOT supported)', hidden=False) + self.add_option('GDB', init=['gdb'], + type=ShellList, check=lambda build, GDB: None, + help='debugger to run tests', hidden=False) def add_bool_feature(self, arg, hidden=False, **kwargs): positive = '--enable-' + arg diff --git a/src/sanity.hpp b/src/sanity.hpp index c00d9b2..455990a 100644 --- a/src/sanity.hpp +++ b/src/sanity.hpp @@ -41,10 +41,10 @@ namespace tmwa #endif // __GNUC__ == 4 #if not defined(__i386__) and not defined(__x86_64__) -// Known platform dependencies: -// endianness for the [RW]FIFO.* macros -// possibly, some signal-handling -// some integer sizes (partially fixed for the x32 ABI) -# error "Unsupported platform, we use x86 / amd64 only" +// There are no longer any *known* platform-independent bits, +// but nothing has been tested yet. It compiles, though, so ship it! +# ifndef QUIET +# warning "Unsupported platform, upstream uses x86 / amd64 only" +# endif #endif // not __i386__ } // namespace tmwa diff --git a/tools/nightly b/tools/nightly index e20cdd5..c5b96ac 100755 --- a/tools/nightly +++ b/tools/nightly @@ -1,60 +1,129 @@ #!/bin/bash -e +# +# The buildbot script is only intended to run on Debian amd64 +# WWW=${HOME}/www/ -ALL_CONFIGS=( - config64 - config32 +# the cross-toolchain repo doesn't have gcc-defaults, so we have +# to specify the suffix. +CROSS_VERSION_SUFFIX=-4.9 +BUILD=x86_64-linux-gnu + +ALL_HOSTS=( + x86_64-linux-gnu + i586-linux-gnu +# x32 requires a recent kernel with appropriate flags. +# On Debian, boot with 'syscall.x32=y' on the kernel command line +# (see GRUB_CMDLINE_LINUX in /etc/default/grub) + #x86_64-linux-gnux32 +# Cross arches can be built by enabling multiarch, then installing from the +# toolchain repo at http://toolchains.secretsauce.net/ +# Executables can be run via qemu-user, but tests that require gdb fail +# (NYI: implement configure with GDB=/bin/true) +# Bug 762073 notes impossible coinstallation of mips, mipsel, and powerpc. +# dpkg-divert can only fix *one* of them. + #aarch64-linux-gnu + #arm-linux-gnueabi + #arm-linux-gnueabihf + #mips-linux-gnu + #mipsel-linux-gnu + #powerpc-linux-gnu ) -# need a special kernel for configx32 +config---help() { + set +x + echo 'Usage: tools/nightly ' + echo 'Arches are:' + echo x86_64-linux-gnu + echo i586-linux-gnu + echo x86_64-linux-gnux32 + echo aarch64-linux-gnu + echo arm-linux-gnueabi + echo arm-linux-gnueabihf + echo mips-linux-gnu + echo mipsel-linux-gnu + echo powerpc-linux-gnu + exit +} + +common-config() { + # HOST is set by the calling function + CXX=$HOST-g++$CROSS_VERSION_SUFFIX + EXTRA_LIBS=( + /lib/$HOST/libc.so.6 + /lib/$HOST/libm.so.6 + /lib/$HOST/libgcc_s.so.1 + /usr/lib/$HOST/libstdc++.so.6 + ) + GDB=/bin/true +} -config32() { + +config-x86_64-linux-gnu () { + CROSS_VERSION_SUFFIX='' common-config + GDB=gdb +} + +config-i586-linux-gnu () { # No one knows what number this is supposed to be: # - the lib directory is called i386-linux-gnu # - the 32-bit files are called i486-linux-gnu # - the cross-32 configury says i586 - HOST=i586-linux-gnu - CXX='g++ -m32' + CXX=$BUILD-'g++ -m32' EXTRA_LIBS=( /lib32/libc.so.6 /lib32/libm.so.6 /usr/lib32/libgcc_s.so.1 /usr/lib32/libstdc++.so.6 ) + GDB=gdb } -configx32() { - HOST=x86_64-linux-gnux32 - CXX='g++ -mx32' +config-x86_64-linux-gnux32 () { + CXX=$BUILD-'g++ -mx32' EXTRA_LIBS=( /libx32/libc.so.6 /libx32/libm.so.6 /usr/libx32/libgcc_s.so.1 /usr/libx32/libstdc++.so.6 ) + GDB=gdb } -config64() { - HOST=x86_64-linux-gnu - CXX='g++ -m64' - EXTRA_LIBS=( - /lib/x86_64-linux-gnu/libc.so.6 - /lib/x86_64-linux-gnu/libm.so.6 - /lib/x86_64-linux-gnu/libgcc_s.so.1 - /usr/lib/x86_64-linux-gnu/libstdc++.so.6 - ) +config-aarch64-linux-gnu () { + common-config +} + +config-arm-linux-gnueabi () { + common-config +} + +config-arm-linux-gnueabihf () { + common-config +} + +config-mips-linux-gnu () { + common-config +} + +config-mipsel-linux-gnu () { + common-config +} + +config-powerpc-linux-gnu () { + common-config } first=true set -x -for config in ${ALL_CONFIGS[@]} +for HOST in ${@:-${ALL_HOSTS[@]}} do - $config + config-$HOST mkdir -p build-$HOST cd build-$HOST - ../configure --host=$HOST CXX="$CXX -Wno-deprecated-declarations" --prefix=/. --enable-rpath=relative + ../configure --build=$BUILD --host=$HOST CXX="$CXX -Wno-deprecated-declarations -DQUIET" --prefix=/. --enable-rpath=relative GDB=$GDB rm -rf bin lib make -j3 all make -j3 test -- cgit v1.2.3-60-g2f50