PKGBUILDs/community/gdc/PKGBUILD
2016-05-10 00:08:49 +00:00

137 lines
5.3 KiB
Bash

# Maintainer: Mihails Strasuns <public@dicebot.lv>
# Contributor: Moritz Maxeiner <moritz@ucworks.org>
# Contributor: Jerome Berger <jeberger@free.fr>
# Contributor: Jesus Alvarez <jeezusjr@gmail.com>
# Contributor: Allan McRae <allan@archlinux.org>
# ALARM: Johannes Pfau <johannespfau@gmail.com>
# - specifid build host
# - replaced bugurl with our GitHub issue page
pkgname=('gdc' 'libgphobos-devel')
pkgver=6.1.1
pkgrel=1
_pkgver=6
_islver=0.16.1
_commit=80f78834
arch=('i686' 'x86_64')
license=('GPL')
url="https://github.com/D-Programming-GDC/GDC"
makedepends=('binutils>=2.26' 'git' 'gcc' 'make' 'perl' 'automake')
options=('!emptydirs' '!buildflags')
groups=('dlang' 'dlang-gdc')
conflicts=('gdc1-bin' 'gdc1-hg' 'gdc-git')
source=(
git://gcc.gnu.org/git/gcc.git#commit=${_commit}
http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2
gdc::git://github.com/D-Programming-GDC/GDC.git#commit=73a7fb5d4e75c0e1a4ee7cdb67d080cceb8ff955
git+https://github.com/D-Programming-GDC/GDMD.git
folders.diff
system_zlib.diff
)
sha256sums=(
'SKIP'
'412538bb65c799ac98e17e8cfcdacbb257a57362acfaaff254b0fcae970126d2'
'SKIP'
'SKIP'
'ea5c80a28026393bd4627485602660a4a01d9fbc65299e95e768013e197bad20'
'3c818788b5435794c37e5d3d131fe74c813368a3b7260f85fb2cd725308e4889'
)
# gcc-6.0 forces a changed triplet - need to address in pacman/devtools
[[ $CARCH == "x86_64" ]] && CHOST=x86_64-pc-linux-gnu
prepare() {
cd ${srcdir}/gcc
# link isl for in-tree build
ln -sf ../isl-${_islver} isl
# Do not run fixincludes
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
# Arch Linux installs x86_64 libraries /lib
[[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
cd $srcdir/gdc
git apply $srcdir/folders.diff # fix gdc_include_path
git apply $srcdir/system_zlib.diff # use correct system zlib
./setup-gcc.sh ../gcc
mkdir ${srcdir}/gcc-build
}
build() {
cd ${srcdir}/gcc-build
# ALARM: Specify build host types
[[ $CARCH == "arm" ]] && CONFIGFLAG="--host=armv5tel-unknown-linux-gnueabi --build=armv5tel-unknown-linux-gnueabi"
[[ $CARCH == "armv6h" ]] && CONFIGFLAG="--host=armv6l-unknown-linux-gnueabihf --build=armv6l-unknown-linux-gnueabihf --with-arch=armv6 --with-float=hard --with-fpu=vfp"
[[ $CARCH == "armv7h" ]] && CONFIGFLAG="--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16"
[[ $CARCH == "aarch64" ]] && CONFIGFLAG="--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a"
# using -pipe causes spurious test-suite failures
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
CFLAGS=${CFLAGS/-pipe/}
CXXFLAGS=${CXXFLAGS/-pipe/}
${srcdir}/gcc/configure --prefix=/usr \
--libdir=/usr/lib --libexecdir=/usr/lib \
--mandir=/usr/share/man --infodir=/usr/share/info \
--with-bugurl=https://archlinuxarm.org/forum \
--enable-languages=d \
--enable-shared --enable-threads=posix --enable-libmpx \
--with-system-zlib --with-isl --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-clocale=gnu \
--disable-libstdcxx-pch --disable-libssp \
--enable-gnu-unique-object --enable-linker-build-id \
--enable-lto --enable-plugin --enable-install-libiberty \
--with-linker-hash-style=gnu --enable-gnu-indirect-function \
--disable-multilib --disable-werror \
--enable-checking=release $CONFIGFLAG
make -j 4
}
package_gdc()
{
depends=('gcc' 'perl' 'binutils' 'libgphobos-devel')
provides=("d-compiler")
pkgdesc="Compiler for D programming language which uses gcc backend"
install -D -m755 $srcdir/gcc-build/gcc/gdc $pkgdir/usr/bin/gdc
install -D -m755 $srcdir/gcc-build/gcc/cc1d $pkgdir/usr/lib/gcc/$CHOST/$pkgver/cc1d
# tools
install -D -m755 $srcdir/GDMD/dmd-script $pkgdir/usr/bin/gdmd
install -D -m644 $srcdir/GDMD/dmd-script.1 $pkgdir/usr/share/man/man1/gdmd.1
}
package_libgphobos-devel()
{
pkgdesc="Standard library for D programming language, GDC port"
provides=("d-runtime" "d-stdlib")
options=("staticlibs")
# druntime
install -D $srcdir/gdc/libphobos/libdruntime/object.d $pkgdir/usr/include/dlang/gdc/object.d
install -D $srcdir/gdc/libphobos/libdruntime/__entrypoint.di ${pkgdir}/usr/include/dlang/gdc/__entrypoint.di
cp -r $srcdir/gdc/libphobos/libdruntime/core $pkgdir/usr/include/dlang/gdc/core
cp -r $srcdir/gdc/libphobos/libdruntime/gcc $pkgdir/usr/include/dlang/gdc/gcc
# workaround for auto-generated libbacktrace issue
# script needs to be re-written to first call normal gcc instalaltion targets to
# avoid such problems in future
cp $srcdir/gcc-build/$CHOST/libphobos/libdruntime/gcc/libbacktrace.d $pkgdir/usr/include/dlang/gdc/gcc/
rm $pkgdir/usr/include/dlang/gdc/gcc/libbacktrace.d.in
# phobos
# cp $srcdir/gdc/libphobos/src/crc32.d ${pkgdir}/usr/include/dlang/gdc/
cp -r $srcdir/gdc/libphobos/src/std ${pkgdir}/usr/include/dlang/gdc/std
cp -r $srcdir/gdc/libphobos/src/etc ${pkgdir}/usr/include/dlang/gdc/etc
install -D -m644 $srcdir/gcc-build/$CHOST/libphobos/src/libgphobos2.a $pkgdir/usr/lib/libgphobos2.a
}