summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 94db2bb3342c83bbd1ffb33a6bf7f8f805b8c5bb (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# $Id: PKGBUILD 223492 2017-04-17 15:29:29Z foutrelis $
# 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>
# Contributor: Elijah Stone <elronnd@protonmail.ch>

pkgname=('gdc' 'libgphobos-devel' 'libgphobos')
pkgver=7.1.0
pkgrel=2
_islver=0.16.1
arch=('i686' 'x86_64')
license=('GPL')
url="https://github.com/D-Programming-GDC/GDC"
makedepends=('binutils>=2.26' 'git')

source=(
    https://ftp.gnu.org/pub/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.bz2
    http://isl.gforge.inria.fr/isl-$_islver.tar.bz2
    gdc::git+https://github.com/D-Programming-GDC/GDC.git
    git+https://github.com/D-Programming-GDC/GDMD.git
    paths.diff
)
sha256sums=(
    '8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17'
    '412538bb65c799ac98e17e8cfcdacbb257a57362acfaaff254b0fcae970126d2'
    'SKIP'
    'SKIP'
    'fefe9298f8d5859758ca63bab084984baa8adbbd85b3b3b8798283731321df7b'
)

_libdir="usr/lib/gcc/$CHOST/$pkgver"

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

    # 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

    # 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 checkout gdc-7
    git apply $srcdir/paths.diff
    ./setup-gcc.sh ../gcc-$pkgver

    mkdir $srcdir/gcc-build
}

build() {
    cd $srcdir/gcc-build

    # 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-$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-shared \
        --enable-static \
        --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 \
        --enable-default-pie \
        --disable-multilib \
        --disable-werror \
        --enable-gold \
        --enable-languages=d \
        gdc_include_dir=/usr/include/dlang/gdc

   make -j 8
}

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
}