summaryrefslogtreecommitdiff
blob: 03ffb5d33a0971bbc0f2398f4ad93fc3161c6a5e (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-client/netsurf/netsurf-2.9.ebuild,v 1.4 2012/08/20 10:52:31 xmw Exp $

EAPI=4

inherit eutils multilib toolchain-funcs

DESCRIPTION="a free, open source web browser"
HOMEPAGE="http://www.netsurf-browser.org/"
SRC_URI="http://download.netsurf-browser.org/${PN}/releases/source-full/${P}-full-src.tar.gz
	http://xmw.de/mirror/netsurf-fb.modes-example.gz"

LICENSE="GPL-2 MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm"
IUSE="bmp fbcon freetype gif gstreamer gtk javascript jpeg mng pdf-writer png rosprite svg svgtiny webp"

RDEPEND="dev-libs/libcss
	net-libs/hubbub
	net-misc/curl
	bmp? ( media-libs/libnsbmp )
	fbcon? ( dev-libs/libnsfb )
	freetype? ( media-fonts/dejavu
		media-libs/freetype )
	gif? ( media-libs/libnsgif )
	gtk? ( dev-libs/glib:2
		gnome-base/libglade:2.0
		media-libs/lcms:0
		x11-libs/gtk+:2 )
	jpeg? ( virtual/jpeg )
	mng? ( media-libs/libmng )
	pdf-writer? ( media-libs/libharu )
	png? ( media-libs/libpng )
	svg? ( svgtiny? ( media-libs/libsvgtiny )
		!svgtiny? ( gnome-base/librsvg:2 ) )
	webp? ( media-libs/libwebp )"
DEPEND="${RDEPEND}
	virtual/pkgconfig
	rosprite? ( media-libs/librosprite )"

REQUIRED_USE="|| ( fbcon gtk )"

src_unpack() {
	default
	einfo "remove bundled libs"
	cd "${WORKDIR}" || die
	mv ${P} ${P}_complete || die
	mv ${P}_complete/${P} . || die
	rm -r ${P}_complete || die
}

src_prepare() {
	sed -e '/CFLAGS \(:\|+\)=/d' \
		-i Makefile.defaults || die
	sed -e '/^#define NSFB_TOOLBAR_DEFAULT_LAYOUT/s:blfsrut:blfsrutc:' \
		-i framebuffer/gui.c || die

	epatch "${FILESDIR}"/${P}-buildsystem.patch
	epatch "${FILESDIR}"/${P}-includes.patch
	epatch "${FILESDIR}"/${P}-conditionally-include-image-headers.patch
}

src_configure() {
	netsurf_set() {
		echo "override $1 := $2" >> Makefile.config || die
	}
	netsurf_use() {
		local val=${4:-NO}
		use $2 && val=${3:-YES}
		echo "override $1 := $val" >> Makefile.config || die
	}
	#see Makefile.defaults
	netsurf_use NETSURF_USE_BMP bmp
	netsurf_use NETSURF_USE_GIF gif
	netsurf_use NETSURF_USE_JPEG jpeg
	netsurf_use NETSURF_USE_PNG png
	netsurf_use NETSURF_USE_MNG mng
	netsurf_use NETSURF_USE_WEBP webp
	netsurf_use NETSURF_USE_VIDEO gstreamer
	netsurf_use NETSURF_USE_JS javascript
	netsurf_use NETSURF_USE_HARU_PDF pdf-writer
	netsurf_set PREFIX /usr
	netsurf_set Q
	netsurf_set CC $(tc-getCC)
	netsurf_set LD $(tc-getCC)

	if use svg ; then
		if use svgtiny ; then
			netsurf_set NETSURF_USE_NSSVG YES
			netsurf_set NETSURF_USE_RSVG NO
		else
			netsurf_set NETSURF_USE_NSSVG NO
			netsurf_set NETSURF_USE_RSVG YES
		fi
	else
		netsurf_set NETSURF_USE_NSSVG NO
		netsurf_set NETSURF_USE_RSVG NO
	fi
	if use fbcon ; then
		netsurf_set NETSURF_FB_FRONTEND linux
		netsurf_use NETSURF_FB_FONTLIB freetype freetype internal
		netsurf_set NETSURF_FB_FONTPATH /usr/share/fonts/dejavu
	fi
	netsurf_use NETSURF_USE_ROSPRITE rosprite
}

src_compile() {
	use gtk && emake PREFIX="/usr" TARGET=gtk
	use fbcon && emake PREFIX="/usr" TARGET=framebuffer
}

src_install() {
	if use gtk ; then
		emake DESTDIR="${D}" PREFIX="/usr" TARGET=gtk install
		mv "${D}"/usr/bin/netsurf{,-gtk} || die
		make_desktop_entry /usr/bin/netsurf-gtk NetSurf-gtk netsurf "Network;WebBrowser"
	fi
	if use fbcon ; then
		emake DESTDIR="${D}" PREFIX="/usr" TARGET=framebuffer install
		mv "${D}"/usr/bin/netsurf{,-fb} || die
		make_desktop_entry /usr/bin/netsurf-fb NetSurf-framebuffer netsurf "Network;WebBrowser"

		einfo
		elog "In order to setup the framebuffer console, netsurf needs an /etc/fb.modes"
		elog "You can use an example from /usr/share/doc/${PF}/fb.modes.* (bug 427092)."
		einfo
		elog "Please make /etc/input/mice readable to the account using netsurf-fb."
		elog "Either use chmod a+r /etc/input/mice (security!!!) or use an group."
		einfo
	fi
	insinto /usr/share/pixmaps
	doins gtk/res/netsurf.xpm

	dodoc -r Docs/{USING-*,ideas}
	newdoc "${WORKDIR}"/netsurf-fb.modes-example fb.modes
}