Revert DOCTYPE SYSTEM https changes in metadata.xml
[gentoo.git] / dev-embedded / tigcc / tigcc-0.96_beta7.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 inherit eutils
6
7 BASE_BINUTILS="2.16.1"
8 GCC_VER="4.1.2"
9 GCC_SNAPSHOT="20060728"
10 BIN_VER=${BASE_BINUTILS:0:4}
11 ENV_FILE=${D}/etc/env.d/99tigcc
12 S="${WORKDIR}"
13 DESCRIPTION="Cross compiler for Texas Instruments TI-89, TI-92(+) and V200 calculators"
14 HOMEPAGE="http://tigcc.ticalc.org"
15
16 #original source can be found at:
17 #SRC_URI="http://tigcc.ticalc.org/linux/tigcc_src.tar.bz2"
18 #but in fact this file changes as soon as there comes a new beta
19
20 #when it hits portage of course it should be mirrored on a gentoo mirror:
21 #SRC_URI="mirror://gentoo/${PF}.tar.bz2"
22
23 SRC_URI="mirror://gentoo/tigcc-0.96_beta7.tar.bz2
24         ftp://gcc.gnu.org/pub/gcc/snapshots/4.1-${GCC_SNAPSHOT}/gcc-4.1-${GCC_SNAPSHOT}.tar.bz2
25         mirror://kernel/linux/devel/binutils/binutils-${BASE_BINUTILS}.tar.bz2
26         http://members.chello.at/gerhard.kofler/kevin/ti89prog/libfargo.zip
27         http://members.chello.at/gerhard.kofler/kevin/ti89prog/flashosa.zip"
28
29 LICENSE="GPL-2"
30
31 SLOT="0"
32 KEYWORDS="amd64 ppc ~sparc x86"
33 IUSE="doc"
34
35 RDEPEND=">=sys-devel/binutils-2.14.90.0.6-r1"
36 DEPEND="${RDEPEND}
37         app-arch/unzip
38         >=sys-devel/bison-1.875"
39
40 RESTRICT="strip"
41
42 src_unpack() {
43         unpack ${A}
44
45         # start by patching and cleaning out binutils and gcc directories.
46         cd "${WORKDIR}"/binutils-${BASE_BINUTILS}
47         epatch "${S}"/sources/gcc/gas-${BIN_VER}-tigcc-*.diff
48
49         rm -f .brik
50         rm -f md5.sum
51         rm -f -r INSTALL
52         rm -f -r maintainer-scripts
53         rm -f -r binutils
54         rm -f -r cpu
55         rm -f -r etc
56         rm -f -r gas/doc
57         rm -f -r gas/po
58         rm -f -r gprof
59         rm -f -r include/nlm
60         rm -f -r include/regs
61         rm -f -r ld
62         rm -f -r texinfo
63
64         cd "${WORKDIR}"/gcc-4.1-${GCC_SNAPSHOT}
65         epatch "${S}"/sources/gcc/gcc-4.1-tigcc-patch.diff
66
67         rm -f .brik
68         rm -f md5.sum
69         rm -f -r INSTALL
70         rm -f -r fixincludes
71         rm -f -r gcc/ginclude
72         rm -f -r gcc/po
73         rm -f -r gcc/doc
74         rm -f -r gcc/treelang
75         rm -f -r libcpp/po
76         rm -f -r maintainer-scripts
77         rm -f -r etc
78         rm -f -r gprof
79         rm -f -r include/nlm
80         rm -f -r include/regs
81         rm -f -r texinfo
82
83         # create build directories for binutils and gcc
84         mkdir -p "${WORKDIR}"/build/binutils
85         mkdir "${WORKDIR}"/build/gcc
86
87         # Workaround for non-existing directories
88         sed -ie '/SUBDIRS =/d' "${WORKDIR}"/binutils-${BASE_BINUTILS}/gas/Makefile.in
89 }
90
91 src_compile() {
92         # build binutils
93         cd "${WORKDIR}"/build/binutils
94         CFLAGS="${CFLAGS}" "${WORKDIR}"/binutils-${BASE_BINUTILS}/configure \
95                 --disable-serial-configure --target=m68k-coff --disable-shared \
96                 --enable-static --disable-multilib --disable-nls \
97                 || die
98         emake || die "gas"
99
100         # build gcc
101         cd "${WORKDIR}"/build/gcc
102         CFLAGS="${CFLAGS}" "${WORKDIR}"/gcc-4.1-${GCC_SNAPSHOT}/configure --target=m68k-coff \
103                                 --with-gnu-as --with-as="${WORKDIR}"/build/binutils/gas/as-new --with-gnu-ld \
104                                 --disable-nls --disable-multilib --disable-shared --enable-static \
105                                 --disable-threads --enable-languages=c --disable-win32-registry \
106                                 --disable-checking --disable-werror --disable-pch --disable-mudflap \
107                 || die
108
109         # GCC compilations _is intended_ to fail on a certain point,
110         # don't worry about that.
111         emake -j1
112
113         # Check if gcc has been built, die otherwise
114         ( [ -e "${WORKDIR}"/build/gcc/gcc/xgcc ] && [ -e "${WORKDIR}"/build/gcc/gcc/cc1  ] ) || die "gcc"
115
116         # build a68k assembler
117         cd "${S}"/sources/a68k
118         emake -e || die "a68k"
119
120         # build ld-tigcc linker
121         cd "${S}"/sources/ld-tigcc
122         emake -e || die "ld-tigcc"
123
124         # build tigcc front-end
125         cd "${S}"/sources/tigcc/src
126         emake -e || die "tigcc"
127
128         # build tprbuilder (TIGCC project builder)
129         cd "${S}"/sources/tprbuilder/src
130         emake -e || die "tprbuilder"
131
132         # build patcher (object file patcher)
133         cd "${S}"/sources/patcher/src
134         emake -e || die "patcher"
135
136 }
137
138 src_install() {
139         # install documentation
140         dodir /usr/bin
141
142         if use doc ; then
143                 # patch the script that launches the documentation
144                 # browser to point to the correct location
145                 sed "s:\${TIGCC}/doc:/usr/share/doc/${P}:g" \
146                         "${S}"/tigcclib/doc/converter/tigccdoc \
147                 > "${S}"/tigcclib/doc/converter/tigccdoc.new
148
149                 cd "${S}"/tigcclib/doc/converter
150                 newbin tigccdoc.new tigccdoc
151                 cd "${S}"/tigcclib/doc
152                 dohtml -r html/*
153                 cp html/qt-assistant.adp "${D}"/usr/share/doc/${PF}/html
154
155                 cd "${S}"/sources/a68k
156         fi
157
158         dodir /usr/share/doc/${PF}
159         cd "${S}"
160         dodoc AUTHORS BUGS CHANGELOG DIRECTORIES HOWTO \
161                 INSTALL README README.linux README.osX
162
163         cd "${S}"/sources/tigcc
164         docinto tigcc
165         dodoc AUTHORS ChangeLog README
166
167         cd "${S}"/sources/tprbuilder
168         docinto tprbuilder
169         dodoc AUTHORS ChangeLog README
170
171         cd "${S}"/sources/patcher
172         docinto patcher
173         dodoc AUTHORS ChangeLog README
174
175         exeinto /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}
176         # install gcc
177         cd "${WORKDIR}"/build/gcc
178         doexe gcc/cc1
179         newexe gcc/xgcc gcc
180         dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/gcc \
181                 /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/ti-linux-gnu-gcc
182
183         # install gas
184         # exeinto /usr/ti-linux-gnu/bin <-- a symlink will be
185         # created so that gas resides in /usr/ti-linux-gnu/bin too
186         cd "${WORKDIR}"/build/binutils
187         newexe gas/as-new as
188
189         # install a68k
190         cd "${S}"/sources/a68k
191         newexe A68k a68k
192
193         # install ld-tigcc
194         cd "${S}"/sources/ld-tigcc
195         doexe ld-tigcc
196         doexe ar-tigcc
197
198         # install tigcc
199         cd "${S}"/sources/tigcc/src
200         doexe tigcc
201         dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/tigcc \
202                 /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/ti-linux-gnu-tigcc
203
204         # install tprbuilder
205         cd "${S}"/sources/tprbuilder/src
206         doexe tprbuilder
207
208         # install patcher
209         cd "${S}"/sources/patcher/src
210         doexe patcher
211
212         # install header files
213         dodir /usr/include/tigcc
214         cp -R "${S}"/tigcclib/include/* "${D}"/usr/include/tigcc
215         dosym /usr/include/tigcc/asm/os.h /usr/include/tigcc/asm/OS.h
216
217         insinto /usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER}
218         # install library
219         cd "${S}"/tigcclib
220         doins lib/*
221         cd "${WORKDIR}"
222         doins flashos.a
223         doins fargo.a
224
225         dodir /usr/share/tigcc
226         # copy example programs
227         # cp -r "${S}"/examples ${D}/usr/share/tigcc
228
229         # create TIGCC env variable
230         dodir /etc/env.d/gcc
231         # echo -e "TIGCC=\"/usr/ti-linux-gnu/tigcc-bin/${GCC_VER}\"" >> ${ENV_FILE}
232         # echo -e "CC=\"tigcc\"" >> ${ENV_FILE}
233         echo -e "TIGCC=\"/usr/ti-linux-gnu\"" >> ${ENV_FILE}
234         echo -e "PATH=\"/usr/ti-linux-gnu/tigcc-bin/${GCC_VER}:/usr/ti-linux-gnu/bin\"" >> ${ENV_FILE}
235         echo -e "ROOTPATH=\"/usr/ti-linux-gnu/tigcc-bin/${GCC_VER}:/usr/ti-linux-gnu/bin\"" >> ${ENV_FILE}
236         echo -e "LDPATH=\"/usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER}\"" >> ${ENV_FILE}
237
238         # a cross-compiling gcc with hard-coded names has been built.
239         # therefore, we must place some symlinks.
240         dosym /usr/include/tigcc /usr/ti-linux-gnu/include
241         dosym /usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER} /usr/ti-linux-gnu/lib
242         dosym /usr/share/doc/${PF} /usr/ti-linux-gnu/doc
243         dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER} /usr/ti-linux-gnu/bin
244 }