summaryrefslogtreecommitdiff
blob: 98b4276d9ff8ab8bde8e5d5418b38620014c5d02 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/elfsh/elfsh-0.65_rc1.ebuild,v 1.4 2009/05/02 20:29:16 halcy0n Exp $

inherit eutils toolchain-funcs

DESCRIPTION="scripting language to modify ELF binaries"
HOMEPAGE="http://www.eresi-project.org/"
SRC_URI="mirror://gentoo/${P}.zip"
#http://www.eresi-project.org/browser/tags/elfsh_0_65rc1

LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE="readline"

DEPEND=">=dev-libs/expat-1.95
	readline? ( sys-libs/readline )
	app-arch/unzip
	dev-libs/libhash"
RDEPEND=""

S="${WORKDIR}/tags/elfsh_0_65rc1"

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -i \
		-e 's: -O2 : :g' \
		-e "s: -g3 : ${CFLAGS} :" \
		-e "/^LDFLAGS/s:=:=${LDFLAGS} :" \
		$(find -name Makefile) \
		|| die
	chmod +x configure
}

src_compile() {
	local bits
	touch foo.c && $(tc-getCC) -c foo.c -o foo.o || die
	case $(file foo.o) in
		*64-bit*)  bits=64;;
		*32-bit*)  bits=32;;
		*)         die "unknown bits: $(file foo.o)";;
	esac
	# not an autoconf script
	./configure \
		$([[ ${bits} == "64" ]] && echo "--enable-m64") \
		--enable-${bits} \
		$(use_enable readline) \
		|| die
	# emacs does not have to be a requirement.
	emake ETAGS=echo || die "emake failed"
}

src_install() {
	make install DESTDIR="${D}" || die "install failed"
	dodoc README.FIRST doc/AUTHOR doc/CREDITS doc/Changelog doc/*.txt
	doman doc/*.1
}