123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- # Build recipe for GCC.
- #
- # Copyright (c) 2015-2018 Matias Fonzo, <selk@dragora.org>.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- program=gcc
- version=8-20181123
- release=1
- # Set 'outdir' for a nice and well-organized output directory
- outdir="${outdir}/${arch}/devel"
- tarname=${program}-${version}.tar.xz
- # Remote source(s)
- #fetch=http://gnu.c3sl.ufpr.br/ftp/gcc/gcc-${version}/$tarname
- fetch=ftp://gcc.gnu.org/pub/gcc/snapshots/${version}/$tarname
- homepage=http://www.gnu.org/software/gcc
- license="GPLv2+, GPLv3+, LGPLv2.1, LGPLv3 + GCC runtime library exception"
- description="
- The GNU C Compiler Collection.
- The GNU Compiler Collection (GCC) is a compiler system produced by the
- GNU Project supporting various programming languages. GCC is a key
- component of the GNU toolchain. The Free Software Foundation (FSF)
- distributes GCC under the GNU General Public License (GNU GPL).
- For more information about GCC, visit: $homepage
- "
- # Source documentation
- docs="COPYING* README"
- docsdir="${docdir}/${program}-${version}"
- # System-dependent
- MACHTYPE="$(cc -dumpmachine)"
- build()
- {
- set -e
- unpack "${tardir}/$tarname"
- cd "$srcdir"
- # Set sane permissions
- chmod -R u+w,go-w,a+rX-s .
- # Apply specific patches for the support in musl.
- # http://port70.net/~nsz/musl/gcc-8.2.0
- #patch -Np1 -i "${worktree}/patches/gcc/0001-ssp_nonshared.patch"
- patch -Np1 -i "${worktree}/patches/gcc/musl-libssp.diff"
- patch -Np1 -i "${worktree}/patches/gcc/0002-posix_memalign.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0003-libatomic-test-fix.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0004-libgomp-test-fix.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0005-libitm-test-fix.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0006-libvtv-test-fix.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0007-j2.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0008-s390x-muslldso.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0009-microblaze-pr65649.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0010-ldbl128-config.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0011-m68k.patch"
- patch -Np1 -i "${worktree}/patches/gcc/0012-static-pie.patch"
- # Create a separate build directory
- rm -rf ../gcc-build
- mkdir ../gcc-build
- cd ../gcc-build
- ../${program}-${version}/configure SED=sed \
- $configure_args \
- $multilib_options \
- $gcc_options \
- --libdir=/usr/lib${libSuffix} \
- --mandir=$mandir \
- --infodir=$infodir \
- --enable-bootstrap \
- --enable-languages=c,c++,objc,obj-c++,fortran \
- --enable-clocale=generic \
- --enable-threads=posix \
- --enable-tls \
- --enable-nls \
- --enable-lto \
- --enable-libstdcxx-time \
- --enable-checking=release \
- --enable-fully-dynamic-string \
- --enable-default-ssp \
- --enable-default-pie \
- --disable-libssp \
- --disable-symvers \
- --disable-libitm \
- --disable-gnu-indirect-function \
- --disable-libstdcxx-pch \
- --disable-libmudflap \
- --disable-libsanitizer \
- --disable-libmpx \
- --disable-libcilkrts \
- --with-system-zlib \
- --build=$MACHTYPE \
- --host=$MACHTYPE \
- --target=$MACHTYPE
- make -j${jobs} V=1
- make -j${jobs} V=1 DESTDIR="$destdir" install-strip
- # Back to source dir
- cd .. && cd "$srcdir"
- # Provide minimal libssp_nonshared.a so we don't need libssp from GCC
- cc $QICFLAGS -c "${worktree}/archive/gcc/__stack_chk_fail_local.c" \
- -o __stack_chk_fail_local.o
- ar r libssp_nonshared.a __stack_chk_fail_local.o
- cp -p libssp_nonshared.a "${destdir}/usr/lib${libSuffix}"
- strip -g "${destdir}/usr/lib${libSuffix}/libssp_nonshared.a"
- # Move misplaced file(s) for GDB
- mkdir -p "${destdir}/usr/share/gdb/auto-load/usr/lib${libSuffix}"
- mv "${destdir}/usr/lib${libSuffix}"/*-gdb.py \
- "${destdir}/usr/share/gdb/auto-load/usr/lib${libSuffix}"
- # Provide compatibility and make soft links for package size
- (
- cd "${destdir}/usr/bin" || exit 1
- mv gcc gcc-${version}
- ln -sf gcc-${version} gcc
- ln -sf gcc cc
- ln -sf gcc-${version} ${MACHTYPE}-gcc
- ln -sf gcc-${version} ${MACHTYPE}-gcc-${version}
- mv g++ g++-gcc-${version}
- ln -sf g++-gcc-${version} g++
- ln -sf g++ c++
- ln -sf g++-gcc-${version} ${MACHTYPE}-g++
- ln -sf g++-gcc-${version} ${MACHTYPE}-c++
- mv gfortran gfortran-${version}
- ln -sf gfortran-${version} gfortran
- ln -sf gfortran-${version} ${MACHTYPE}-gfortran
- # Extra symlinks for fortran
- ln -sf gfortran g77
- ln -sf g77 f77
- ln -sf gfortran g95
- ln -sf g95 f95
- mv gcc-ar gcc-ar-${version}
- ln -sf gcc-ar-${version} gcc-ar
- ln -sf gcc-ar-${version} ${MACHTYPE}-gcc-ar
- mv gcc-nm gcc-nm-${version}
- ln -sf gcc-nm-${version} gcc-nm
- ln -sf gcc-nm-${version} ${MACHTYPE}-gcc-nm
- mv gcc-ranlib gcc-ranlib-${version}
- ln -sf gcc-ranlib-${version} gcc-ranlib
- ln -sf gcc-ranlib-${version} ${MACHTYPE}-gcc-ranlib
- )
- (
- mkdir -p "${destdir}/lib" && \
- cd "${destdir}/lib" && ln -sf ../usr/bin/cpp .
- )
- # Compress info documents deleting index file for the package
- if test -d "${destdir}/$infodir"
- then
- rm -f "${destdir}/${infodir}/dir"
- lzip -9 "${destdir}/${infodir}"/* || true
- fi
- # Compress and link man pages (if needed)
- if test -d "${destdir}/$mandir"
- then
- (
- cd "${destdir}/$mandir"
- find . -type f -exec lzip -9 '{}' +
- find . -type l | while read -r file
- do
- ln -sf "$(readlink -- "$file").lz" "${file}.lz"
- rm -- "$file"
- done
- )
- fi
- # Copy documentation
- mkdir -p "${destdir}${docsdir}"
- cp -p $docs "${destdir}${docsdir}/"
- # Delete temporary build directory
- cd -- "$TMPDIR"
- if test -d ./gcc-build
- then
- rm -rf ./gcc-build
- fi
- }
|