summaryrefslogtreecommitdiff
blob: 18bb067dd5d06c8764fb658d48ed2269dcef64bd (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-www/nspluginwrapper/nspluginwrapper-0.9.90.3.ebuild,v 1.3 2006/10/22 17:15:28 chutzpah Exp $

inherit nsplugins flag-o-matic multilib

DESCRIPTION="Netscape Plugin Wrapper - Load 32bit plugins on 64bit browser"
HOMEPAGE="http://www.gibix.net/projects/nspluginwrapper/"
SRC_URI="http://www.gibix.net/projects/nspluginwrapper/files/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

RDEPEND=">=x11-libs/gtk+-2
	app-emulation/emul-linux-x86-xlibs
	app-emulation/emul-linux-x86-gtklibs
	sys-apps/setarch"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	!app-admin/eselect-compiler"

TARGET_CPU="i386"
TARGET_ABI="x86"

# I don't know how to get rid of these textrels
QA_TEXTRELS_amd64="usr/$(get_libdir)/nspluginwrapper/i386/npviewer.bin"

src_unpack() {
	unpack ${A}
	cd "${S}"

	epatch "${FILESDIR}"/${P}-gentoo.patch
}

src_compile() {
	append-flags "-std=c99"

	./configure \
		--prefix=/usr \
		--with-lib=$(get_libdir) \
		--with-cc=$(tc-getCC) \
		--target-cpu=${TARGET_CPU} || die
	emake || die

	mkdir build-${TARGET_CPU}-linux
	cd build-${TARGET_CPU}-linux
	ABI="${TARGET_ABI}" linux32 ../configure \
		--prefix=/usr \
		--with-lib=$(get_libdir) \
		--with-cc=$(tc-getCC) \
		--target-cpu=${TARGET_CPU} || die
	ABI="${TARGET_ABI}" linux32 emake npviewer.bin || die
}

src_install() {
	emake DESTDIR="${D}" DONT_STRIP=yes install || die

	cd build-${TARGET_CPU}-linux
	ABI="${TARGET_ABI}" emake DESTDIR="${D}" DONT_STRIP=yes install.viewer || die
	cd "${S}"

	inst_plugin /usr/lib/nspluginwrapper/x86_64/npwrapper.so
	dosym /usr/lib/nspluginwrapper/x86_64/npconfig /usr/bin/nspluginwrapper

	dodoc NEWS README TODO
}

pkg_postinst() {
	einfo "Auto installing 32bit plugins"
	nspluginwrapper -v -a -i
	einfo "Any 32bit plugins you currently have installed have now been"
	einfo "configured to work in a 64bit browser. Any plugins you install in"
	einfo "the future will first need to be setup with:"
	einfo "  \"nspluginwrapper -i <path-to-32bit-plugin>\""
	einfo "before they will function in a 64bit browser"
	einfo
	einfo "If you are using this with >=net-www/netscape-flash-9, sound won't"
	einfo "work until you install app-emulation/emul-linux-x86-soundlibs."
	einfo "   \"emerge app-emulation/emul-linux-x86-soundlibs\""
	einfo
}

# this is terribly ugly, but without a way to query portage as to whether
# we are upgrading/reinstalling a package versus unmerging, I can't think of
# a better way

pkg_prerm() {
	einfo "Removing wrapper plugins"
	nspluginwrapper -v -a -r
}

pkg_postrm() {
	if has_version "${CATEGORY}/${PN}"; then
		einfo "Auto installing 32bit plugins"
		nspluginwrapper -v -a -i
	fi
}