diff options
27 files changed, 514 insertions, 59 deletions
@@ -32,7 +32,9 @@ temp.* stamp-h1 # Testing -testing/docker/build-* +testing/docker/*/build +testing/docker/*/install +testing/docker/*/xtools # This is the place where toolchains are built .build/ diff --git a/configure.ac b/configure.ac index 4e14db2..791cb7a 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,7 @@ CTNG_CHECK_PROGS_REQ([bzip2], [bzip2]) CTNG_CHECK_PROGS_REQ([xz], [xz]) CTNG_CHECK_PROGS_REQ([unzip], [unzip]) CTNG_CHECK_PROGS_REQ([help2man], [help2man]) +CTNG_CHECK_PROGS_REQ([file], [file]) # Not a fatal failure even if we have neither - the tarballs may # be provided in a local directory. @@ -171,7 +172,7 @@ CTNG_PROG_VERSION_REQ_ANY([MAKE], [make_3_81_or_newer]) # Check other companion tools that we may or may not build. -CTNG_PROG_VERSION_REQ_STRICT([LIBTOOL], +CTNG_PROG_VERSION([LIBTOOL], [GNU libtool >= 2.4], [libtool], [glibtool libtool], diff --git a/packages/android-ndk/r18/DO_NOT_IMPORT b/packages/android-ndk/r18/DO_NOT_IMPORT new file mode 100644 index 0000000..f2d097f --- /dev/null +++ b/packages/android-ndk/r18/DO_NOT_IMPORT @@ -0,0 +1,2 @@ +r18 removed the support for GCC and is therefore useless in +crosstool-NG (unless clang is supported). diff --git a/packages/android-ndk/r18/chksum b/packages/android-ndk/r18/chksum deleted file mode 100644 index 32f2ab3..0000000 --- a/packages/android-ndk/r18/chksum +++ /dev/null @@ -1,4 +0,0 @@ -md5 android-ndk-r18-linux-x86_64.zip 41a86d61b2c003db139f2c8ba139086c -sha1 android-ndk-r18-linux-x86_64.zip 2ac2e8e1ef73ed551cac3a1479bb28bd49369212 -sha256 android-ndk-r18-linux-x86_64.zip c413dd014edc37f822d0dc88fabc05b64232d07d5c6e9345224e47073fdf140b -sha512 android-ndk-r18-linux-x86_64.zip 7a8b372be53a7d5a008b6cafda451096623af33aea910edd8e98ee4b15682da5d2ad641727ab12eca522ba965073a3eb247cd3cd850c9b602e2c7b1cd6eec708 diff --git a/packages/android-ndk/r18/version.desc b/packages/android-ndk/r18/version.desc deleted file mode 100644 index e69de29..0000000 --- a/packages/android-ndk/r18/version.desc +++ /dev/null diff --git a/packages/binutils/2.31.1/0011-Restore-build-on-x86_64-w64-mingw32.patch b/packages/binutils/2.31.1/0011-Restore-build-on-x86_64-w64-mingw32.patch new file mode 100644 index 0000000..d94293d --- /dev/null +++ b/packages/binutils/2.31.1/0011-Restore-build-on-x86_64-w64-mingw32.patch @@ -0,0 +1,122 @@ +From be07c0ea2b943fe0bc8009432eadf157bbc2b718 Mon Sep 17 00:00:00 2001 +From: Alexey Neyman <stilor@att.net> +Date: Sun, 7 Oct 2018 11:57:49 -0700 +Subject: [PATCH] Restore build on x86_64-w64-mingw32 + + * gold/configure.ac: Add checks for link, mkdtemp. + * gold/configure: Regenerated. + * gold/config.in: Regenerated. + * gold/plugin.cc (Plugin_recorder::init): Fall back to mktemp + if mkdtemp is not available. + (link_or_copy_file): Fall back to copy if link() is not available. + +Signed-off-by: Alexey Neyman <stilor@att.net> +--- + gold/config.in | 6 ++++++ + gold/configure | 9 ++++++++- + gold/configure.ac | 5 ++++- + gold/plugin.cc | 14 ++++++++++++++ + 4 files changed, 32 insertions(+), 2 deletions(-) + +--- a/gold/config.in ++++ b/gold/config.in +@@ -103,6 +103,9 @@ + /* Define if your <locale.h> file defines LC_MESSAGES. */ + #undef HAVE_LC_MESSAGES + ++/* Define to 1 if you have the `link' function. */ ++#undef HAVE_LINK ++ + /* Define to 1 if you have the <locale.h> header file. */ + #undef HAVE_LOCALE_H + +@@ -112,6 +115,9 @@ + /* Define to 1 if you have the <memory.h> header file. */ + #undef HAVE_MEMORY_H + ++/* Define to 1 if you have the `mkdtemp' function. */ ++#undef HAVE_MKDTEMP ++ + /* Define to 1 if you have the `mmap' function. */ + #undef HAVE_MMAP + +--- a/gold/configure ++++ b/gold/configure +@@ -7977,7 +7977,7 @@ + + done + +-for ac_func in chsize mmap ++for ac_func in chsize mmap link + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +@@ -9878,6 +9878,13 @@ + fi + done + ++ac_fn_cxx_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp" ++if test "x$ac_cv_func_mkdtemp" = xyes; then : ++ ++$as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h ++ ++fi ++ + ac_fn_cxx_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default" + if test "x$ac_cv_have_decl_basename" = xyes; then : + ac_have_decl=1 +--- a/gold/configure.ac ++++ b/gold/configure.ac +@@ -529,7 +529,7 @@ + AC_SUBST(LFS_CFLAGS) + + AC_CHECK_HEADERS(sys/mman.h) +-AC_CHECK_FUNCS(chsize mmap) ++AC_CHECK_FUNCS(chsize mmap link) + AC_REPLACE_FUNCS(pread ftruncate ffsll) + + AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove], +@@ -614,6 +614,9 @@ + AC_SUBST(DLOPEN_LIBS) + + AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times) ++AC_CHECK_FUNC([mkdtemp], ++ AC_DEFINE([HAVE_MKDTEMP], 1, ++ [Define to 1 if you have the `mkdtemp' function.])) + AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem]) + + # Use of ::std::tr1::unordered_map::rehash causes undefined symbols +--- a/gold/plugin.cc ++++ b/gold/plugin.cc +@@ -508,8 +508,20 @@ + // Create a temporary directory where we can stash the log and + // copies of replacement files. + char dir_template[] = "gold-recording-XXXXXX"; ++#ifdef HAVE_MKDTEMP + if (mkdtemp(dir_template) == NULL) + return false; ++#else ++ if (mktemp(dir_template) == NULL) ++ return false; ++#if defined (_WIN32) && !defined (__CYGWIN32__) ++ if (mkdir(dir_template) != 0) ++ return false; ++#else ++ if (mkdir(dir_template, 0700) != 0) ++ return false; ++#endif ++#endif + + size_t len = strlen(dir_template) + 1; + char* tempdir = new char[len]; +@@ -562,8 +574,10 @@ + { + static char buf[4096]; + ++#ifdef HAVE_LINK + if (::link(inname, outname) == 0) + return true; ++#endif + + int in = ::open(inname, O_RDONLY); + if (in < 0) diff --git a/packages/glibc/2.15/0050-fdivp-order.patch b/packages/glibc/2.15/0050-fdivp-order.patch new file mode 100644 index 0000000..159c9c4 --- /dev/null +++ b/packages/glibc/2.15/0050-fdivp-order.patch @@ -0,0 +1,27 @@ +commit 751728a1f10cdaf35c499c1d508a3a28ccfddc92 +Author: Marek Polacek <polacek@redhat.com> +Date: Mon Apr 16 11:03:41 2012 +0200 + + Reverse arguments of fdivp in i386 code. + +--- + sysdeps/i386/fpu/bits/fenv.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/sysdeps/i386/fpu/bits/fenv.h ++++ b/sysdeps/i386/fpu/bits/fenv.h +@@ -1,4 +1,4 @@ +-/* Copyright (C) 1997, 1998, 1999, 2000, 2011 Free Software Foundation, Inc. ++/* Copyright (C) 1997-2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or +@@ -122,7 +122,7 @@ + # ifdef __SSE_MATH__ + __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g)); + # else +- __asm__ __volatile__ ("fdivp %%st(1), %%st; fwait" ++ __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait" + : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); + # endif + (void) &__f; diff --git a/packages/m4/1.4.18/0000-fix-glibc-2.28.patch b/packages/m4/1.4.18/0000-fix-glibc-2.28.patch new file mode 100644 index 0000000..d47a709 --- /dev/null +++ b/packages/m4/1.4.18/0000-fix-glibc-2.28.patch @@ -0,0 +1,144 @@ +commit 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e +Author: Paul Eggert <eggert@cs.ucla.edu> +Date: Mon Mar 5 10:56:29 2018 -0800 + + fflush: adjust to glibc 2.28 libio.h removal + + Problem reported by Daniel P. Berrangé in: + https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html + * lib/fbufmode.c (fbufmode): + * lib/fflush.c (clear_ungetc_buffer_preserving_position) + (disable_seek_optimization, rpl_fflush): + * lib/fpending.c (__fpending): + * lib/fpurge.c (fpurge): + * lib/freadable.c (freadable): + * lib/freadahead.c (freadahead): + * lib/freading.c (freading): + * lib/freadptr.c (freadptr): + * lib/freadseek.c (freadptrinc): + * lib/fseeko.c (fseeko): + * lib/fseterr.c (fseterr): + * lib/fwritable.c (fwritable): + * lib/fwriting.c (fwriting): + Check _IO_EOF_SEEN instead of _IO_ftrylockfile. + * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]: + Define if not already defined. + +--- + lib/fflush.c | 6 +++--- + lib/fpending.c | 2 +- + lib/fpurge.c | 2 +- + lib/freadahead.c | 2 +- + lib/freading.c | 2 +- + lib/fseeko.c | 4 ++-- + lib/stdio-impl.h | 6 ++++++ + 7 files changed, 15 insertions(+), 9 deletions(-) + +--- a/lib/fflush.c ++++ b/lib/fflush.c +@@ -33,7 +33,7 @@ + #undef fflush + + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ + static void +@@ -72,7 +72,7 @@ + + #endif + +-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) ++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) + + # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ +@@ -148,7 +148,7 @@ + if (stream == NULL || ! freading (stream)) + return fflush (stream); + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + clear_ungetc_buffer_preserving_position (stream); + +--- a/lib/fpending.c ++++ b/lib/fpending.c +@@ -32,7 +32,7 @@ + /* Most systems provide FILE as a struct and the necessary bitmask in + <stdio.h>, because they need it for implementing getc() and putc() as + fast macros. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return fp->_IO_write_ptr - fp->_IO_write_base; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ +--- a/lib/fpurge.c ++++ b/lib/fpurge.c +@@ -62,7 +62,7 @@ + /* Most systems provide FILE as a struct and the necessary bitmask in + <stdio.h>, because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_IO_read_end = fp->_IO_read_ptr; + fp->_IO_write_ptr = fp->_IO_write_base; + /* Avoid memory leak when there is an active ungetc buffer. */ +--- a/lib/freadahead.c ++++ b/lib/freadahead.c +@@ -25,7 +25,7 @@ + size_t + freadahead (FILE *fp) + { +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_write_ptr > fp->_IO_write_base) + return 0; + return (fp->_IO_read_end - fp->_IO_read_ptr) +--- a/lib/freading.c ++++ b/lib/freading.c +@@ -31,7 +31,7 @@ + /* Most systems provide FILE as a struct and the necessary bitmask in + <stdio.h>, because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return ((fp->_flags & _IO_NO_WRITES) != 0 + || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 + && fp->_IO_read_base != NULL)); +--- a/lib/fseeko.c ++++ b/lib/fseeko.c +@@ -47,7 +47,7 @@ + #endif + + /* These tests are based on fpurge.c. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_read_end == fp->_IO_read_ptr + && fp->_IO_write_ptr == fp->_IO_write_base + && fp->_IO_save_base == NULL) +@@ -123,7 +123,7 @@ + return -1; + } + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags &= ~_IO_EOF_SEEN; + fp->_offset = pos; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ +--- a/lib/stdio-impl.h ++++ b/lib/stdio-impl.h +@@ -18,6 +18,12 @@ + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + ++/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this ++ problem by defining it ourselves. FIXME: Do not rely on glibc ++ internals. */ ++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN ++# define _IO_IN_BACKUP 0x100 ++#endif + + /* BSD stdio derived implementations. */ + diff --git a/packages/newlib/package.desc b/packages/newlib/package.desc index 5d09a77..0d2819b 100644 --- a/packages/newlib/package.desc +++ b/packages/newlib/package.desc @@ -1,5 +1,7 @@ origin='RedHat' repository='git git://sourceware.org/git/newlib-cygwin.git' +# Do not use "$(CT_Mirrors sourceware newlib)" here: the mirrors (kernel.org +# and gnu.org) only store some older releases of newlib (2.0.0 and before). mirrors='ftp://sourceware.org/pub/newlib' milestones='2.0 2.1 2.2' relevantpattern='*.*.*|.' diff --git a/scripts/build/arch/powerpc.sh b/scripts/build/arch/powerpc.sh index 7dd5ac5..36a727a 100644 --- a/scripts/build/arch/powerpc.sh +++ b/scripts/build/arch/powerpc.sh @@ -12,7 +12,7 @@ CT_DoArchTupleValues () { ;; spe) case "${CT_LIBC}" in - none|newlib) CT_TARGET_SYS="spe";; + none|newlib) CT_TARGET_SYS="elfspe";; *glibc) CT_TARGET_SYS="gnuspe";; uClibc) CT_TARGET_SYS="uclibcgnuspe";; esac diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index f38fd7f..7a74574 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -468,7 +468,11 @@ do_gcc_core_backend() { local glibc_version CT_GetPkgVersion GLIBC glibc_version - glibc_version=`echo "${glibc_version}" | sed 's/\([1-9][0-9]*\.[1-9][0-9]*\).*/\1/'` + case "${glibc_version}" in + new) glibc_version=99.99;; + old) glibc_version=1.0;; + *) glibc_version=`echo "${glibc_version}" | sed 's/\([1-9][0-9]*\.[1-9][0-9]*\).*/\1/'`;; + esac extra_config+=("--with-glibc-version=${glibc_version}") fi diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index bc48cee..125ccf7 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -23,8 +23,8 @@ do_libc_extract() { # we do not support concurrent use of the source directory # and next run, if using different glibc-ports source, will override # this symlink anyway. - CT_DoExecLog ALL ln -sf "${CT_GLIBC_PORTS_SRC_DIR}/${CT_GLIBC_PORTS_BASENAME}" \ - "${CT_GLIBC_SRC_DIR}/${CT_GLIBC_BASENAME}/ports" + CT_DoExecLog ALL ln -sf "${CT_SRC_DIR}/${CT_GLIBC_PORTS_DIR_NAME}" \ + "${CT_SRC_DIR}/${CT_GLIBC_DIR_NAME}/ports" fi } diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh index fb6856e..ccfe29c 100644 --- a/scripts/crosstool-NG.sh +++ b/scripts/crosstool-NG.sh @@ -208,7 +208,7 @@ CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs" CT_COMMON_SRC_DIR="${CT_WORK_DIR}/src" CT_SRC_DIR="${CT_BUILD_TOP_DIR}/src" CT_BUILDTOOLS_PREFIX_DIR="${CT_BUILD_TOP_DIR}/buildtools" -CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state" +CT_STATE_DIR="${CT_BUILD_TOP_DIR}/state" # Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a # sub-dir. So we won't have to save/restore it, not even create it. # In case of cross or native, host-complibs are used for build-complibs; diff --git a/scripts/functions b/scripts/functions index 2e875f7..272f368 100644 --- a/scripts/functions +++ b/scripts/functions @@ -13,7 +13,7 @@ CT_LoadConfig() { # It also sets KERNEL/ARCH/... for file inclusion below. Does not handle # recursive definitions yet. We don't need arrays at this point. CT_TestOrAbort "Configuration file not found. Please create one." -r .config - . .config + . ./.config # Prefixing with ./ prevents Bash from searching $PATH # Include sub-scripts instead of calling them: that way, we do not have to # export any variable, nor re-parse the configuration and functions files. @@ -37,7 +37,7 @@ CT_LoadConfig() { oldvals="" try=0 while [ "$try" -le 10 ]; do - . .config + . ./.config # Prefixing with ./ prevents Bash from searching $PATH vals=`set | ${grep} -E '^CT_'` if [ "$oldvals" = "$vals" ]; then break @@ -752,7 +752,9 @@ CT_DoGetFile() } # This function saves the specified to local storage if possible, -# and if so, symlinks it for later usage +# and if so, symlinks it for later usage. This function is called from +# the `if' condition (via the CT_GetFile) and therefore must return +# on error rather than relying on the shell's ERR trap to catch it. # Usage: CT_SaveLocal </full/path/file.name> CT_SaveLocal() { @@ -762,9 +764,22 @@ CT_SaveLocal() if [ "${CT_SAVE_TARBALLS}" = "y" ]; then CT_DoLog EXTRA "Saving '${basename}' to local storage" # The file may already exist if downloads are forced: remove it first - CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${basename}" - CT_DoExecLog ALL mv -f "${file}" "${CT_LOCAL_TARBALLS_DIR}" - CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}" "${file}" + if ! CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${basename}"; then + return 1 + fi + if ! CT_DoExecLog ALL mv -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"; then + # Move may have failed if the local tarball storage is on a different + # filesystem. Fallback to copy+delete. + if ! CT_DoExecLog ALL cp -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"; then + return 1 + fi + if ! CT_DoExecLog ALL rm -f "${file}"; then + return 1 + fi + fi + if ! CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}" "${file}"; then + return 1 + fi fi } @@ -887,7 +902,12 @@ CT_DoVerifySignature() CT_Popd # If we get here, verification succeeded. - CT_SaveLocal "${CT_TARBALLS_DIR}/${sigfile}${ext}" + if ! CT_SaveLocal "${CT_TARBALLS_DIR}/${sigfile}${ext}"; then + CT_Popd + return 1 + fi + + return 0 } # Download the file from one of the URLs passed as argument @@ -972,7 +992,9 @@ CT_GetFile() CT_DoExecLog ALL rm "${CT_TARBALLS_DIR}/${basename}${ext}" return 1 fi - CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}${ext}" + if ! CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}${ext}"; then + return 1 + fi return 0 fi done @@ -1794,7 +1816,6 @@ CT_GetVersion_hg() # to clone if cset is not known and a branch is given. if [ -z "${devel_revision}" ]; then if [ -z "${devel_branch}" ]; then - # Mercurial does not allow querying branches devel_revision=`hg identify "${devel_url}"` else CT_DoLog WARN "${pkg_name}: Mercurial cannot query non-default branch, will clone" @@ -1831,46 +1852,97 @@ CT_GetVersion_git() CT_Abort "${pkg_name}: cannot specify both branch and changeset for Git" fi - devel_branch="${devel_branch:-master}" + # Do not modify devel_branch so that we can check if it has been set by user + # in CT_Download_git. + local branch="${devel_branch:-master}" + if [ -z "${devel_revision}" ]; then - local matches=`git ls-remote --exit-code "${devel_url}" --refs "${devel_branch}" \ + local matches=`git ls-remote --exit-code "${devel_url}" --refs "${branch}" \ || echo "not found"` local best using ref # Cannot test $?, setting a trap on ERR prevents bash from returning the # status code. if [ "${matches}" = "not found" ]; then - CT_Abort "Failed to find git ref ${devel_branch} at ${devel_url}" + CT_Abort "Failed to find git ref ${branch} at ${devel_url}" fi if [ `echo "${matches}" | wc -l` -gt 1 ]; then - if echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${devel_branch}\$" >/dev/null; then + if echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${branch}\$" >/dev/null; then # Try exact match, or prepended with "refs/heads". Some projects (e.g. binutils) # have refs/original/refs/heads/master as well as refs/heads/master, and # `git ls-remote refs/heads/master` prints both. - best=`echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${devel_branch}\$"` + best=`echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${branch}\$"` using="best match" else best=`echo "${matches}" | head -n1` using="first" fi ref=`echo "${best}" | sed 's/.*[[:space:]]//'` - CT_DoLog WARN "Ambiguous ref ${devel_branch} at ${devel_url}, using ${using} (${ref})" + CT_DoLog WARN "Ambiguous ref ${branch} at ${devel_url}, using ${using} (${ref})" else best="${matches}" fi - devel_revision=`echo "${best}" | cut -c1-8` - CT_DoLog DEBUG "ref ${devel_branch} at ${devel_url} has cset of ${devel_revision}" + # Similarly, do not modify the devel_revision, we'll need to know if it + # has been set by the user in CT_Download_git. + unique_id=`echo "${best}" | cut -c1-8` + CT_DoLog DEBUG "ref ${branch} at ${devel_url} has cset of ${unique_id}" + else + unique_id=`echo "${devel_revision}" | cut -c1-8` fi - unique_id="${devel_revision}" } # Retrieve sources from Git. CT_Download_git() { - # Git does not allow making a shallow clone of a specific commit. - CT_DoExecLog ALL git clone "${devel_url}" "${pkg_name}" - CT_Pushd "${pkg_name}" - CT_DoExecLog ALL git checkout "${devel_revision}" -- + local new_unique_id fetched=n shallow_id + + # Some of these operations are part of a `git clone`, but fetching a specific commit + # (if it is supported by the server) is not expressable as a `git clone`. + CT_mkdir_pushd "${pkg_name}" + CT_DoExecLog ALL git init + CT_DoExecLog ALL git remote add origin "${devel_url}" + + if [ -z "${devel_revision}" ]; then + # Configuration didn't care about a specific commit; we'll use the most recent + # commit on the branch and will update the unique_id (and warn the user) if it + # differs from what we've previously determined. + shallow_id="${devel_branch:-master}" + else + local tmp=`echo "${devel_revision}" | sed 's/^[0-9a-z]\{40\}//'` + + if [ -z "${tmp}" ]; then + shallow_id="${devel_revision}" + else + CT_DoLog WARN "Git only allows full 40-character SHA-1 hashes to identify a commit for shallow clone." + fi + fi + + if [ -n "${shallow_id}" ]; then + if CT_DoExecLog ALL git fetch --quiet --depth 1 origin "${shallow_id}"; then + CT_DoExecLog ALL git checkout --quiet FETCH_HEAD -- + else + # Git 2.15 and newer (which must be the case on both the client and the server) + # allows fetching a single commit so long as the server is configured + # to allow it (by having uploadpack.allowReachableSHA1InWant=true set + # in its config). + CT_DoLog WARN "Shallow clone failed (likely disallowed on the server)." + shallow_id= + fi + fi + + if [ -z "${shallow_id}" ]; then + # In this case, we already determined the changeset we need + CT_DoLog WARN "Falling back to full clone; may take some time..." + CT_DoExecLog ALL git fetch --quiet origin + CT_DoExecLog ALL git checkout --quiet "${unique_id}" -- + fi + + new_unique_id=`git rev-parse HEAD | cut -c1-8` + if [ "${new_unique_id}" != "${unique_id}" ]; then + CT_DoLog EXTRA "Revision being fetched changed to ${new_unique_id}; source repository had more revisions pushed?" + unique_id="${new_unique_id}" + fi + CT_DoExecLog ALL rm -rf .git CT_Popd } @@ -1981,10 +2053,10 @@ CT_DoFetch() if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then CT_DoLog WARN "Downloads forbidden, not trying ${devel_vcs} retrieval" - return 1 + CT_Abort "${pkg_name}: cannot check out" fi - CT_DoLog EXTRA "Retrieving '${basename}' (${devel_vcs} ${devel_url} ${devel_branch} ${devel_revision})" + CT_DoLog EXTRA "Checking out '${basename}' (${devel_vcs} ${devel_url}${devel_branch:+, branch ${devel_branch}}${devel_revision:+, revision ${devel_revision}})" CT_MktempDir tmp_dir CT_Pushd "${tmp_dir}" CT_Download_${devel_vcs} @@ -1996,7 +2068,9 @@ CT_DoFetch() CT_DoExecLog ALL mv "${pkg_name}${devel_subdir:+/${devel_subdir}}" "${basename}" CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${basename}" - CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2" + if ! CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2"; then + CT_Abort "${pkg_name}: failed to save to local storage" + fi CT_Popd CT_DoExecLog ALL rm -rf "${tmp_dir}" diff --git a/testing/docker/archlinux/Dockerfile b/testing/docker/archlinux/Dockerfile index a717088..5f2b717 100644 --- a/testing/docker/archlinux/Dockerfile +++ b/testing/docker/archlinux/Dockerfile @@ -4,7 +4,9 @@ ARG CTNG_GID RUN groupadd -g $CTNG_GID ctng RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng RUN pacman -Syu --noconfirm -RUN pacman -S --noconfirm base-devel git help2man python unzip +RUN pacman -S --noconfirm base-devel git help2man python unzip wget RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile +RUN echo 'export MENUCONFIG_COLOR=mono' >> /etc/profile ENTRYPOINT [ "/sbin/dumb-init", "--" ] diff --git a/testing/docker/centos6/Dockerfile b/testing/docker/centos6/Dockerfile index f76100f..02a261f 100644 --- a/testing/docker/centos6/Dockerfile +++ b/testing/docker/centos6/Dockerfile @@ -3,8 +3,9 @@ ARG CTNG_UID ARG CTNG_GID RUN groupadd -g $CTNG_GID ctng RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng -RUN yum install -y autoconf gperf bison flex texinfo help2man gcc-c++ patch \ +RUN yum install -y autoconf gperf bison flex texinfo help2man gcc-c++ libtool libtool-bin patch \ ncurses-devel python-devel perl-Thread-Queue bzip2 git wget xz unzip RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile ENTRYPOINT [ "/sbin/dumb-init", "--" ] diff --git a/testing/docker/centos7/Dockerfile b/testing/docker/centos7/Dockerfile new file mode 100644 index 0000000..b0f928d --- /dev/null +++ b/testing/docker/centos7/Dockerfile @@ -0,0 +1,11 @@ +FROM centos:7 +ARG CTNG_UID +ARG CTNG_GID +RUN groupadd -g $CTNG_GID ctng +RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng +RUN yum install -y autoconf gperf bison file flex texinfo help2man gcc-c++ libtool make patch \ + ncurses-devel python-devel perl-Thread-Queue bzip2 git wget which xz unzip +RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 +RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile +ENTRYPOINT [ "/sbin/dumb-init", "--" ] diff --git a/testing/docker/common-scripts/ctng-build-sample b/testing/docker/common-scripts/ctng-build-sample index 6a6de6a..ef823ee 100755 --- a/testing/docker/common-scripts/ctng-build-sample +++ b/testing/docker/common-scripts/ctng-build-sample @@ -1,9 +1,5 @@ #!/bin/bash set -e -cd -rm -rf work/bld-samples -mkdir -p work/bld-samples work/inst-xtools -cd work/bld-samples -export PATH=$HOME/work/inst-ctng/bin:$PATH -ct-ng build-all CT_PREFIX=$HOME/work/inst-xtools ${1+CT_SAMPLES="$*"} +cd work +ct-ng build-all ${1+CT_SAMPLES="$*"} diff --git a/testing/docker/common-scripts/ctng-install b/testing/docker/common-scripts/ctng-install index 500cb73..6994fd5 100755 --- a/testing/docker/common-scripts/ctng-install +++ b/testing/docker/common-scripts/ctng-install @@ -1,10 +1,7 @@ #!/bin/bash set -e -cd -rm -rf work/bld-ctng work/inst-ctng -mkdir work/bld-ctng -cd work/bld-ctng -/crosstool-ng/configure --prefix=$HOME/work/inst-ctng +cd work +/crosstool-ng/configure --prefix=/opt/ctng make make install diff --git a/testing/docker/common-scripts/ctng-test-basic b/testing/docker/common-scripts/ctng-test-basic index 0edb899..a811ec6 100755 --- a/testing/docker/common-scripts/ctng-test-basic +++ b/testing/docker/common-scripts/ctng-test-basic @@ -2,7 +2,6 @@ set -e cd -export PATH=$HOME/work/inst-ctng/bin:$PATH ct-ng help ct-ng list-samples ct-ng list-steps diff --git a/testing/docker/dmgr.sh b/testing/docker/dmgr.sh index c059a6f..1330867 100755 --- a/testing/docker/dmgr.sh +++ b/testing/docker/dmgr.sh @@ -36,6 +36,17 @@ EOF exit 1 } +do_cleanup() +{ + local d + + for d in "$@"; do + [ -d "$d" ] || continue + chmod -R a+w "$d" + rm -rf "$d" + done +} + # Build a docker container, store its ID. action_build() { @@ -54,11 +65,13 @@ _dckr() local scmd prefix shift - mkdir -p build-${cntr} + mkdir -p ${cntr}/{build,install,xtools} prefix="docker run --rm -i -t \ -v `pwd`/common-scripts:/common-scripts:ro \ -v ${topdir}:/crosstool-ng:ro \ - -v `pwd`/build-${cntr}:/home/ctng/work \ + -v `pwd`/${cntr}/build:/home/ctng/work \ + -v `pwd`/${cntr}/install:/opt/ctng \ + -v `pwd`/${cntr}/xtools:/home/ctng/x-tools \ -v $HOME/src:/home/ctng/src:ro \ ctng-${cntr}" if [ -n "${AS_ROOT}" ]; then @@ -77,6 +90,7 @@ action_install() # The test assumes the top directory is bootstrapped, but clean. msg "Setting up crosstool-NG in ${cntr}" + do_cleanup ${cntr}/build _dckr "${cntr}" /common-scripts/ctng-install && \ _dckr "${cntr}" /common-scripts/ctng-test-basic } @@ -87,8 +101,8 @@ action_sample() local cntr=$1 shift - # The test assumes the top directory is bootstrapped, but clean. msg "Building samples in ${cntr} [$@]" + do_cleanup ${cntr}/build _dckr "${cntr}" /common-scripts/ctng-build-sample "$@" } @@ -117,10 +131,16 @@ action_clean() local cntr=$1 msg "Cleaning up after ${cntr}" - if [ -d build-${cntr} ]; then - chmod -R a+w build-${cntr} - rm -rf build-${cntr} - fi + do_cleanup ${cntr}/build +} + +# Clean up after test suite run +action_distclean() +{ + local cntr=$1 + + msg "Dist cleaning ${cntr}" + do_cleanup ${cntr}/{build,install,xtools} } all_containers=`ls */Dockerfile | sed 's,/Dockerfile,,'` @@ -132,7 +152,7 @@ if [ "${selected_containers}" = "all" ]; then fi case "${action}" in - build|install|sample|enter|root|clean) + build|install|sample|enter|root|clean|distclean) for c in ${selected_containers}; do eval "action_${action} ${c} \"$@\"" done diff --git a/testing/docker/fedora28/Dockerfile b/testing/docker/fedora28/Dockerfile new file mode 100644 index 0000000..20363c9 --- /dev/null +++ b/testing/docker/fedora28/Dockerfile @@ -0,0 +1,11 @@ +FROM fedora:28 +ARG CTNG_UID +ARG CTNG_GID +RUN groupadd -g $CTNG_GID ctng +RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng +RUN yum install -y autoconf gperf bison file flex texinfo help2man gcc-c++ libtool make patch \ + ncurses-devel python-devel perl-Thread-Queue bzip2 git wget which xz unzip +RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 +RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile +ENTRYPOINT [ "/sbin/dumb-init", "--" ] diff --git a/testing/docker/gentoo-amd64/Dockerfile b/testing/docker/gentoo-amd64/Dockerfile index ab5ac94..ec5c131 100644 --- a/testing/docker/gentoo-amd64/Dockerfile +++ b/testing/docker/gentoo-amd64/Dockerfile @@ -5,4 +5,5 @@ RUN groupadd -g $CTNG_GID ctng RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile ENTRYPOINT [ "/sbin/dumb-init", "--" ] diff --git a/testing/docker/mint19-amd64/Dockerfile b/testing/docker/mint19-amd64/Dockerfile index 8fdcc52..7a0e4ba 100644 --- a/testing/docker/mint19-amd64/Dockerfile +++ b/testing/docker/mint19-amd64/Dockerfile @@ -5,7 +5,8 @@ RUN groupadd -g $CTNG_GID ctng RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng RUN apt-get update RUN apt-get install -y gcc gperf bison flex texinfo help2man make libncurses5-dev \ - python-dev autoconf automake libtool libtool-bin gawk + python-dev autoconf automake libtool libtool-bin gawk wget RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile ENTRYPOINT [ "/sbin/dumb-init", "--" ] diff --git a/testing/docker/ubuntu16.04/Dockerfile b/testing/docker/ubuntu16.04/Dockerfile new file mode 100644 index 0000000..7a76712 --- /dev/null +++ b/testing/docker/ubuntu16.04/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:16.04 +ARG CTNG_UID +ARG CTNG_GID +RUN groupadd -g $CTNG_GID ctng +RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng +RUN apt-get update +RUN apt-get install -y gcc g++ gperf bison flex texinfo help2man make libncurses5-dev \ + python-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip \ + patch libstdc++6 +RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 +RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile +ENTRYPOINT [ "/sbin/dumb-init", "--" ] + diff --git a/testing/docker/ubuntu18.04/Dockerfile b/testing/docker/ubuntu18.04/Dockerfile new file mode 100644 index 0000000..9fe27b2 --- /dev/null +++ b/testing/docker/ubuntu18.04/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:18.04 +ARG CTNG_UID +ARG CTNG_GID +RUN groupadd -g $CTNG_GID ctng +RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng +RUN apt-get update +RUN apt-get install -y gcc g++ gperf bison flex texinfo help2man make libncurses5-dev \ + python-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip \ + patch libstdc++6 +RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 +RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile +ENTRYPOINT [ "/sbin/dumb-init", "--" ] + diff --git a/testing/docker/ubuntu18.10/Dockerfile b/testing/docker/ubuntu18.10/Dockerfile new file mode 100644 index 0000000..468175e --- /dev/null +++ b/testing/docker/ubuntu18.10/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:18.10 +ARG CTNG_UID +ARG CTNG_GID +RUN groupadd -g $CTNG_GID ctng +RUN useradd -d /home/ctng -m -g $CTNG_GID -u $CTNG_UID -s /bin/bash ctng +RUN apt-get update +RUN apt-get install -y gcc g++ gperf bison flex texinfo help2man make libncurses5-dev \ + python-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip \ + patch libstdc++6 +RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 +RUN chmod a+x /sbin/dumb-init +RUN echo 'export PATH=/opt/ctng/bin:$PATH' >> /etc/profile +ENTRYPOINT [ "/sbin/dumb-init", "--" ] + |