| 1 |
# Copyright 1999-2005 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-embedded/tigcc/tigcc-0.95_p3.ebuild,v 1.2 2005/01/01 17:56:52 eradicator Exp $
|
| 4 |
|
| 5 |
inherit eutils
|
| 6 |
|
| 7 |
BASE_GCC="3.3.3"
|
| 8 |
BASE_BINUTILS="2.14"
|
| 9 |
GCC_VER=${BASE_GCC:0:3}
|
| 10 |
BIN_VER=${BASE_BINUTILS:0:4}
|
| 11 |
S=${WORKDIR}
|
| 12 |
DESCRIPTION="Cross compiler for Texas Instruments TI-89, TI-92(+) and V200 calculators"
|
| 13 |
HOMEPAGE="http://tigcc.ticalc.org"
|
| 14 |
|
| 15 |
|
| 16 |
# mirror://gentoo/${P}.tar.bz2 comes from http://tigcc.ticalc.org/linux/tigcc_src.tar.bz2
|
| 17 |
# which isn't that reliable
|
| 18 |
|
| 19 |
#All kernel mirrors in gentoo didn't have 2.14
|
| 20 |
# mirror://kernel/linux/devel/binutils/binutils-${BASE_BINUTILS}.tar.bz2
|
| 21 |
|
| 22 |
SRC_URI="mirror://gentoo/${P}.tar.bz2
|
| 23 |
mirror://gnu/gcc/releases/gcc-${BASE_GCC}/gcc-core-${BASE_GCC}.tar.bz2
|
| 24 |
http://cdn.mirror.garr.it/mirrors/gnuftp/binutils/binutils-${BASE_BINUTILS}.tar.bz2
|
| 25 |
http://members.chello.at/gerhard.kofler/kevin/ti89prog/libfargo.zip
|
| 26 |
http://members.chello.at/gerhard.kofler/kevin/ti89prog/flashosa.zip"
|
| 27 |
|
| 28 |
LICENSE="GPL-2"
|
| 29 |
|
| 30 |
SLOT="0"
|
| 31 |
KEYWORDS="~x86 ~amd64 ~ppc"
|
| 32 |
#KEYWORDS="~x86 ~ppc ~sparc ~amd64"
|
| 33 |
IUSE=""
|
| 34 |
|
| 35 |
RDEPEND="virtual/libc
|
| 36 |
>=sys-devel/binutils-2.14.90.0.6-r1
|
| 37 |
>=sys-devel/bison-1.875"
|
| 38 |
DEPEND="${RDEPEND}
|
| 39 |
app-arch/unzip"
|
| 40 |
|
| 41 |
src_unpack() {
|
| 42 |
unpack ${A}
|
| 43 |
# start by patching binutils and gcc
|
| 44 |
cd ${WORKDIR}/binutils-${BASE_BINUTILS}
|
| 45 |
epatch ${S}/sources/gcc/gas-${BIN_VER}-tigcc-*.diff
|
| 46 |
|
| 47 |
cd ${WORKDIR}/gcc-${BASE_GCC}
|
| 48 |
epatch ${S}/sources/gcc/gcc-${BASE_GCC}-tigcc-*.diff
|
| 49 |
|
| 50 |
# a68k didn't compile, this should fix it.
|
| 51 |
cd ${S}
|
| 52 |
epatch ${FILESDIR}/a68k-fix.patch
|
| 53 |
|
| 54 |
# fixes a bug in tprbuilder, needed for 0.95_beta8-r1
|
| 55 |
# epatch ${FILESDIR}/tprbuilder-fix.patch
|
| 56 |
|
| 57 |
# make build directories for binutils and gcc
|
| 58 |
mkdir -p ${WORKDIR}/build/binutils
|
| 59 |
mkdir ${WORKDIR}/build/gcc
|
| 60 |
}
|
| 61 |
|
| 62 |
src_compile() {
|
| 63 |
# build binutils
|
| 64 |
cd ${WORKDIR}/build/binutils
|
| 65 |
CFLAGS="$CFLAGS" ${WORKDIR}/binutils-${BASE_BINUTILS}/configure \
|
| 66 |
--disable-serial-configure --target=m68k-coff --disable-shared \
|
| 67 |
--enable-static --disable-multilib --disable-nls \
|
| 68 |
|| die
|
| 69 |
emake || die
|
| 70 |
|
| 71 |
# build gcc
|
| 72 |
cd ${WORKDIR}/build/gcc
|
| 73 |
|
| 74 |
# --with-headers=${S}/tigcclib/include/c \
|
| 75 |
CFLAGS="$CFLAGS" ${WORKDIR}/gcc-${BASE_GCC}/configure --target=m68k-coff \
|
| 76 |
--with-gnu-as --with-as=${WORKDIR}/build/binutils/gas/as-new --with-gnu-ld \
|
| 77 |
--disable-nls --disable-multilib --disable-shared --enable-static \
|
| 78 |
--disable-threads \
|
| 79 |
|| die
|
| 80 |
# GCC compilations _is intended_ to fail on a certain point, don't worry about that.
|
| 81 |
emake
|
| 82 |
|
| 83 |
# build a68k assembler
|
| 84 |
cd ${S}/sources/a68k/src
|
| 85 |
emake -e || die
|
| 86 |
|
| 87 |
# build ld-tigcc linker
|
| 88 |
cd ${S}/sources/ld-tigcc
|
| 89 |
emake -e || die
|
| 90 |
|
| 91 |
# build tigcc front-end
|
| 92 |
cd ${S}/sources/tigcc/src
|
| 93 |
emake -e || die
|
| 94 |
|
| 95 |
# build tprbuilder (TIGCC project builder)
|
| 96 |
cd ${S}/sources/tprbuilder/src
|
| 97 |
emake -e || die
|
| 98 |
|
| 99 |
# build patcher (object file patcher)
|
| 100 |
cd ${S}/sources/patcher/src
|
| 101 |
emake -e || die
|
| 102 |
|
| 103 |
# build parser
|
| 104 |
cd ${S}/sources/parser/src
|
| 105 |
emake -e || die
|
| 106 |
|
| 107 |
# build tict tool suite
|
| 108 |
cd ${S}/tt
|
| 109 |
CFLAGS="$CFLAGS" ./makelinux.sh || die
|
| 110 |
|
| 111 |
# patch the script that launches the documentation browser to point to the correct location
|
| 112 |
sed "s:\$TIGCC/doc:/usr/share/doc/${P}:g" ${S}/tigcclib/doc/converter/tigccdoc > ${S}/tigcclib/doc/converter/tigccdoc.new
|
| 113 |
}
|
| 114 |
|
| 115 |
src_install() {
|
| 116 |
#ENV_FILE=${D}/etc/env.d/gcc/ti-linux-gnu-${GCC_VER}
|
| 117 |
ENV_FILE=${D}/etc/env.d/99tigcc
|
| 118 |
|
| 119 |
# install documentation
|
| 120 |
|
| 121 |
cd ${S}/tigcclib/doc/converter
|
| 122 |
into /usr
|
| 123 |
dodir /usr/bin
|
| 124 |
newbin tigccdoc.new tigccdoc
|
| 125 |
|
| 126 |
dodir /usr/share/doc/${PF}
|
| 127 |
cd ${S}
|
| 128 |
dodoc AUTHORS BUGS CHANGELOG COPYING DIRECTORIES HOWTO INSTALL README README.linux README.osX
|
| 129 |
|
| 130 |
cd ${S}/tigcclib/doc
|
| 131 |
dohtml -r html/*.html
|
| 132 |
cp html/qt-assistant.adp ${D}/usr/share/doc/${PF}/html
|
| 133 |
|
| 134 |
cd ${S}/sources/a68k
|
| 135 |
docinto a68k
|
| 136 |
dodoc docs/*.txt
|
| 137 |
|
| 138 |
cd ${S}/sources/tigcc
|
| 139 |
docinto tigcc
|
| 140 |
dodoc AUTHORS COPYING ChangeLog README
|
| 141 |
|
| 142 |
cd ${S}/sources/tprbuilder
|
| 143 |
docinto tprbuilder
|
| 144 |
dodoc AUTHORS COPYING ChangeLog README
|
| 145 |
|
| 146 |
cd ${S}/sources/patcher
|
| 147 |
docinto patcher
|
| 148 |
dodoc AUTHORS COPYING ChangeLog README
|
| 149 |
|
| 150 |
cd ${S}/sources/parser
|
| 151 |
docinto parser
|
| 152 |
dodoc AUTHORS COPYING ChangeLog README
|
| 153 |
|
| 154 |
cd ${S}/tt
|
| 155 |
docinto tools
|
| 156 |
dodoc history.txt linux_readme.txt readme.txt tooldocs.txt
|
| 157 |
|
| 158 |
exeinto /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}
|
| 159 |
# install gcc
|
| 160 |
cd ${WORKDIR}/build/gcc
|
| 161 |
doexe gcc/cc1
|
| 162 |
newexe gcc/xgcc gcc
|
| 163 |
dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/gcc /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/ti-linux-gnu-gcc
|
| 164 |
|
| 165 |
# install gas
|
| 166 |
# exeinto /usr/ti-linux-gnu/bin <-- a symlink will be created so that gas resides in /usr/ti-linux-gnu/bin too
|
| 167 |
cd ${WORKDIR}/build/binutils
|
| 168 |
newexe gas/as-new as
|
| 169 |
|
| 170 |
# install a68k
|
| 171 |
cd ${S}/sources/a68k/src
|
| 172 |
newexe A68k a68k
|
| 173 |
|
| 174 |
# install ld-tigcc
|
| 175 |
cd ${S}/sources/ld-tigcc
|
| 176 |
doexe ld-tigcc
|
| 177 |
doexe ar-tigcc
|
| 178 |
|
| 179 |
# install tigcc
|
| 180 |
cd ${S}/sources/tigcc/src
|
| 181 |
doexe tigcc
|
| 182 |
dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/tigcc /usr/ti-linux-gnu/tigcc-bin/${GCC_VER}/ti-linux-gnu-tigcc
|
| 183 |
|
| 184 |
# install tprbuilder
|
| 185 |
cd ${S}/sources/tprbuilder/src
|
| 186 |
doexe tprbuilder
|
| 187 |
|
| 188 |
# install patcher
|
| 189 |
cd ${S}/sources/patcher/src
|
| 190 |
doexe patcher
|
| 191 |
|
| 192 |
# install parser
|
| 193 |
cd ${S}/sources/parser/src
|
| 194 |
doexe parser
|
| 195 |
|
| 196 |
# install tict tool suite
|
| 197 |
cd ${S}/tt
|
| 198 |
doexe linuxbin/*
|
| 199 |
|
| 200 |
# install header files
|
| 201 |
dodir /usr/include/tigcc
|
| 202 |
cp -R ${S}/tigcclib/include/* ${D}/usr/include/tigcc
|
| 203 |
dosym /usr/include/tigcc/asm/os.h /usr/include/tigcc/asm/OS.h
|
| 204 |
|
| 205 |
insinto /usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER}
|
| 206 |
# install library
|
| 207 |
cd ${S}/tigcclib
|
| 208 |
doins lib/*
|
| 209 |
cd ${WORKDIR}
|
| 210 |
doins flashosa/flashos.a
|
| 211 |
doins fargo.a
|
| 212 |
|
| 213 |
dodir /usr/share/tigcc
|
| 214 |
# copy example programs
|
| 215 |
cp -r ${S}/examples ${D}/usr/share/tigcc
|
| 216 |
|
| 217 |
# create TIGCC env variable
|
| 218 |
dodir /etc/env.d/gcc
|
| 219 |
# echo -e "TIGCC=\"/usr/ti-linux-gnu/tigcc-bin/${GCC_VER}\"" >> ${ENV_FILE}
|
| 220 |
# echo -e "CC=\"tigcc\"" >> ${ENV_FILE}
|
| 221 |
echo -e "TIGCC=\"/usr/ti-linux-gnu\"" >> ${ENV_FILE}
|
| 222 |
echo -e "PATH=\"/usr/ti-linux-gnu/tigcc-bin/${GCC_VER}:/usr/ti-linux-gnu/bin\"" >> ${ENV_FILE}
|
| 223 |
echo -e "ROOTPATH=\"/usr/ti-linux-gnu/tigcc-bin/${GCC_VER}:/usr/ti-linux-gnu/bin\"" >> ${ENV_FILE}
|
| 224 |
echo -e "LDPATH=\"/usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER}\"" >> ${ENV_FILE}
|
| 225 |
|
| 226 |
# a cross-compiling gcc with hard-coded names has been built.
|
| 227 |
# therefore, we must place some symlinks.
|
| 228 |
dosym /usr/include/tigcc /usr/ti-linux-gnu/include
|
| 229 |
dosym /usr/lib/gcc-lib/ti-linux-gnu/${GCC_VER} /usr/ti-linux-gnu/lib
|
| 230 |
dosym /usr/share/doc/${PF} /usr/ti-linux-gnu/doc
|
| 231 |
dosym /usr/ti-linux-gnu/tigcc-bin/${GCC_VER} /usr/ti-linux-gnu/bin
|
| 232 |
}
|
| 233 |
|
| 234 |
pkg-postinst() {
|
| 235 |
env-update && source /etc/profile
|
| 236 |
}
|