diff options
-rw-r--r-- | .SRCINFO | 45 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 143 | ||||
-rw-r--r-- | bz90397.patch | 14 | ||||
-rw-r--r-- | bz90949.patch | 88 | ||||
-rw-r--r-- | c89 | 10 | ||||
-rw-r--r-- | c99 | 10 | ||||
-rw-r--r-- | phobos_path.patch | 14 |
8 files changed, 325 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..f0e05a576c4e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,45 @@ +pkgbase = gdc-static + pkgdesc = The GNU D compiler (part of official gcc distribution with static phobos) + pkgver = 9.1.0 + pkgrel = 1 + url = https://gcc.gnu.org + arch = x86_64 + license = GPL + license = LGPL + license = FDL + license = custom + checkdepends = dejagnu + checkdepends = inetutils + makedepends = binutils + makedepends = libmpc + makedepends = python + makedepends = subversion + options = !emptydirs + source = https://ftp.gnu.org/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.xz + source = http://isl.gforge.inria.fr/isl-0.21.tar.xz + source = c89 + source = c99 + source = bz90397.patch + source = bz90949.patch + source = phobos_path.patch + sha256sums = 79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0 + sha256sums = 777058852a3db9500954361e294881214f6ecd4b594c00da5eee974cd6a54960 + sha256sums = de48736f6e4153f03d0a5d38ceb6c6fdb7f054e8f47ddd6af0a3dbf14f27b931 + sha256sums = 2513c6d9984dd0a2058557bf00f06d8d5181734e41dcfe07be7ed86f2959622a + sha256sums = cc20d05bcc6cb35bf0944b391f0b0380af375f2a8a03ce1cd67835884bc41fac + sha256sums = c860819e730faf1621e1286ebe3a0179df6e25182b81a9ca0a3db02633982a14 + sha256sums = SKIP + +pkgname = gdc-static + pkgdesc = Compiler for D programming language which uses gcc backend + depends = gcc + provides = d-compiler=2.076.1 + provides = gdc + provides = libgphobos + provides = libgphobos.so + provides = libgdruntime.so + conflicts = gdc + conflicts = libgphobos + conflicts = gcc-gdc + options = staticlibs + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..bcc1a61f7c4d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,143 @@ +# Maintainer: Daniel Kozak <kozzi11@gmail.com> + +pkgname=(gdc-static) +pkgver=9.1.0 +_majorver=${pkgver:0:1} +_islver=0.21 +pkgrel=1 +pkgdesc='The GNU D compiler (part of official gcc distribution with static phobos)' +arch=(x86_64) +license=(GPL LGPL FDL custom) +url='https://gcc.gnu.org' +makedepends=(binutils libmpc python subversion) +checkdepends=(dejagnu inetutils) +options=(!emptydirs) +source=(https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz + http://isl.gforge.inria.fr/isl-${_islver}.tar.xz + c89 c99 + bz90397.patch + bz90949.patch + phobos_path.patch) +sha256sums=('79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0' + '777058852a3db9500954361e294881214f6ecd4b594c00da5eee974cd6a54960' + 'de48736f6e4153f03d0a5d38ceb6c6fdb7f054e8f47ddd6af0a3dbf14f27b931' + '2513c6d9984dd0a2058557bf00f06d8d5181734e41dcfe07be7ed86f2959622a' + 'cc20d05bcc6cb35bf0944b391f0b0380af375f2a8a03ce1cd67835884bc41fac' + 'c860819e730faf1621e1286ebe3a0179df6e25182b81a9ca0a3db02633982a14' + 'c86372c207d174c0918d4aedf1cb79f7fc093649eb1ad8d9450dccc46849d308') + +_libdirpath=usr/lib/gdc + +_libdir="$_libdirpath"/gcc/$CHOST/${pkgver%%+*} + + +prepare() { + [[ ! -d gcc ]] && ln -s gcc-${pkgver/+/-} gcc + cd gcc + + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90397 + patch -p0 -i "$srcdir/bz90397.patch" + + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90949 + patch -p0 -i "$srcdir/bz90949.patch" + + # Seup gdc include dir path + patch -p1 -i "$srcdir"/phobos_path.patch + + # link isl for in-tree build + [[ ! -d isl ]] && ln -s ../isl-${_islver} isl + + # Do not run fixincludes + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + + # Arch Linux installs x86_64 libraries /lib + sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 + + # hack! - some configure tests for header files using "$CPP $CPPFLAGS" + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure + + mkdir -p "$srcdir/gcc-build" +} + +build() { + cd gcc-build + + # using -pipe causes spurious test-suite failures + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565 + CFLAGS=${CFLAGS/-pipe/} + CXXFLAGS=${CXXFLAGS/-pipe/} + + "$srcdir/gcc/configure" --prefix=/usr \ + --libdir="/$_libdirpath" \ + --libexecdir="/$_libdirpath" \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --with-bugurl=https://gcc.gnu.org/bugzilla/ \ + --enable-languages=d \ + --enable-static \ + --enable-threads=posix \ + --with-system-zlib \ + --with-isl \ + --enable-__cxa_atexit \ + --disable-libunwind-exceptions \ + --enable-clocale=gnu \ + --disable-libstdcxx-pch \ + --disable-libssp \ + --enable-gnu-unique-object \ + --enable-linker-build-id \ + --enable-lto \ + --enable-plugin \ + --enable-install-libiberty \ + --with-linker-hash-style=gnu \ + --enable-gnu-indirect-function \ + --disable-multilib \ + --disable-werror \ + --disable-bootstrap \ + --enable-checking=release \ + --enable-default-pie \ + --enable-default-ssp \ + --enable-cet=auto \ + --with-target-system-zlib=yes \ + gdc_include_dir=/usr/include/dlang/gdc + + make +} + +package_gdc-static() { + pkgdesc="Compiler for D programming language which uses gcc backend" + depends=('gcc') + provides=(d-compiler=2.076.1 gdc libgphobos libgphobos.so libgdruntime.so) + conflicts=('gdc' 'libgphobos' 'gcc-gdc') + options=('staticlibs') + + cd gcc-build + make -C gcc DESTDIR="$pkgdir" d.install-{common,man,info} + make -C $CHOST/libphobos DESTDIR="$pkgdir" install + make -C lto-plugin DESTDIR="$pkgdir" install + make -C $CHOST/libgcc DESTDIR="$pkgdir" install + + # Binaries + install -Dm 755 gcc/gdc "$pkgdir"/usr/bin/gdc + install -Dm 755 gcc/d21 "$pkgdir"/"$_libdir"/d21 + #install -Dm 755 ../GDMD/dmd-script "$pkgdir"/usr/bin/gdmd + + + # Doc + #install -Dm 644 "$srcdir"/GDMD/dmd-script.1 "$pkgdir"/usr/share/man/man1/gdmd.1 + + # Install Runtime Library Exception + install -d "$pkgdir/usr/share/licenses/$pkgname/" + ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ + "$pkgdir/usr/share/licenses/$pkgname/" + + mkdir -p -m 755 "$pkgdir"/usr/include/dlang + ln -s /"${_libdir}"/include/d "$pkgdir"/usr/include/dlang/gdc + + if [ -d "$pkgdir"/usr/lib/lib ]; then + mv "$pkgdir"/usr/lib/lib/* "$pkgdir"/usr/lib + rmdir "$pkgdir"/usr/lib/lib + fi + + rm -f "$pkgdir"/usr/lib{,32}/libgcc_s.so* + +} diff --git a/bz90397.patch b/bz90397.patch new file mode 100644 index 000000000000..d41252af50e4 --- /dev/null +++ b/bz90397.patch @@ -0,0 +1,14 @@ +Index: libstdc++-v3/include/std/variant +=================================================================== +--- libstdc++-v3/include/std/variant (revision 271082) ++++ libstdc++-v3/include/std/variant (revision 271083) +@@ -1556,7 +1556,8 @@ + #endif + + template<size_t _Np, typename _Vp> +- friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v); ++ friend constexpr decltype(auto) ++ __detail::__variant::__get(_Vp&& __v) noexcept; + + template<typename _Vp> + friend void* __detail::__variant::__get_storage(_Vp&& __v); diff --git a/bz90949.patch b/bz90949.patch new file mode 100644 index 000000000000..e545844c5d7e --- /dev/null +++ b/bz90949.patch @@ -0,0 +1,88 @@ +Index: gcc/testsuite/gcc.c-torture/execute/pr90949.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr90949.c (nonexistent) ++++ gcc/testsuite/gcc.c-torture/execute/pr90949.c (revision 272555) +@@ -0,0 +1,42 @@ ++void __attribute__ ((noipa, noinline)) my_puts (const char *str) { } ++ ++void __attribute__ ((noipa, noinline)) my_free (void *p) { } ++ ++ ++struct Node ++{ ++ struct Node *child; ++}; ++ ++struct Node space[2] = { }; ++ ++struct Node * __attribute__ ((noipa, noinline)) my_malloc (int bytes) ++{ ++ return &space[0]; ++} ++ ++void ++walk (struct Node *module, int cleanup) ++{ ++ if (module == 0) ++ { ++ return; ++ } ++ if (!cleanup) ++ { ++ my_puts ("No cleanup"); ++ } ++ walk (module->child, cleanup); ++ if (cleanup) ++ { ++ my_free (module); ++ } ++} ++ ++int ++main () ++{ ++ struct Node *node = my_malloc (sizeof (struct Node)); ++ node->child = 0; ++ walk (node, 1); ++} +Index: gcc/tree-ssa-copy.c +=================================================================== +--- gcc/tree-ssa-copy.c (revision 272554) ++++ gcc/tree-ssa-copy.c (revision 272555) +@@ -545,13 +545,12 @@ + duplicate_ssa_name_ptr_info (copy_of[i].value, + SSA_NAME_PTR_INFO (var)); + /* Points-to information is cfg insensitive, +- but alignment info might be cfg sensitive, if it +- e.g. is derived from VRP derived non-zero bits. +- So, do not copy alignment info if the two SSA_NAMEs +- aren't defined in the same basic block. */ ++ but [E]VRP might record context sensitive alignment ++ info, non-nullness, etc. So reset context sensitive ++ info if the two SSA_NAMEs aren't defined in the same ++ basic block. */ + if (var_bb != copy_of_bb) +- mark_ptr_info_alignment_unknown +- (SSA_NAME_PTR_INFO (copy_of[i].value)); ++ reset_flow_sensitive_info (copy_of[i].value); + } + else if (!POINTER_TYPE_P (TREE_TYPE (var)) + && SSA_NAME_RANGE_INFO (var) +Index: gcc/tree-ssanames.c +=================================================================== +--- gcc/tree-ssanames.c (revision 272554) ++++ gcc/tree-ssanames.c (revision 272555) +@@ -820,7 +820,12 @@ + { + /* points-to info is not flow-sensitive. */ + if (SSA_NAME_PTR_INFO (name)) +- mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name)); ++ { ++ /* [E]VRP can derive context sensitive alignment info and ++ non-nullness properties. We must reset both. */ ++ mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name)); ++ SSA_NAME_PTR_INFO (name)->pt.null = 1; ++ } + } + else + SSA_NAME_RANGE_INFO (name) = NULL; @@ -0,0 +1,10 @@ +#!/bin/sh +fl="-std=c89" +for opt; do + case "$opt" in + -ansi|-std=c89|-std=iso9899:1990) fl="";; + -std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2 + exit 1;; + esac +done +exec gcc $fl ${1+"$@"} @@ -0,0 +1,10 @@ +#!/bin/sh +fl="-std=c99" +for opt; do + case "$opt" in + -std=c99|-std=iso9899:1999) fl="";; + -std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2 + exit 1;; + esac +done +exec gcc $fl ${1+"$@"} diff --git a/phobos_path.patch b/phobos_path.patch new file mode 100644 index 000000000000..6f43b6ee7a96 --- /dev/null +++ b/phobos_path.patch @@ -0,0 +1,14 @@ +diff -Naur a/gcc/d/d-incpath.cc b/gcc/d/d-incpath.cc +--- a/gcc/d/d-incpath.cc 2019-01-01 13:31:55.000000000 +0100 ++++ b/gcc/d/d-incpath.cc 2019-06-28 08:32:00.326241502 +0200 +@@ -140,7 +140,7 @@ + path = xstrdup (p->fname); + + /* Add D-specific suffix. */ +- path = concat (path, "/d", NULL); ++ path = concat (path, "/dlang/gdc", NULL); + + /* Ignore duplicate entries. */ + bool found = false; + + |