void-packages/srcpkgs/gcc/template

507 lines
15 KiB
Plaintext

# Template build file for 'gcc'
pkgname=gcc
_majorver=4.9
version=${_majorver}.2
revision=2
short_desc="The GNU C Compiler"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://gcc.gnu.org"
license="GFDL-1.2, GPL-3, LGPL-2.1"
distfiles="http://ftp.gnu.org/pub/gnu/gcc/gcc-$version/gcc-$version.tar.bz2"
checksum=2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd
lib32disabled=yes
bootstrap=yes
if [ "$CHROOT_READY" ]; then
hostmakedepends="perl flex"
fi
makedepends="zlib-devel libmpc-devel>=1.0.1_2 cloog-devel>=0.18"
depends="binutils libgcc-${version}_${revision}"
# mudflap is gone in 4.9
replaces="libmudflap>=0 libmudflap-devel>=0 chroot-gcc>=0"
subpackages="libgcc libgomp libgomp-devel libatomic libatomic-devel"
subpackages+=" libitm libitm-devel libssp libssp-devel gcc-c++"
if [ "$CHROOT_READY" -a -z "$CROSS_BUILD" ]; then
# Required by gcj
hostmakedepends+=" zip unzip"
subpackages+=" gcc-gcj gcc-go gcc-fortran gcc-objc gcc-objc++"
subpackages+=" libgcj-devel libgcj libgo-devel libgo"
subpackages+=" libgfortran-devel libgfortran"
subpackages+=" libobjc-devel libobjc"
fi
subpackages+=" libstdc++-devel libstdc++"
case "$XBPS_TARGET_MACHINE" in
i686) _triplet="i686-pc-linux-gnu";;
i686-musl) _triplet="i686-pc-linux-musl";;
x86_64) _triplet="x86_64-unknown-linux-gnu";;
x86_64-musl) _triplet="x86_64-linux-musl";;
armv5tel) _triplet="arm-linux-gnueabi";;
armv6l) _triplet="arm-linux-gnueabihf";;
armv7l) _triplet="arm-linux-gnueabihf7";;
arm*-musl) _triplet="arm-linux-musleabi";;
esac
case "$XBPS_TARGET_MACHINE" in
*-musl) depends+=" musl";;
*) subpackages+=" libsanitizer libsanitizer-devel"; depends+=" glibc-devel";;
esac
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*)
subpackages+=" libquadmath libquadmath-devel"
subpackages+=" libcilkrts libcilkrts-devel"
subpackages+=" libvtv libvtv-devel"
;;
esac
pre_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) patch -Np1 -i ${FILESDIR}/gcc-${version}-musl.diff;;
esac
# As specified in the LFS book, disable installing libiberty.
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
# Do not run fixincludes
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
}
do_configure() {
local _langs _args
case "$XBPS_TARGET_MACHINE" in
armv5*) _args+=" --with-arch=armv5te --with-float=soft";;
armv6l*) _args+=" --with-arch=armv6 --with-fpu=vfp --with-float=hard";;
armv7l*) _args+=" --with-arch=armv7-a --with-fpu=vfpv3 --with-float=hard";;
esac
if [ "$CROSS_BUILD" ]; then
export CC_FOR_TARGET="$CC"
export GCC_FOR_TARGET="$CC"
export CXX_FOR_TARGET="$CXX"
_langs="c,c++,lto"
_args+=" --disable-multilib --host=$XBPS_CROSS_TRIPLET --with-build-sysroot=${XBPS_CROSS_BASE}"
else
case "$XBPS_TARGET_MACHINE" in
arm*) _args+=" --build=${_triplet}";;
esac
_langs="c,c++,objc,obj-c++,fortran,lto,go,java"
_args+=" --enable-java-gc=boehm --enable-fast-character"
fi
if [ -z "$CHROOT_READY" ]; then
export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib"
_args+=" --with-gmp=${XBPS_MASTERDIR}/usr"
_args+=" --with-mpfr=${XBPS_MASTERDIR}/usr"
_args+=" --with-isl=${XBPS_MASTERDIR}/usr"
_args+=" --with-mpc=${XBPS_MASTERDIR}/usr"
_args+=" --with-cloog=${XBPS_MASTERDIR}/usr"
_langs="c,c++,lto"
fi
case "$XBPS_TARGET_MACHINE" in
*-musl) _args+=" --disable-libsanitizer";;
esac
CONFIG_SHELL=/bin/bash \
./configure --prefix=/usr --mandir=/usr/share/man \
--infodir=/usr/share/info --libexecdir=/usr/lib \
--enable-clocale=gnu --libdir=/usr/lib \
--enable-threads=posix --enable-__cxa_atexit --disable-multilib \
--with-system-zlib --enable-shared --enable-lto \
--enable-linker-build-id --enable-gnu-unique-object \
--enable-checking=release --disable-libstdcxx-pch \
--enable-cloog-backend=isl --with-linker-hash-style=gnu \
--enable-languages=${_langs} --enable-sjlj-exceptions=no ${_args}
}
do_build() {
if [ -z "$CHROOT_READY" ]; then
export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib"
fi
make ${makejobs}
}
pre_install() {
if [ "$CROSS_BUILD" ]; then
# XXX otherwise links to host libpthread
for f in $(find ${wrksrc}/${XBPS_CROSS_TRIPLET} -type f -name libtool); do
sed -e "s,add_dir=\"-L\$libdir\",add_dir=\"-L${XBPS_CROSS_BASE}\$libdir\",g" -i $f
done
fi
}
do_install() {
case "$XBPS_TARGET_MACHINE" in
x86_64*)
vmkdir usr/lib
ln -sfr ${DESTDIR}/usr/lib ${DESTDIR}/usr/lib64
;;
esac
make DESTDIR=${DESTDIR} install
# Make version a symlink of major version to make all versions
# from the same series work automagically.
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${version} \
${DESTDIR}/usr/lib/gcc/${_triplet}/${_majorver}
ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${_majorver} \
${DESTDIR}/usr/lib/gcc/${_triplet}/${version}
# Ditto for c++ headers.
mv ${DESTDIR}/usr/include/c++/${version} \
${DESTDIR}/usr/include/c++/${_majorver}
ln -sfr ${DESTDIR}/usr/include/c++/${_majorver} \
${DESTDIR}/usr/include/c++/${version}
# cc symlink.
ln -sfr ${DESTDIR}/usr/bin/gcc ${DESTDIR}/usr/bin/cc
# rpcgen wants /lib/cpp, make a symlink
ln -sfr ${DESTDIR}/usr/bin/cpp ${DESTDIR}/usr/lib/cpp
if [ -e ${DESTDIR}/usr/lib64 ]; then
rm -f ${DESTDIR}/usr/lib64
fi
# Remove libffi stuff.
rm -f ${DESTDIR}/usr/lib/libffi*
rm -f ${DESTDIR}/usr/share/man/man3/ffi*
# Remove all python scripts in libdir.
rm -f ${DESTDIR}/usr/lib/*.py
# Remove more python stuff.
if [ -d ${DESTDIR}/usr/share/gcc-${version}/python ]; then
rm -rf ${DESTDIR}/usr/share/gcc-${version}/python
fi
# Install c89 and c99 wrappers and its manpages, from NetBSD.
for f in c89 c99; do
vinstall ${FILESDIR}/${f}.sh 755 usr/bin ${f}
vinstall ${FILESDIR}/${f}.1 644 usr/share/man/man1 ${f}.1
done
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*) ;;
*) rm -f ${DESTDIR}/usr/share/info/libquadmath.info;;
esac
}
gcc-gcj_package() {
lib32disabled=yes
depends="gcc>=${_majorver} libgcj-devel>=${_majorver} eclipse-ecj"
short_desc+=" - Java compiler frontend"
pkg_install() {
for f in gcj jv-convert gjarsigner gjar grmic jcf-dump \
gtnameserv gcjh gnative2ascii gserialver gkeytool \
gij grmiregistry grmid gorbd gcj-dbtool gjavah \
gc-analyze gappletviewer rebuild-gcj-db aot-compile; do
vmove usr/bin/${f}
done
for f in gcj jv-convert gjarsigner gjar grmic jcf-dump gjdoc \
gtnameserv gcjh gnative2ascii gserialver gkeytool \
gij grmiregistry grmid gorbd gcj-dbtool gjavah \
gc-analyze gappletviewer rebuild-gcj-db aot-compile; do
if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
vmove usr/share/man/man1/${f}.1
fi
done
vmove usr/bin/${_triplet}-gcj
vmove usr/lib/gcc/${_triplet}/${_majorver}/jc1
vmove usr/lib/gcc/${_triplet}/${_majorver}/jvgenmain
vmove usr/share/info/gcj.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
gcc-go_package() {
lib32disabled=yes
depends="gcc>=${_majorver} libgo-devel>=${_majorver}"
short_desc+=" - Go compiler frontend"
pkg_install() {
for f in gccgo ${_triplet}-gccgo; do
vmove usr/bin/${f}
done
vmove usr/lib/gcc/${_triplet}/${_majorver}/go1
vmove usr/share/info/gccgo.info
touch ${PKGDESTDIR}/usr/share/info/dir
vmove usr/share/man/man1/gccgo.1
vmove usr/lib/go
}
}
gcc-fortran_package() {
lib32disabled=yes
depends="gcc>=${_majorver} libgfortran-devel>=${_majorver}"
short_desc+=" - Fortran compiler frontend"
pkg_install() {
for f in gfortran ${_triplet}-gfortran; do
vmove usr/bin/${f}
done
vmove usr/lib/gcc/${_triplet}/${_majorver}/f951
vmove usr/lib/gcc/${_triplet}/${_majorver}/finclude
vmove usr/share/info/gfortran.info
touch ${PKGDESTDIR}/usr/share/info/dir
vmove usr/share/man/man1/gfortran.1
}
}
gcc-objc++_package() {
lib32disabled=yes
depends="gcc-c++>=${_majorver} gcc-objc>=${_majorver}"
short_desc+=" - Objective-C++ support"
pkg_install() {
vmove usr/lib/gcc/${_triplet}/${_majorver}/cc1objplus
}
}
gcc-objc_package() {
lib32disabled=yes
depends="gcc>=${_majorver} libobjc>=${_majorver}"
short_desc+=" - Objective-C support"
pkg_install() {
vmove usr/lib/gcc/${_triplet}/${_majorver}/include/objc
vmove usr/lib/gcc/${_triplet}/${_majorver}/cc1obj
}
}
libgcj-devel_package() {
short_desc+=" - Java library - development files"
pkg_install() {
vmove usr/include/c++/${_majorver}/gnu
vmove usr/include/c++/${_majorver}/java
vmove usr/include/c++/${_majorver}/javax
vmove usr/include/c++/${_majorver}/sun
vmove usr/include/c++/${_majorver}/gcj
vmove usr/include/c++/${_majorver}/org
vmove usr/lib/gcc/${_triplet}/${_majorver}/plugin/include/java
vmove "usr/lib/gcc/${_triplet}/${_majorver}/include/jni*"
vmove "usr/lib/gcc/${_triplet}/${_majorver}/include/gcj*"
vmove "usr/lib/gcc/${_triplet}/${_majorver}/include/jvm*"
vmove "usr/lib/gcc/${_triplet}/${_majorver}/include/jawt*"
vmove usr/lib/pkgconfig/libgcj-${_majorver}.pc
}
}
libgcj_package() {
short_desc+=" - Java libraries"
pkg_install() {
vmove "usr/lib/libgcj*.so*"
vmove "usr/lib/libgij.so*"
vmove usr/lib/gcj-${version}-15
vmove usr/lib/logging.properties
vmove usr/lib/libgcj.spec
vmove usr/lib/security/classpath.security
vmove usr/share/java
}
}
libgfortran-devel_package() {
depends="libgfortran>=${_majorver}"
short_desc+=" - Fortran library - development files"
pkg_install() {
vmove usr/lib/libgfortran.a
vmove usr/lib/gcc/${_triplet}/${_majorver}/libgfortranbegin.a
}
}
libgfortran_package() {
short_desc+=" - Fortran library"
pkg_install() {
vmove "usr/lib/libgfortran.so*"
vmove usr/lib/libgfortran.spec
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libgo-devel_package() {
depends="libgo>=${_majorver}"
short_desc+=" - Go library - development files"
pkg_install() {
vmove usr/lib/libgo.a
vmove usr/lib/libgobegin.a
}
}
libgo_package() {
short_desc+=" - Go library"
pkg_install() {
vmove "usr/lib/libgo.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libobjc-devel_package() {
depends="libobjc>=${_majorver}"
short_desc+=" - Objective-C library - development files"
pkg_install() {
vmove "usr/lib/libobjc.*a"
}
}
libobjc_package() {
short_desc+=" - Objective-C library"
pkg_install() {
vmove "usr/lib/libobjc.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libquadmath-devel_package() {
depends="libquadmath>=${_majorver}"
short_desc+=" - quadmath library - development files"
pkg_install() {
vmove "usr/lib/gcc/${_triplet}/${_majorver}/include/quadmath*"
vmove "usr/lib/libquadmath*.a"
vmove usr/share/info/libquadmath.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
libquadmath_package() {
short_desc+=" - quadmath library"
pkg_install() {
vmove "usr/lib/libquadmath.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libcilkrts-devel_package() {
depends="libcilkrts>=${_majorver}"
short_desc+=" - Intel(R) Cilk(TM) Plus runtime library - development files"
pkg_install() {
vmove usr/lib/gcc/${_triplet}/${_majorver}/include/cilk
vmove "usr/lib/gcc/${_triplet}/${_majorver}/plugin/include/cilk*"
vmove usr/lib/libcilkrts.so
vmove usr/lib/libcilkrts.a
vmove usr/lib/libcilkrts.spec
}
}
libcilkrts_package() {
short_desc+=" - Intel(R) Cilk(TM) Plus runtime library"
pkg_install() {
vmove usr/lib/libcilkrts.so.*
}
}
libvtv-devel_package() {
depends="libvtv>=${_majorver}"
short_desc+=" - Vtable Verification Runtime Library - development files"
pkg_install() {
vmove usr/lib/libvtv.a
vmove usr/lib/libvtv.so
}
}
libvtv_package() {
short_desc+=" - Vtable Verification Runtime Library"
pkg_install() {
vmove usr/lib/libvtv.so.*
}
}
libatomic-devel_package() {
depends="libatomic>=${_majorver}"
short_desc+=" - Atomics library - development files"
pkg_install() {
vmove usr/lib/libatomic.a
vmove usr/lib/libatomic.so
}
}
libatomic_package() {
short_desc+=" - Atomics library"
pkg_install() {
vmove usr/lib/libatomic.so.*
}
}
libgcc_package() {
short_desc+=" - GCC library"
noverifyrdeps=yes
pkg_install() {
vmove "usr/lib/libgcc_s.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libgomp-devel_package() {
depends="libgomp>=${_majorver}"
short_desc+=" - OpenMP v4.0 library - development files"
pkg_install() {
vmove usr/lib/gcc/${_triplet}/${_majorver}/include/omp.h
vmove usr/lib/libgomp.so
vmove usr/lib/libgomp.a
vmove usr/lib/libgomp.spec
vmove usr/share/info/libgomp.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
libgomp_package() {
short_desc+=" - OpenMP v4.0 library"
pkg_install() {
vmove "usr/lib/libgomp*.so.*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libitm-devel_package() {
depends="libitm>=${_majorver}"
short_desc+=" - Transactional Memory library - development files"
replaces="libitm<4.9.0_1"
pkg_install() {
vmove usr/lib/libitm.a
vmove usr/lib/libitm.so
vmove usr/lib/libitm.spec
vmove usr/share/info/libitm.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
libitm_package() {
short_desc+=" -Transactional Memory library"
pkg_install() {
vmove "usr/lib/libitm.so.*"
}
}
libsanitizer-devel_package() {
depends="libsanitizer>=${_majorver}"
short_desc+=" - Sanitizer libraries - development files"
pkg_install() {
vmove "usr/lib/lib*san*.so"
vmove "usr/lib/lib*san*.a"
vmove usr/lib/libasan_preinit.o
vmove usr/lib/libsanitizer.spec
}
}
libsanitizer_package() {
short_desc+=" - Sanitizer libraries"
pkg_install() {
vmove "usr/lib/lib*san*.so.*"
}
}
libssp-devel_package() {
depends="glibc-devel libssp>=${_majorver}"
short_desc+=" - SSP (StackSmashingProtection) library - development files"
pkg_install() {
vmove "usr/lib/libssp*.a"
vmove usr/lib/gcc/${_triplet}/${_majorver}/include/ssp
}
}
libssp_package() {
short_desc+=" - SSP (StackSmashingProtection) library"
pkg_install() {
vmove "usr/lib/libssp.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libstdc++-devel_package() {
depends="libstdc++>=${_majorver}"
short_desc+=" - Standard C++ Library - development files"
pkg_install() {
vmove "usr/lib/libstdc++.*a"
vmove "usr/lib/libsupc++.*"
vmove usr/include/c++
}
}
libstdc++_package() {
short_desc+=" - Standard C++ Library"
pkg_install() {
vmove "usr/lib/libstdc++.so*"
case "$XBPS_TARGET_MACHINE" in
*-musl);;
*)
vmove usr/share/locale/fr/LC_MESSAGES/libstdc++.mo
vmove usr/share/locale/de/LC_MESSAGES/libstdc++.mo
;;
esac
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
gcc-c++_package() {
lib32disabled=yes
depends="gcc>=${_majorver} libstdc++-devel>=${_majorver}"
short_desc+=" - C++ support"
pkg_install() {
for f in g++ c++ ${_triplet}-g++ ${_triplet}-c++; do
vmove usr/bin/${f}
done
vmove usr/lib/gcc/${_triplet}/${_majorver}/cc1plus
vmove usr/share/man/man1/g++.1
}
}