Commit bcca4ab2 authored by Mathias LANG's avatar Mathias LANG Committed by Natanael Copa
Browse files

main/gcc: Fix most linting issues

parent f78c9f3f
......@@ -10,7 +10,7 @@ pkgrel=4
pkgdesc="The GNU Compiler Collection"
url="https://gcc.gnu.org"
arch="all"
license="GPL LGPL"
license="GPL-2.0-or-later LGPL-2.1-or-later"
_gccrel=$pkgver-r$pkgrel
depends="binutils$_target isl"
makedepends_build="gcc$_cross g++$_cross paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
......@@ -19,24 +19,24 @@ subpackages=" "
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
replaces="libstdc++ binutils"
: ${LANG_CXX:=true}
: ${LANG_D:=true}
: ${LANG_OBJC:=true}
: ${LANG_GO:=true}
: ${LANG_FORTRAN:=true}
: ${LANG_ADA:=true}
: "${LANG_CXX:=true}"
: "${LANG_D:=true}"
: "${LANG_OBJC:=true}"
: "${LANG_GO:=true}"
: "${LANG_FORTRAN:=true}"
: "${LANG_ADA:=true}"
LIBGOMP=true
LIBGCC=true
LIBATOMIC=true
LIBITM=true
_libgomp=true
_libgcc=true
_libatomic=true
_libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
LIBGCC=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
else
_builddir="$srcdir/build-cross-final"
......@@ -44,9 +44,9 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LIBGOMP=false
LIBATOMIC=false
LIBITM=false
_libgomp=false
_libatomic=false
_libitm=false
# reset target flags (should be set in crosscreate abuild)
# fixup flags. seems gcc treats CPPFLAGS as global without
......@@ -97,23 +97,23 @@ fi
# libitm has TEXTRELs in ARM build, so disable for now
case "$CTARGET_ARCH" in
arm*) LIBITM=false ;;
mips*) LIBITM=false ;;
arm*) _libitm=false ;;
mips*) _libitm=false ;;
esac
# Fortran uses libquadmath if toolchain has __float128
# currently on x86, x86_64 and ia64
LIBQUADMATH=$LANG_FORTRAN
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
*) LIBQUADMATH=false ;;
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
# libatomic is a dependency for openvswitch
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $LIBGOMP; then
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $_libgomp; then
depends="$depends libgomp=$_gccrel"
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
......@@ -192,8 +192,8 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
# we build out-of-tree
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
_gcclibdir="/usr/lib/gcc/$CTARGET/$pkgver"
_gcclibexec="/usr/libexec/gcc/$CTARGET/$pkgver"
prepare() {
cd "$_gccdir"
......@@ -268,10 +268,10 @@ build() {
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
esac
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
......@@ -296,7 +296,7 @@ build() {
--build=${CBUILD} \
--host=${CHOST} \
--target=${CTARGET} \
--with-pkgversion="Alpine ${pkgver}" \
--with-pkgversion="Alpine $pkgver" \
--enable-checking=release \
--disable-fixed-point \
--disable-libstdcxx-pch \
......@@ -320,36 +320,37 @@ build() {
package() {
cd "$_builddir"
make -j1 DESTDIR="${pkgdir}" install
make -j1 DESTDIR="$pkgdir" install
ln -s gcc "$pkgdir"/usr/bin/cc
# we dont support gcj -static
# and saving 35MB is not bad.
find "$pkgdir" -name libgtkpeer.a \
find "$pkgdir" \( -name libgtkpeer.a \
-o -name libgjsmalsa.a \
-o -name libgij.a \
| xargs rm -f
-o -name libgij.a \) \
-delete
# strip debug info from some static libs
${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libgphobos.a -o -name libgdruntime.a \
-o -name libmudflap.a -o -name libmudflapth.a \
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
-a -type f`
-a -type f \
-exec ${STRIP_FOR_TARGET} -g {} +
if $LIBGOMP; then
if $_libgomp; then
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
fi
if $LIBITM; then
if $_libitm; then
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
fi
# remove ffi
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
find "$pkgdir" -name 'ffi*.h' -delete
local gdblib=${_target:+$CTARGET/}lib
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
......@@ -372,15 +373,15 @@ package() {
if [ "$CHOST" != "$CTARGET" ]; then
# cross-gcc: remove any files that would conflict with the
# native gcc package
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
# libcc1 does not depend on target, don't ship it
rm -rf "$pkgdir"/usr/lib/libcc1.so*
# fixup gcc library symlinks to be linker scripts so
# linker finds the libs from relocated sysroot
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
if [ -h "$so" ]; then
local _real=$(basename $(readlink "$so"))
local _real=$(basename "$(readlink \"$so\")")
rm -f "$so"
echo "GROUP ($_real)" > "$so"
fi
......@@ -389,27 +390,27 @@ package() {
# add c89/c99 wrapper scripts
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
#!/bin/sh
fl="-std=c89"
_flavor="-std=c89"
for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) fl="";;
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
exit 1;;
esac
done
exec gcc $fl ${1+"$@"}
exec gcc $_flavor ${1+"$@"}
EOF
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
#!/bin/sh
fl="-std=c99"
_flavor="-std=c99"
for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) fl="";;
-std=c99|-std=iso9899:1999) _flavor="";;
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
exit 1;;
esac
done
exec gcc $fl ${1+"$@"}
exec gcc $_flavor ${1+"$@"}
EOF
chmod 755 "$pkgdir"/usr/bin/c?9
fi
......@@ -501,8 +502,8 @@ gdc() {
mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
# Copy: The installed `.d` files, the static lib, the binary itself
# The shared libs are part of `libgphobos` so one can run program
# Copy: The installed '.d' files, the static lib, the binary itself
# The shared libs are part of 'libgphobos' so one can run program
# without installing the compiler
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
......@@ -555,7 +556,7 @@ libquadmath() {
gfortran() {
pkgdesc="GNU Fortran Compiler"
depends="gcc=$_gccrel libgfortran=$_gccrel"
$LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
$_libquadmath && depends="$depends libquadmath=$_gccrel"
replaces="gcc"
mkdir -p "$subpkgdir"/$_gcclibexec \
......@@ -566,7 +567,7 @@ gfortran() {
mv "$pkgdir"/usr/lib/libgfortran.a \
"$pkgdir"/usr/lib/libgfortran.so \
"$subpkgdir"/usr/lib/
if $LIBQUADMATH; then
if $_libquadmath; then
mv "$pkgdir"/usr/lib/libquadmath.a \
"$pkgdir"/usr/lib/libquadmath.so \
"$subpkgdir"/usr/lib/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment