]> Pileus Git - ~andy/sunrise/blob - dev-lang/dmd/dmd-1.066.ebuild
app-dicts/words-bin: Adding ~amd64 keyword
[~andy/sunrise] / dev-lang / dmd / dmd-1.066.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=4
6
7 inherit eutils multilib flag-o-matic
8
9 MY_P=${P/-/.}
10
11 DESCRIPTION="Digital Mars D Compiler"
12 HOMEPAGE="http://www.digitalmars.com/d/"
13 SRC_URI="http://ftp.digitalmars.com/${MY_P}.zip"
14
15 # License doesn't allow redistribution
16 LICENSE="DMD"
17 RESTRICT="mirror"
18 SLOT="1"
19 KEYWORDS="~amd64"
20 IUSE="tools"
21
22 DEPEND="sys-apps/findutils
23         app-arch/unzip"
24 RDEPEND=""
25
26 S="${WORKDIR}/dmd"
27
28 src_prepare() {
29         # remove unnecessary files
30         rm -r freebsd html osx linux/lib/* \
31         linux/bin/{README.TXT,dmd,dmd.conf} windows \
32         samples README.TXT license.txt || die "something went wrong"
33
34         cd "${S}"/src
35
36         # patch for slot-compatibility
37         epatch "${FILESDIR}/slot-compat.patch"
38         # patch for makefile
39         epatch "${FILESDIR}/${P}-makefile.patch"
40         # fix stack elf
41         epatch "${FILESDIR}/stackelf.patch"
42
43         append-ldflags $(no-as-needed)
44 }
45
46 src_compile() {
47         cd "${S}"/src/dmd
48
49         # make dmd
50         emake -f linux.mak
51         cp dmd idgen impcnvgen optabgen "${S}"/linux/bin || die "failed"
52         fperms guo=rx ../../linux/bin/dmd
53
54         # make phobos
55         cd "${S}"/src/phobos
56         # zlib 1.2.5 will be statically linked
57         emake -j1 -f linux.mak "DMD="${S}"/linux/bin/dmd"
58         cp libphobos.a "${S}"/linux/lib || die "failed"
59
60         # Clean up
61         emake -f linux.mak clean
62         find "${S}" \( -name "*.c" -o -name "*.h" -o -name "*.mak" -o -name "*.txt" \
63         -o -name "*.obj" -o -name "*.ddoc" -o -name "*.asm" \) -exec rm -v {} \; || die "failed"
64 }
65
66 src_install() {
67         # Lib
68         dolib.a linux/lib/libphobos.a
69
70         # Install dmd compiler
71         newbin linux/bin/dmd dmd1
72
73         # Build new dmd1.conf
74         cat > dmd1.conf << END
75 [Environment]
76 DFLAGS=-I/usr/include/phobos1 -L-L/usr/$(get_libdir)
77 END
78         insinto /etc
79         doins dmd1.conf
80
81         # Includes
82         insinto /usr/include/phobos1
83         doins -r src/phobos/*
84
85         # Man pages
86         newman man/man1/dmd.1 dmd1.1
87         newman man/man1/dmd.conf.5 dmd1.conf.5
88
89         if use tools; then
90                 doman man/man1/dumpobj.1
91                 doman man/man1/obj2asm.1
92                 doman man/man1/rdmd.1
93
94                 # Tools
95                 dobin linux/bin/{dumpobj,obj2asm,rdmd}
96         fi
97 }
98
99 pkg_postinst () {
100         ewarn "                                                 "
101         ewarn "DMD1 uses "dmd1.conf", not "dmd.conf"!           "
102         ewarn "                                                 "
103 }