void-packages/srcpkgs/gcc/template
2014-03-16 12:38:10 +01:00

418 lines
12 KiB
Text

# Template build file for 'gcc'
pkgname=gcc
_majorver=4.7
version=${_majorver}.3
revision=10
patch_args="-Np1"
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=2f7c37eb4fc14422ff2358a9ef59c974a75ab41204ef0e49fc34ab1d8981a9c3
hostmakedepends="perl flex"
makedepends="zlib-devel libmpc-devel>=1.0.1_2 ppl-devel>=1.0 cloog-devel isl-devel libfl-devel"
depends="binutils libgomp>=${_majorver} libitm>=${_majorver} libssp-devel>=${_majorver}"
if [ -z "$CROSS_BUILD" ]; then
# Required by gcj
hostmakedepends+=" zip unzip"
fi
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-unknown-linux-musl";;
armv5tel) _triplet="arm-linux-gnueabi";;
armv6l) _triplet="arm-linux-gnueabihf";;
armv7l) _triplet="arm-linux-gnueabihf7";;
armv6l-musl) _triplet="arm-linux-musleabi";;
armv7l-musl) _triplet="arm-linux-musleabi7";;
esac
pre_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) patch -Np1 -i ${FILESDIR}/gcc-${version}-musl.diff ;;
esac
}
do_configure() {
local _langs _args
# 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
case "$XBPS_TARGET_MACHINE" in
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"
else
_langs="c,c++,objc,obj-c++,fortran,go,lto,java"
_args+=" --enable-java-gc=boehm --enable-fast-character"
fi
./configure --prefix=/usr --mandir=/usr/share/man \
--infodir=/usr/share/info --libexecdir=/usr/lib \
--enable-clocale=gnu --disable-bootstrap --libdir=/usr/lib \
--enable-threads=posix --enable-__cxa_atexit --disable-multilib \
--disable-rpath --with-system-zlib --enable-shared --enable-lto \
--enable-linker-build-id --enable-gnu-unique-object \
--enable-checking=release --disable-libstdcxx-pch \
--with-ppl --enable-cloog-backend=isl --enable-libstdcxx-time \
--enable-tls --enable-languages=${_langs} ${_args}
}
do_build() {
make ${makejobs}
}
do_install() {
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
vmkdir usr/lib
cd ${DESTDIR}/usr
ln -sf lib lib64
fi
cd ${wrksrc}
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
}
# Disabled packages in cross builds.
if [ -z "$CROSS_BUILD" ]; then
gcc-gcj_package() {
depends="gcc>=${_majorver} libgcj-devel>=${_majorver} eclipse-ecj"
short_desc="GCC 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-fortran_package() {
depends="gcc>=${_majorver} libgfortran-devel>=${_majorver}"
short_desc="GCC 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-go_package() {
depends="gcc>=${_majorver} libgo-devel>=${_majorver}"
short_desc="GCC 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-objc++_package() {
depends="gcc-c++>=${_majorver} gcc-objc>=${_majorver}"
short_desc="GCC Objective-C++ support"
pkg_install() {
vmove usr/lib/gcc/${_triplet}/${_majorver}/cc1objplus
}
}
gcc-objc_package() {
depends="gcc>=${_majorver} libobjc>=${_majorver}"
short_desc="GCC 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="GCC 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-4.7.pc
}
}
libgcj_package() {
short_desc="GCC Java library"
pkg_install() {
vmove "usr/lib/libgcj*.so*"
vmove "usr/lib/libgij.so*"
vmove usr/lib/gcj-${version}-13
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="GCC Fortran library - development files"
pkg_install() {
vmove usr/lib/libgfortran.a
vmove usr/lib/gcc/${_triplet}/${_majorver}/libgfortranbegin.a
}
}
libgfortran_package() {
short_desc="GCC 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="GCC Go library - development files"
pkg_install() {
vmove usr/lib/libgo.a
vmove usr/lib/libgobegin.a
}
}
libgo_package() {
short_desc="GCC 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="GCC Objective-C library - development files"
pkg_install() {
vmove "usr/lib/libobjc.*a"
}
}
libobjc_package() {
short_desc="GCC 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="GCC 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="GCC quadmath library"
pkg_install() {
vmove "usr/lib/libquadmath.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
fi # !CROSS_BUILD
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="GCC OpenMP v3.0 library - development files"
pkg_install() {
vmove usr/lib/libgomp.a
vmove usr/share/info/libgomp.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
libgomp_package() {
short_desc="GCC OpenMP v3.0 library"
replaces="gcc>=4.6.3<4.6.3_3"
pkg_install() {
vmove usr/lib/gcc/${_triplet}/${_majorver}/include/omp.h
vmove "usr/lib/libgomp*.so*"
vmove usr/lib/libgomp.spec
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libitm_package() {
short_desc="GCC Transactional Memory library"
pkg_install() {
vmove "usr/lib/libitm.*"
vmove usr/share/info/libitm.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
libmudflap-devel_package() {
depends="libmudflap>=${_majorver}"
short_desc="GCC mudflap library - development files"
pkg_install() {
vmove "usr/lib/libmudflap*.a"
}
}
libmudflap_package() {
short_desc="GCC mudflap library"
pkg_install() {
vmove "usr/lib/libmudflap*.so*"
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
libssp-devel_package() {
depends="glibc-devel libssp>=${_majorver}"
short_desc="GCC SSP (StackSmashingProtection)library - development files"
pkg_install() {
vmove "usr/lib/libssp*.a"
vmove usr/lib/gcc/${_triplet}/${_majorver}/include/ssp
}
}
libssp_package() {
short_desc="GCC 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="GCC Standard C++ Library - development files"
pkg_install() {
vmove "usr/lib/libstdc++.*a"
vmove "usr/lib/libsupc++.*"
for f in ${DESTDIR}/usr/include/c++/${_majorver}/*; do
[ "$(basename $f)" = "${_triplet}" ] && continue
vmove usr/include/c++/${_majorver}/$(basename $f)
done
vmove usr/include/c++/${_majorver}/${_triplet}/bits
cd ${PKGDESTDIR}/usr/include/c++
ln -sf ${_majorver} ${version}
}
}
libstdc++_package() {
short_desc="GCC Standard C++ Library"
pkg_install() {
vmove "usr/lib/libstdc++.so*"
vmove usr/share/locale/fr/LC_MESSAGES/libstdc++.mo
vmove usr/share/locale/de/LC_MESSAGES/libstdc++.mo
vinstall ${wrksrc}/COPYING.RUNTIME 644 usr/share/licenses/$pkgname RUNTIME.LIBRARY.EXCEPTION
}
}
gcc-c++_package() {
depends="gcc>=${_majorver} libstdc++-devel>=${_majorver}"
short_desc="GCC 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
}
}