PKGBUILDs/community/gdc/PKGBUILD
2016-12-27 01:08:57 +00:00

150 lines
5 KiB
Bash

# $Id$
# 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: Kevin Mihelich <kevin@archlinuxarm.org>
# - use GitHub gcc mirror commit archive (order of magnitude size difference)
# - --disable-libmpx
# - specified build host
# - make -j 4
pkgname=('gdc' 'libgphobos-devel' 'libgphobos')
pkgver=6.2.1
pkgrel=1
_islver=0.16.1
_gcc_commit=c2103c1
arch=('i686' 'x86_64')
license=('GPL')
url="https://github.com/D-Programming-GDC/GDC"
makedepends=('binutils>=2.26' 'git')
source=(
https://github.com/gcc-mirror/gcc/archive/${_gcc_commit}.tar.gz
http://isl.gforge.inria.fr/isl-$_islver.tar.bz2
gdc::git://github.com/D-Programming-GDC/GDC.git#tag=v2.068.2_gcc6
git+https://github.com/D-Programming-GDC/GDMD.git
paths.diff
)
sha256sums=('fef2f7ae26641cad4819f8664b03e71060905c337117ec3b703ab72f857a1026'
'412538bb65c799ac98e17e8cfcdacbb257a57362acfaaff254b0fcae970126d2'
'SKIP'
'SKIP'
'e04cea391007ebab5d9b0ff33179c1fded0afcf43059b811290472ea52222361')
_libdir="usr/lib/gcc/$CHOST/$pkgver"
prepare() {
mv gcc-${_commit}* gcc
cd $srcdir/gcc
# link isl for in-tree build
ln -s ../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
# Arch Linux ARM installs aarch64 libraries /lib
[[ $CARCH == "aarch64" ]] && sed -i '/lp64=/s/lib64/lib/' gcc/config/aarch64/t-aarch64-linux
# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
# GDC setup
cd $srcdir/gdc
git apply $srcdir/paths.diff
./setup-gcc.sh ../gcc
mkdir $srcdir/gcc-build
}
build() {
cd $srcdir/gcc-build
# ALARM: Specify build host types, triplet patch
[[ $CARCH == "arm" ]] && CONFIGFLAG="--host=armv5tel-unknown-linux-gnueabi --build=armv5tel-unknown-linux-gnueabi --with-arch=armv5te --with-float=soft"
[[ $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-shared \
--enable-static \
--enable-threads=posix \
--disable-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 \
--enable-default-pie \
--disable-multilib \
--disable-werror \
--enable-languages=d \
gdc_include_dir=/usr/include/dlang/gdc $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"
# compiler
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")
cd $srcdir/gcc-build
make -C $CHOST/libphobos DESTDIR=$pkgdir install
# remove shared library bits, they go into own package
rm $pkgdir/usr/lib/lib*so*
}
package_libgphobos()
{
pkgdesc="Shared standard library for D programming language, GDC port"
provides=("d-runtime" "d-stdlib")
cd $srcdir/gcc-build
install -D -m644 $CHOST/libphobos/src/.libs/libgphobos.so $pkgdir/usr/lib/libgphobos.so
install -D -m644 $CHOST/libphobos/libdruntime/.libs/libgdruntime.so $pkgdir/usr/lib/libgdruntime.so
}