SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "gcc"

# SliTaz package receipt.

PACKAGE="gcc"
VERSION="8.3.0"
CATEGORY="development"
SHORT_DESC="The GNU Compiler Collection."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.xz"
WEB_SITE="http://gcc.gnu.org/"
WGET_URL="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$VERSION/$TARBALL"
TAGS="compiler C"
#HOST_ARCH="i486 arm"

DEPENDS="binutils libgomp libobjc gcc-lib-base mpc-library elfutils"
BUILD_DEPENDS="mpc-library mpfr-dev gmp-dev elfutils-dev gc-dev"

# Handle cross compilation (native i486/ARM gcc)
case "$ARCH" in
    i?86)
        ARCH_ARGS="--with-tune=$ARCH"
        pkgversion="SliTaz"
        languages="c,c++,objc,fortran" ;;
    arm*)
        pkgversion="SliTaz ARM"
        languages="c,c++" ;;
esac

# What is the latest version available today?
current_version()
{
    wget -O - 'https://gcc.gnu.org/git/?p=gcc.git;a=summary' 2>/dev/null | \
    sed '/ release/!d;s|.*GCC ||;s| release.*||' | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
    # Package slitaz-toolchain use 'cook --options' when rebuilding
    # the full SliTaz toolchain.
    [ "$2" = "--first-pass" ] && opt=$2
    [ "$3" = "--first-pass" ] && opt=$3

    # Use libiberty.a from binutils.
    sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in || return 1

    case "$ARCH" in
        i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;
    esac

    #sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in

    # Allow build gcc 6.3.0 from gcc > 6.3.0
    patch -p1 < $stuff/gcc-6.3.0-ubsan.patch

    mkdir -p ../gcc-build && cd ../gcc-build

    # This is the default GCC and we want a native build to cross compile after.
    # SliTaz target i486 host so we need a native i486 build for GCC.
    case "$opt" in
        --first-pass)
            # Used by slitaz-toolchain when rebuilding the full toolchain.
            echo "cook: configure GCC for: toolchain first pass"
                sed -i 's|\(add-gnu-debuglink.*\);|\1 2> /dev/null;|' \
                        $src/libbacktrace/configure*
            $src/configure \
                --libexecdir=/usr/lib \
                --disable-nls \
                --enable-shared \
                --enable-languages=c,c++ \
                --disable-libstdcxx-pch \
                --enable-__cxa_atexit \
                --enable-clocale=gnu \
                --enable-threads=posix \
                --disable-bootstrap \
                ${CONFIGURE_ARGS} &&
            make && make install ;;
        *)
            # Used by default to produce a full featured X86 GCC compiler.
            echo "cook: configure GCC for: final/full build"
            sed -i 's|\(add-gnu-debuglink.*\);|\1 2> /dev/null;|' \
                        $src/libbacktrace/configure*
            $src/configure \
                --libexecdir=/usr/lib \
                --enable-nls \
                --enable-languages=${languages} \
                --enable-shared \
                --with-system-zlib \
                --enable-clocale=gnu \
                --enable-objc-gc \
                --enable-__cxa_atexit \
                --enable-lto \
                --enable-threads=posix \
                --disable-bootstrap \
                --with-pkgversion="$pkgversion" \
                ${CONFIGURE_ARGS} ${ARCH_ARGS} &&
            make && make install ;;
    esac
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p  $fs/usr/share
    cp -a $install/usr/bin $fs/usr

    # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
    # the gcc-lib-base package.
    cp -a $install/usr/lib $fs/usr
    rm -f $fs/usr/lib/libgcc_s.so*
    rm -f $fs/usr/lib/libstdc++.so*
    rm -f $fs/usr/lib/libgomp.so*
    rm -f $fs/usr/lib/libobjc.so*

    # Include files.
    cp -a $install/usr/include $fs/usr

    # Gfortran goes in gfortran package.
    rm -f $fs/usr/bin/*gfortran
    rm -f $fs/usr/lib/libgfortran*
    rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
    rm -rf $fs/usr/lib/gcc/*/$VERSION/f*

    # Remove build directory.
    rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
    rm -rf $WOK/$PACKAGE/$PACKAGE-build

    # Ensure remove .la files    
    find $fs/usr/lib -name "lib*.la" -not -path "$fs/usr/lib/gcc/*" -delete
}

# Post install commands for Tazpkg.
post_install()
{
    [ -f "$1/lib/cpp" ] ||
        ln -s ../usr/bin/cpp "$1/lib"
    [ -f "$1/usr/bin/cc" ] ||
        ln -s gcc "$1/usr/bin/cc"
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)