summaryrefslogtreecommitdiff
blob: 97dd981a00587a17d697da25179a684f06205a02 (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
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/xtrs/xtrs-4.9d-r1.ebuild,v 1.5 2014/04/12 12:51:59 ulm Exp $

EAPI=4

inherit flag-o-matic toolchain-funcs

DESCRIPTION="Radio Shack TRS-80 emulator"
HOMEPAGE="http://www.tim-mann.org/xtrs.html"
SRC_URI="http://www.tim-mann.org/trs80/${P}.tar.gz
	ls-dos? ( http://www.tim-mann.org/trs80/ld4-631.zip )"

LICENSE="xtrs ls-dos? ( freedist )"
SLOT="0"
KEYWORDS="amd64 ppc x86 ~x86-fbsd"
IUSE="ls-dos"

DEPEND="sys-libs/ncurses
	sys-libs/readline
	>=x11-libs/libX11-1.0.0"
RDEPEND="${DEPEND}"

src_prepare() {
	sed -i -e 's/$(CC) -o/$(CC) $(LDFLAGS) -o/' Makefile || die
}

src_compile() {
	use ppc && append-flags -Dbig_endian
	emake CC="$(tc-getCC)" DEBUG="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
		DISKDIR="-DDISKDIR='\"/usr/share/xtrs\"'" \
		DEFAULT_ROM="-DDEFAULT_ROM='\"/usr/share/xtrs/romimage\"' \
			-DDEFAULT_ROM3='\"/usr/share/xtrs/romimage.m3\"' \
			-DDEFAULT_ROM4P='\"/usr/share/xtrs/romimage.m4p\"'"
}

src_install() {
	dodir /usr/bin /usr/share/xtrs/disks /usr/share/man/man1
	emake PREFIX="${D}"/usr install

	insopts -m0444
	insinto /usr/share/xtrs/disks
	doins cpmutil.dsk utility.dsk

	if use ls-dos; then
		doins "${WORKDIR}"/ld4-631.dsk
		dosym disks/ld4-631.dsk /usr/share/xtrs/disk4p-0
		dosym disks/utility.dsk /usr/share/xtrs/disk4p-1
	fi

	dodoc ChangeLog README xtrsrom4p.README cpmutil.html dskspec.html
}

pkg_postinst() {
	ewarn "For copyright reasons, xtrs does not include actual ROM images."
	ewarn "Because of this, unless you supply your own ROM, xtrs will"
	ewarn "not function in any mode except 'Model 4p' mode (a minimal"
	ewarn "free ROM is included for this), which can be run like this:"
	ewarn "    xtrs -model 4p"
	elog ""
	elog "If you already own a copy of the ROM software (e.g., if you have"
	elog "a TRS-80 with this ROM), then you can make yourself a copy of this"
	elog "for use with xtrs using utilities available on the web.  You can"
	elog "also often find various ROMs elsewhere.  To load your own ROM,"
	elog "specify the '-romfile' option."
}