1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 GCC_SNAPSHOT="20060728"
10 BIN_VER=${BASE_BINUTILS:0:4}
11 ENV_FILE=${D}/etc/env.d/99tigcc
13 DESCRIPTION="Cross compiler for Texas Instruments TI-89, TI-92(+) and V200 calculators"
14 HOMEPAGE="http://tigcc.ticalc.org"
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
20 #when it hits portage of course it should be mirrored on a gentoo mirror:
21 #SRC_URI="mirror://gentoo/${PF}.tar.bz2"
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"
32 KEYWORDS="amd64 ppc ~sparc x86"
35 RDEPEND=">=sys-devel/binutils-2.14.90.0.6-r1"
38 >=sys-devel/bison-1.875"
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
52 rm -f -r maintainer-scripts
64 cd "${WORKDIR}"/gcc-4.1-${GCC_SNAPSHOT}
65 epatch "${S}"/sources/gcc/gcc-4.1-tigcc-patch.diff
76 rm -f -r maintainer-scripts
83 # create build directories for binutils and gcc
84 mkdir -p "${WORKDIR}"/build/binutils
85 mkdir "${WORKDIR}"/build/gcc
87 # Workaround for non-existing directories
88 sed -ie '/SUBDIRS =/d' "${WORKDIR}"/binutils-${BASE_BINUTILS}/gas/Makefile.in
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 \
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 \
109 # GCC compilations _is intended_ to fail on a certain point,
110 # don't worry about that.
113 # Check if gcc has been built, die otherwise
114 ( [ -e "${WORKDIR}"/build/gcc/gcc/xgcc ] && [ -e "${WORKDIR}"/build/gcc/gcc/cc1 ] ) || die "gcc"
116 # build a68k assembler
117 cd "${S}"/sources/a68k
118 emake -e || die "a68k"
120 # build ld-tigcc linker
121 cd "${S}"/sources/ld-tigcc
122 emake -e || die "ld-tigcc"
124 # build tigcc front-end
125 cd "${S}"/sources/tigcc/src
126 emake -e || die "tigcc"
128 # build tprbuilder (TIGCC project builder)
129 cd "${S}"/sources/tprbuilder/src
130 emake -e || die "tprbuilder"
132 # build patcher (object file patcher)
133 cd "${S}"/sources/patcher/src
134 emake -e || die "patcher"
139 # install documentation
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
149 cd "${S}"/tigcclib/doc/converter
150 newbin tigccdoc.new tigccdoc
151 cd "${S}"/tigcclib/doc
153 cp html/qt-assistant.adp "${D}"/usr/share/doc/${PF}/html
155 cd "${S}"/sources/a68k
158 dodir /usr/share/doc/${PF}
160 dodoc AUTHORS BUGS CHANGELOG DIRECTORIES HOWTO \
161 INSTALL README README.linux README.osX
163 cd "${S}"/sources/tigcc
165 dodoc AUTHORS ChangeLog README
167 cd "${S}"/sources/tprbuilder
169 dodoc AUTHORS ChangeLog README
171 cd "${S}"/sources/patcher
173 dodoc AUTHORS ChangeLog README
175 exeinto /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}
177 cd "${WORKDIR}"/build/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
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
190 cd "${S}"/sources/a68k
194 cd "${S}"/sources/ld-tigcc
199 cd "${S}"/sources/tigcc/src
201 dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/tigcc \
202 /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/ti-linux-gnu-tigcc
205 cd "${S}"/sources/tprbuilder/src
209 cd "${S}"/sources/patcher/src
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
217 insinto /usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER}
225 dodir /usr/share/tigcc
226 # copy example programs
227 # cp -r "${S}"/examples ${D}/usr/share/tigcc
229 # create TIGCC env variable
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}
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