From 61d38b018d1ffdc94c88f5ff6f43aed8552d6432 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 2 Jun 2022 16:36:02 +0200 Subject: [PATCH] gcc-latest: Added GCC 12 with GDC --- private/gcc-latest/README | 6 + private/gcc-latest/gcc-latest.SlackBuild | 196 ++++++++++++++++++ private/gcc-latest/gcc-latest.info | 10 + .../patches/gcc-no_fixincludes.diff | 27 +++ private/gcc-latest/slack-desc | 19 ++ 5 files changed, 258 insertions(+) create mode 100644 private/gcc-latest/README create mode 100755 private/gcc-latest/gcc-latest.SlackBuild create mode 100644 private/gcc-latest/gcc-latest.info create mode 100644 private/gcc-latest/patches/gcc-no_fixincludes.diff create mode 100644 private/gcc-latest/slack-desc diff --git a/private/gcc-latest/README b/private/gcc-latest/README new file mode 100644 index 0000000..04113b2 --- /dev/null +++ b/private/gcc-latest/README @@ -0,0 +1,6 @@ +GCC 12 with C, C++ and D support. + +GCC is the GNU Compiler Collection. + +D is a general-purpose programming language with static typing, +systems-level access, and C-like syntax. diff --git a/private/gcc-latest/gcc-latest.SlackBuild b/private/gcc-latest/gcc-latest.SlackBuild new file mode 100755 index 0000000..7f67cf2 --- /dev/null +++ b/private/gcc-latest/gcc-latest.SlackBuild @@ -0,0 +1,196 @@ +#!/bin/bash +# GCC package build script (written by volkerdi@slackware.com) +# +# Copyright 2003, 2004 Slackware Linux, Inc., Concord, California, USA +# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# Modified 2011 by Eric Hameleers for OpenJDK. +# Modified 2022 by Eugen Wissner for gcc-latest. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=gcc-latest +VERSION=${VERSION:-12.1.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$(uname -m) ;; + esac + export ARCH +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i386" ]; then + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "i486" ]; then + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "i586" ]; then + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "i686" ]; then + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "s390" ]; then + LIBDIRSUFFIX="" + LIB_ARCH=s390 +elif [ "$ARCH" = "x86_64" ]; then + LIBDIRSUFFIX="64" + LIB_ARCH=amd64 +elif [ "$ARCH" = "armv7hl" ]; then + LIBDIRSUFFIX="" + LIB_ARCH=armv7hl +else + LIBDIRSUFFIX="" + LIB_ARCH=$ARCH +fi + +case "$ARCH" in + arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; + *) TARGET=$ARCH-slackware-linux ;; +esac + +set -e # Exit on most errors + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION + +mkdir -p $PRGNAM-$VERSION +cd $PRGNAM-$VERSION +tar xvf $CWD/gcc-$VERSION.tar.?z +cd gcc-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Smite the fixincludes: +patch -p1 --verbose -i $CWD/patches/gcc-no_fixincludes.diff + +mkdir ../objdir +cd ../objdir + +if [ "$ARCH" != "x86_64" ]; then + GCC_ARCHOPTS="--with-arch=$ARCH" +else + GCC_ARCHOPTS="--disable-multilib" +fi + +../gcc-$VERSION/configure \ + --prefix=/usr \ + --libdir=/usr/lib$LIBDIRSUFFIX \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --enable-shared \ + --disable-bootstrap \ + --enable-languages=c,c++,d \ + --enable-threads=posix \ + --enable-checking=release \ + --with-system-zlib \ + --enable-libstdcxx-dual-abi \ + --with-default-libstdcxx-abi=new \ + --disable-libstdcxx-pch \ + --disable-libunwind-exceptions \ + --enable-__cxa_atexit \ + --disable-libssp \ + --enable-gnu-unique-object \ + --enable-plugin \ + --enable-lto \ + --disable-install-libiberty \ + --disable-werror \ + --with-gnu-ld \ + --with-isl \ + --verbose \ + --with-arch-directory=$LIB_ARCH \ + --disable-gtktest \ + --enable-clocale=gnu \ + --program-suffix=-12 \ + $GCC_ARCHOPTS \ + --target=${TARGET} \ + --build=${TARGET} \ + --host=${TARGET} + +make +make install-strip DESTDIR=$PKG + +rm $PKG/usr/lib${LIBDIRSUFFIX}/*.{la,o,a,spec} \ + $PKG/usr/lib${LIBDIRSUFFIX}/libgcc_s.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libatomic.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libcc1.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libgomp.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libitm.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/liblsan.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libquadmath.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libubsan.so* \ + $PKG/usr/lib${LIBDIRSUFFIX}/libstdc++.so \ + $PKG/usr/lib${LIBDIRSUFFIX}/libstdc++.so.6 + +# Move gdb pretty printers to the correct place +mkdir -p $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX +mv $PKG/usr/lib$LIBDIRSUFFIX/*-gdb.py \ + $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX/ + +cd ../gcc-$VERSION + +# They conflict with the stock package. +rm -rf $PKG/usr/man/man7 \ + $PKG/usr/info \ + $PKG/usr/share/locale + +# Compress man pages +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + COPYING* ChangeLog* INSTALL LAST_UPDATED MAINTAINERS NEWS README* \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/private/gcc-latest/gcc-latest.info b/private/gcc-latest/gcc-latest.info new file mode 100644 index 0000000..33bc8d5 --- /dev/null +++ b/private/gcc-latest/gcc-latest.info @@ -0,0 +1,10 @@ +PRGNAM="gcc-latest" +VERSION="12.1.0" +HOMEPAGE="https://gcc.gnu.org/" +DOWNLOAD="https://ftp.gnu.org/gnu/gcc/gcc-12.1.0/gcc-12.1.0.tar.xz" +MD5SUM="ed45b55ee859ada4b25a1e76e0c4d966" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="%README%" +MAINTAINER="Eugen Wissner" +EMAIL="belka@caraus.de" diff --git a/private/gcc-latest/patches/gcc-no_fixincludes.diff b/private/gcc-latest/patches/gcc-no_fixincludes.diff new file mode 100644 index 0000000..e152e08 --- /dev/null +++ b/private/gcc-latest/patches/gcc-no_fixincludes.diff @@ -0,0 +1,27 @@ +--- ./gcc/Makefile.in.orig 2018-03-09 09:24:44.000000000 -0600 ++++ ./gcc/Makefile.in 2018-05-02 12:25:43.958002771 -0500 +@@ -3004,9 +3004,9 @@ + chmod a+r $${fix_dir}/limits.h; \ + done + # Install the README +- rm -f include-fixed/README +- cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README +- chmod a+r include-fixed/README ++# rm -f include-fixed/README ++# cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README ++# chmod a+r include-fixed/README + $(STAMP) $@ + + .PHONY: install-gcc-tooldir +@@ -3087,10 +3087,7 @@ + (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \ + SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \ + gcc_dir=`${PWD_COMMAND}` ; \ +- export TARGET_MACHINE srcdir SHELL MACRO_LIST && \ +- cd $(build_objdir)/fixincludes && \ +- $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \ +- $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ ++ export TARGET_MACHINE srcdir SHELL MACRO_LIST ); \ + rm -f $${fix_dir}/syslimits.h; \ + if [ -f $${fix_dir}/limits.h ]; then \ + mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \ diff --git a/private/gcc-latest/slack-desc b/private/gcc-latest/slack-desc new file mode 100644 index 0000000..a1b45b3 --- /dev/null +++ b/private/gcc-latest/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +gcc-latest: gcc-latest (GCC package with C, C++ and D support) +gcc-latest: +gcc-latest: GCC is the GNU Compiler Collection. +gcc-latest: +gcc-latest: D is a general-purpose programming language with static typing, +gcc-latest: systems-level access, and C-like syntax. +gcc-latest: +gcc-latest: +gcc-latest: +gcc-latest: +gcc-latest: