diff options
author | Andris Pavenis | 2017-12-10 13:28:12 +0200 |
---|---|---|
committer | Andris Pavenis | 2017-12-15 22:08:39 +0200 |
commit | 8bcfdb63ff25c0c9c90ad47191ff19350f9793db (patch) | |
tree | 26555ebdc92b31bb5328b325317c9aa65b6fd28c | |
parent | 8d6c8c93b99417d3d7c16893b8f4c3f989e98acb (diff) | |
download | aur-8bcfdb63ff25c0c9c90ad47191ff19350f9793db.tar.gz |
Update to gcc-7.2.0
* apply DJGPP related changes for gcc
* build also Ada, Fortran, Objective-C and Objective-C++ compilers
* require djgpp-djcrx (one can use djgpp-djcrx-bootstrap for initial build instead)
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | PKGBUILD | 55 | ||||
-rw-r--r-- | gcc-7.2.0-djgpp.diff | 297 |
3 files changed, 326 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..021f0281eee1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*~ +/pkg +/src +/isl*.tar.bz2 +/gcc-*.tar.xz +/djgpp-gcc-*.pkg.tar.xz @@ -1,8 +1,9 @@ -# Contributor: carstene1ns <arch carsten-teibes de> +# Maintainer: Andris Pavenis <andris.pavenis iki fi> +# Maintainer: carstene1ns <arch carsten-teibes de> # Contributor: felix <base64 -d <<< ZmVsaXgudm9uLnNAcG9zdGVvLmRlCg==> pkgname=djgpp-gcc -pkgver=7.1.0 +pkgver=7.2.0 _target="i686-pc-msdosdjgpp" _islver=0.18 _djver=2.05 @@ -10,21 +11,20 @@ pkgrel=1 pkgdesc="GCC for the djgpp cross-compiler" arch=('i686' 'x86_64') url="http://gcc.gnu.org" -license=('GPL' 'LGPL' 'FDL' 'custom') +license=('GPL3' 'LGPL3') groups=('djgpp') -depends=('zlib' 'libmpc' 'djgpp-binutils') +depends=('zlib' 'libmpc' 'djgpp-binutils' 'djgpp-djcrx') makedepends=('unzip') optdepends=('djgpp-djcrx: headers and utilities') options=('!strip' 'staticlibs' '!emptydirs') -source=("https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.bz2" +source=("https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz" "http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2" - "http://www.delorie.com/pub/djgpp/current/v2/djcrx${_djver//./}.zip" - "lto.patch") -sha256sums=('8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17' + "lto.patch" + "gcc-7.2.0-djgpp.diff") +sha256sums=('1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a' '6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b' - '22274ed8d5ee57cf7ccf161f5e1684fd1c0192068724a7d34e1bde168041ca60' - 'c03dbd61274e1ce14f84366abf348d75779bbd6e0bc32b9f4fd74f1ce54a5ef0') -noextract=("djcrx${_djver//./}.zip") + 'c03dbd61274e1ce14f84366abf348d75779bbd6e0bc32b9f4fd74f1ce54a5ef0' + 'ef436e945a0bf386c033e6c05a5692621a0927f25fa6c5cedc2e7d1d931fe235') prepare() { cd gcc-$pkgver @@ -32,36 +32,26 @@ prepare() { # link isl for in-tree build ln -fs "../isl-${_islver}" isl - # hack! - some configure tests for header files break with FORTIFY_SOURCE - sed -i "/ac_cpp=/ s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure - # build the lto plugin patch -Np0 < ../lto.patch - # extract bootstrap djcrx - mkdir -p ../gcc-build-$_target/lib/gcc/$_target/$pkgver - cd ../gcc-build-${_target}/lib/gcc/$_target/$pkgver - unzip -qoW "$srcdir/djcrx${_djver//./}.zip" 'include/**' 'lib/*.[oa]' - mv lib/* . - # ??? - ln -fs /bin/true stubify - - # monkeypatch libc to prepare for building without an ldscript - echo '.comm __environ,16' > environ.s - i686-pc-msdosdjgpp-as environ.s -o environ.o - i686-pc-msdosdjgpp-ar q libc.a environ.o + # Other DJGPP related changes + patch -Np1 < ../gcc-7.2.0-djgpp.diff } build() { + mkdir gcc-build-$_target cd gcc-build-$_target + export CPPFLAGS="$CPPFLAGS -O2" ../gcc-$pkgver/configure --prefix=/usr --libexecdir=/usr/lib \ --target="$_target" \ - --enable-languages=c,c++ \ + --enable-languages=c,c++,ada,fortran,objc,obj-c++ \ --enable-shared --enable-static \ - --enable-threads=no --enable-fully-dynamic-string \ - --with-system-zlib --with-isl \ - --enable-lto --disable-dw2-exceptions --disable-libgomp \ - --disable-multilib --enable-checking=release + --enable-threads=no --with-system-zlib --with-isl \ + --enable-lto --disable-libgomp \ + --disable-multilib --enable-checking=release \ + --disable-libstdcxx-pch \ + --disable-install-libiberty make all } @@ -70,13 +60,14 @@ package_djgpp-gcc() { # strip manually, djgpp libs spew errors otherwise strip "$pkgdir"/usr/bin/$_target-* - strip "$pkgdir"/usr/lib/gcc/$_target/$pkgver/{cc1*,collect2,lto*} + strip "$pkgdir"/usr/lib/gcc/$_target/$pkgver/{cc1*,collect2,lto*,f951,gnat1} # for compatibility ln -s $_target-gcc "$pkgdir"/usr/bin/$_target-cc # remove unnecessary files rm -rf "$pkgdir"/usr/share/{man/man7,info,locale} + rm -rf "$pkgdir"/usr/share/gcc-$pkgver/python rm -rf "$pkgdir"/usr/lib/gcc/$_target/$pkgver/include-fixed rm -f "$pkgdir"/usr/lib/libcc1.* } diff --git a/gcc-7.2.0-djgpp.diff b/gcc-7.2.0-djgpp.diff new file mode 100644 index 000000000000..bd3f312d2053 --- /dev/null +++ b/gcc-7.2.0-djgpp.diff @@ -0,0 +1,297 @@ +diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c +index bff875a6822..fc06ee7b663 100644 +--- a/gcc/ada/adaint.c ++++ b/gcc/ada/adaint.c +@@ -549,7 +549,11 @@ __gnat_try_lock (char *dir, char *file) + int + __gnat_get_maximum_file_name_length (void) + { ++#if defined (__DJGPP__) ++ return (_use_lfn(".")) ? -1 : 8; ++#else + return -1; ++#endif + } + + /* Return nonzero if file names are case sensitive. */ +@@ -623,6 +627,17 @@ __gnat_get_current_dir (char *dir, int *length) + dir [*length] = DIR_SEPARATOR; + ++(*length); + } ++#ifdef __DJGPP__ ++ do { ++ char *w; ++ for (w = dir; *w; ++w) ++ { ++ if (*w == '/') { ++ *w = '\\'; ++ } ++ } ++ } while (0); ++#endif /* __DJGPP__ */ + dir[*length] = '\0'; + } + +diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in +index eb0489b4a50..166a7432647 100644 +diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb +index 36064e97bd3..18bfb484074 100644 +--- a/gcc/ada/s-os_lib.adb ++++ b/gcc/ada/s-os_lib.adb +@@ -71,7 +71,7 @@ package body System.OS_Lib is + + -- The following are used by Create_Temp_File + +- First_Temp_File_Name : constant String := "GNAT-TEMP-000000.TMP"; ++ First_Temp_File_Name : constant String := "GA000000.TMP"; + -- Used to initialize Current_Temp_File_Name and Temp_File_Name_Last_Digit + + Current_Temp_File_Name : String := First_Temp_File_Name; +diff --git a/gcc/config/i386/xm-djgpp.h b/gcc/config/i386/xm-djgpp.h +index de0dace1707..57c037a7df0 100644 +diff --git a/gcc/gcov-tool.c b/gcc/gcov-tool.c +index 74e77b90d72..a0e85f72256 100644 +diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h +index 658017fd63a..e6504b94d07 100644 +--- a/gcc/ginclude/float.h ++++ b/gcc/ginclude/float.h +@@ -25,6 +25,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + * ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h> + */ + ++#ifdef __DJGPP__ ++#include_next <float.h> ++#endif ++ + #ifndef _FLOAT_H___ + #define _FLOAT_H___ + +diff --git a/include/libiberty.h b/include/libiberty.h +index 7a796124bf5..0eb73f6650b 100644 +--- a/include/libiberty.h ++++ b/include/libiberty.h +@@ -108,6 +108,7 @@ extern int countargv (char * const *); + #if defined (__GNU_LIBRARY__ ) || defined (__linux__) \ + || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \ + || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \ ++ || defined (__DJGPP__) \ + || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) + extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); + #else +diff --git a/libcpp/files.c b/libcpp/files.c +index 969a531033f..3c07d60a62c 100644 +--- a/libcpp/files.c ++++ b/libcpp/files.c +@@ -740,6 +740,10 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file, source_location loc) + cpp_error_at (pfile, CPP_DL_WARNING, loc, + "%s is shorter than expected", file->path); + ++/* For DOS we should handle DOS EOF character (0x1A, ^Z). It is ++ only done if it is really the last character of the file */ ++ if (total>0 && buf[total-1]==0x1A) total--; ++ + file->buffer = _cpp_convert_input (pfile, + CPP_OPTION (pfile, input_charset), + buf, size + 16, total, +diff --git a/libcpp/lex.c b/libcpp/lex.c +index 9edd2a6afdb..4a4fa56b280 100644 +--- a/libgfortran/intrinsics/chmod.c ++++ b/libgfortran/intrinsics/chmod.c +@@ -443,7 +443,7 @@ clause_done: + if ((ugo[2] || honor_umask) && !rwxXstugo[8]) + file_mode = (file_mode & ~(S_IROTH | S_IWOTH | S_IXOTH)) + | (new_mode & (S_IROTH | S_IWOTH | S_IXOTH)); +-#ifndef __VXWORKS__ ++#if !defined(__VXWORKS__) && !defined(__DJGPP__) + if (is_dir && rwxXstugo[5]) + file_mode |= S_ISVTX; + else if (!is_dir) +@@ -455,7 +455,7 @@ clause_done: + { + /* Clear '-'. */ + file_mode &= ~new_mode; +-#if !defined( __MINGW32__) && !defined (__VXWORKS__) ++#if !defined( __MINGW32__) && !defined (__VXWORKS__) && !defined(__DJGPP__) + if (rwxXstugo[5] || !is_dir) + file_mode &= ~S_ISVTX; + #endif +@@ -463,7 +463,7 @@ clause_done: + else if (set_mode == 3) + { + file_mode |= new_mode; +-#if !defined (__MINGW32__) && !defined (__VXWORKS__) ++#if !defined (__MINGW32__) && !defined (__VXWORKS__) && !defined(__DJGPP__) + if (rwxXstugo[5] && is_dir) + file_mode |= S_ISVTX; + else if (!is_dir) +diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c +index c76b427387a..2edd317d619 100644 +--- a/libgfortran/io/unix.c ++++ b/libgfortran/io/unix.c +@@ -210,6 +210,9 @@ typedef struct + } + unix_stream; + ++#ifdef __DJGPP__ ++#include <io.h> ++#endif + + /* fix_fd()-- Given a file descriptor, make sure it is not one of the + standard descriptors, returning a non-standard descriptor. If the +@@ -1153,8 +1156,13 @@ tempfile_open (const char *tempdir, char **fname) + char *template = xmalloc (tempdirlen + 23); + + #ifdef HAVE_MKSTEMP ++#ifdef __DJGPP__ ++ /* Default filename is too long for DOS */ ++ snprintf (template, tempdirlen + 23, "%s/gfXXXXXX", tempdir); ++#else + snprintf (template, tempdirlen + 23, "%s%sgfortrantmpXXXXXX", + tempdir, slash); ++#endif + + #ifdef HAVE_UMASK + /* Temporarily set the umask such that the file has 0600 permissions. */ +@@ -1520,6 +1528,13 @@ open_external (st_parameter_open *opp, unit_flags *flags) + return NULL; + fd = fix_fd (fd); + ++#ifdef __DJGPP__ ++ if (flags->form == FORM_UNFORMATTED) ++ { ++ setmode (fd, O_BINARY); ++ } ++#endif ++ + if (open_share (opp, fd, flags) < 0) + return NULL; + +diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c +index f74bbdc9038..4b2020e55b6 100644 +--- a/libiberty/make-relative-prefix.c ++++ b/libiberty/make-relative-prefix.c +@@ -65,6 +65,7 @@ relative prefix can be found, return @code{NULL}. + + #include "ansidecl.h" + #include "libiberty.h" ++#include "filenames.h" + + #ifndef R_OK + #define R_OK 4 +@@ -337,7 +338,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix, + { + for (i = 0; i < bin_num; i++) + { +- if (strcmp (prog_dirs[i], bin_dirs[i]) != 0) ++ if (FILENAME_CMP (prog_dirs[i], bin_dirs[i]) != 0) + break; + } + +@@ -353,7 +354,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix, + n = (prefix_num < bin_num) ? prefix_num : bin_num; + for (common = 0; common < n; common++) + { +- if (strcmp (bin_dirs[common], prefix_dirs[common]) != 0) ++ if (FILENAME_CMP (bin_dirs[common], prefix_dirs[common]) != 0) + break; + } + +diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c +index 98e215d15e7..1c2defad7b1 100644 +--- a/libiberty/make-temp-file.c ++++ b/libiberty/make-temp-file.c +@@ -47,6 +47,7 @@ Boston, MA 02110-1301, USA. */ + #endif + + #include "libiberty.h" ++#include "filenames.h" + extern int mkstemps (char *, int); + + /* '/' works just fine on MS-DOS based systems. */ +@@ -142,7 +143,8 @@ choose_tmpdir (void) + len = strlen (base); + tmpdir = XNEWVEC (char, len + 2); + strcpy (tmpdir, base); +- tmpdir[len] = DIR_SEPARATOR; ++ if (len>0 && !IS_DIR_SEPARATOR(tmpdir[len-1])) ++ tmpdir[len] = DIR_SEPARATOR; + tmpdir[len+1] = '\0'; + memoized_tmpdir = tmpdir; + #else /* defined(_WIN32) && !defined(__CYGWIN__) */ +diff --git a/libquadmath/printf/quadmath-printf.h b/libquadmath/printf/quadmath-printf.h +index 32ebcec928c..96498b7c408 100644 +--- a/libquadmath/printf/quadmath-printf.h ++++ b/libquadmath/printf/quadmath-printf.h +@@ -29,7 +29,8 @@ Boston, MA 02110-1301, USA. */ + #ifdef HAVE_CTYPE_H + #include <ctype.h> + #endif +-#ifdef HAVE_WCHAR_H ++#if defined(HAVE_WCHAR_H) && !defined(__DJGPP__) ++/* DJGPP wchar.h is not good enough */ + #include <wchar.h> + #endif + #ifdef HAVE_WCTYPE_H +@@ -44,7 +45,7 @@ Boston, MA 02110-1301, USA. */ + #include "quadmath-imp.h" + #include "gmp-impl.h" + +-#ifdef HAVE_WCHAR_H ++#if defined(HAVE_WCHAR_H) && !defined(__DJGPP__) + #define L_(x) L##x + #else + #define L_(x) x +diff --git a/libstdc++-v3/config/os/djgpp/error_constants.h b/libstdc++-v3/config/os/djgpp/error_constants.h +index 4ce342c9626..b89b07cb4be 100644 +--- a/libstdc++-v3/config/os/djgpp/error_constants.h ++++ b/libstdc++-v3/config/os/djgpp/error_constants.h +@@ -33,6 +33,15 @@ + #include <bits/c++config.h> + #include <cerrno> + ++#ifndef EOPNOTSUPP ++// Use same value as in wat3222br6.zip file net/watt/sys/djgpp.err ++#define EOPNOTSUPP 52 ++#endif ++ ++#ifndef ENOTSUP ++#define ENOTSUP 101 ++#endif ++ + namespace std _GLIBCXX_VISIBILITY(default) + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION +@@ -118,9 +127,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + // not_connected = ENOTCONN, + not_enough_memory = ENOMEM, + +-#ifdef _GLIBCXX_HAVE_ENOTSUP + not_supported = ENOTSUP, +-#endif + + #ifdef _GLIBCXX_HAVE_ECANCELED + operation_canceled = ECANCELED, +@@ -128,7 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + + // operation_in_progress = EINPROGRESS, + operation_not_permitted = EPERM, +-// operation_not_supported = EOPNOTSUPP, ++ operation_not_supported = EOPNOTSUPP, + // operation_would_block = EWOULDBLOCK, + + #ifdef _GLIBCXX_HAVE_EOWNERDEAD +diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc +index c711de16f06..a38ee5d9abe 100644 +--- a/libstdc++-v3/src/filesystem/ops.cc ++++ b/libstdc++-v3/src/filesystem/ops.cc +@@ -269,8 +269,10 @@ namespace + return file_type::fifo; + else if (S_ISLNK(st.st_mode)) + return file_type::symlink; ++#ifdef S_ISSOCK + else if (S_ISSOCK(st.st_mode)) + return file_type::socket; ++#endif // s_ISSOCK + #endif + return file_type::unknown; + |