summaryrefslogtreecommitdiff
path: root/community/gdc/PKGBUILD
blob: 02dee35b1e8911f13b64ffb2d72154d318810003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Maintainer: Mihails Strasuns <public@dicebot.lv>
# Contributor: Moritz Maxeiner <moritz@ucworks.org>
# Contributor: Jerome Berger <jeberger@free.fr>
# Contributor: Jesus Alvarez <jeezusjr@gmail.com>

pkgname=('gdc' 'libgphobos-devel')
pkgver=4.9.1
pkgrel=1
arch=('i686' 'x86_64')
url="https://github.com/D-Programming-GDC/GDC"
license=('GPL')
makedepends=('binutils>=2.23' 'git' 'gcc' 'make' 'perl' 'cloog' 'automake')
options=('!emptydirs' '!buildflags')
source=(
    "ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2"
    "gdc::git://github.com/D-Programming-GDC/GDC.git#branch=gdc-4.9"
    "git+https://github.com/D-Programming-GDC/GDMD.git"
    "folders.diff"
)
sha256sums=(
    'd334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e'
    'SKIP'
    'SKIP'
    '82f1ba0825164a74660bd5008d8f3acae1bacc3271c86475efc1601fe0da73c4'
)

groups=('dlang' 'dlang-gdc')
conflicts=('gdc1-bin' 'gdc1-hg' 'gdc-git')

prepare()
{
    cd $srcdir/gcc-$pkgver

    # Arch Linux installs x86_64 libraries /lib
    [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64

    echo ${pkgver} > gcc/BASE-VER

    # 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
    ./setup-gcc.sh ../gcc-$pkgver

    mkdir $srcdir/gcc-build
}


build()
{
    cd ${srcdir}/gcc-build

    ${srcdir}/gcc-$pkgver/configure --prefix=/usr \
        --libdir=/usr/lib --libexecdir=/usr/lib \
        --mandir=/usr/share/man --infodir=/usr/share/info \
        --with-bugurl=https://bugs.archlinux.org/ \
        --enable-languages=d \
        --enable-shared --enable-threads=posix \
        --with-system-zlib --enable-__cxa_atexit \
        --disable-libunwind-exceptions --enable-clocale=gnu \
        --disable-libstdcxx-pch --disable-libssp \
        --enable-gnu-unique-object --enable-linker-build-id \
        --enable-cloog-backend=isl --disable-cloog-version-check \
        --enable-gold --enable-plugin --enable-ld=default \
        --enable-install-libiberty --with-plugin-ld=ld.gold \
        --with-linker-hash-style=gnu \
        --disable-multilib --disable-werror \
        --disable-nls --disable-bootstrap \
        --disable-libgomp --disable-libmudflap --disable-libquadmath \
        --enable-checking=release

    make 
}

package_gdc()
{
    depends=('gcc' 'perl' 'binutils' 'libgphobos-devel')
    provides=("d-compiler")
    pkgdesc="Compiler for D programming language which uses gcc backend (2.064.2 frontend version)"
 
    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.di $pkgdir/usr/include/dlang/gdc/object.di
    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
}