1SUMMARY="Fork of Mozilla Firefox for Haiku"
2DESCRIPTION="BeZilla is an open source web browser. \
3It achieves balance between ease of use and customization, catering to the \
4needs of both casual and power users."
5HOMEPAGE="https://github.com/mmadia/bezilla/"
6COPYRIGHT="1995-2009 Mozilla Developers and Contributors"
7LICENSE="MPL v1.1"
8REVISION="8"
9srcGitRev="6862542e81d0407f8fbdb8cf96a48fdc3156e902"
10SOURCE_URI="https://github.com/mmadia/bezilla/archive/$srcGitRev.zip"
11CHECKSUM_SHA256="61dd1e12fc0a183d2ded7cbc16adbe1fb7bee565ce7d12acc48bfbe5954f80ce"
12SOURCE_DIR="bezilla-$srcGitRev"
13PATCHES="bezilla-$portVersion.patchset"
14
15ARCHITECTURES="?all x86_gcc2"
16
17PROVIDES="
18	bezilla= $portVersion
19	app:BeZilla= $portVersion
20	cmd:firefox= $portVersion
21	"
22REQUIRES="
23	haiku
24	lib:libglib_2.0
25	lib:libIDL_2
26	lib:libintl
27	lib:libpng16
28	lib:libz
29	"
30if [ $effectiveTargetArchitecture == x86_64 ]; then
31	REQUIRES+="
32	lib:libnspr4
33	"
34fi
35
36PROVIDES_devel="
37	bezilla_devel = $portVersion
38	cmd:firefox_config= $portVersion
39	"
40REQUIRES_devel="
41	bezilla== $portVersion base
42	"
43
44BUILD_REQUIRES="
45	haiku_devel
46	devel:libglib_2.0
47	devel:libIDL_2
48	devel:libpng16
49	"
50if [ $effectiveTargetArchitecture == x86_64 ]; then
51	BUILD_REQUIRES+="
52	devel:libnspr4
53	"
54fi
55BUILD_PREREQUIRES="
56	cmd:autoconf_2.13
57	cmd:gawk
58	cmd:gcc
59	cmd:libtoolize
60	cmd:m4
61	cmd:make
62	cmd:perl
63	cmd:pkg_config
64	cmd:tar
65	cmd:xargs
66	cmd:zip
67	"
68
69BUILD()
70{
71	cd mozilla
72	pushd build/autoconf
73	chmod +x mozconfig-find
74	libtoolize -fci
75	popd
76	autoconf-2.13
77
78	# builtin version of libnspr4 doesn't built on x86_64
79	if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
80		pushd nsprpub
81		autoconf-2.13
82		popd
83	fi
84
85	pushd directory/c-sdk
86	autoconf-2.13
87	popd
88
89	export MOZ_CO_PROJECT=browser
90	export MOZ_APP_NAME=BeZilla
91	export MOZ_APP_DISPLAYNAME=BeZilla
92	export AUTOCONF='autoconf-2.13'
93	export BUILD_OPT=1
94
95	if [ $effectiveTargetArchitecture == x86_64 ]; then
96		opt_flags='--enable-optimize=-O3 -fno-strict-aliasing -fpermissive'
97	fi
98
99	if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
100		opt_flags='--enable-optimize=-O3 -fthread-jumps -fforce-addr -frerun-cse-after-loop -frerun-loop-opt -fexpensive-optimizations -malign-functions=4 -malign-jumps=4'
101	fi
102
103	# export MOZCONFIG=../supporting-files/mozilla-configs/browser.mozconfig
104	# runConfigure breaks configure with opt_flags
105	# runConfigure --omit-dirs 'docDir dataRootDir' configure
106
107	./configure \
108		--prefix=$prefix \
109		--bindir=$binDir \
110		--libdir=$libDir \
111		--datadir=$prefix/data \
112		--includedir=$includeDir \
113		--mandir=$manDir \
114		--enable-application=browser \
115		--disable-updater \
116		--disable-oji \
117		--disable-svg \
118		--disable-canvas \
119		--with-system-png \
120		--with-system-zlib \
121		--with-system-nspr \
122		--enable-nspr-threads \
123		--disable-tests \
124		--disable-ipv6 \
125		--enable-cpp-rtti \
126		--disable-cpp-exceptions \
127		--disable-pedantic \
128		--enable-static --disable-shared \
129		--enable-strip \
130		--enable-reorder \
131		--disable-debug \
132		"$opt_flags"
133
134	make $jobArgs
135}
136
137INSTALL()
138{
139	cd mozilla
140	make install
141
142	mkdir -p $appsDir
143	# TODO: fix mozappdir in config/autoconf.mk.in to avoid manual renaming
144	# -mozappdir	= $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
145	# +mozappdir	= $(prefix)/apps/BeZilla
146
147	mv $libDir/firefox-2.0.0.22pre $appsDir/BeZilla
148
149	mkdir -p $appsDir/BeZilla/{add-ons,lib}
150
151	# arranging the files in lib and add-ons directories
152	cd $appsDir/BeZilla
153	mv libnspr4.so libnss3.so libnssutil3.so libplc4.so libplds4.so \
154	libsmime3.so libsoftokn3.so libsqlite3.so libssl3.so libxpcom.so \
155	libxpcom_compat.so libxpcom_core.so libmozjs.so lib
156
157	mv libfreebl3.so libnssckbi.so libnssdbm3.so libxpistub.so add-ons
158
159	mv firefox-bin BeZilla
160
161	cp $sourceDir/supporting-files/persdict.dat $appsDir/BeZilla/defaults/profile
162	cp $sourceDir/supporting-files/haiku-widget-theme/browser/classic.jar $appsDir/BeZilla/chrome
163
164	ln -sf ../lib/libsoftokn3.so add-ons
165
166	fixPkgconfig
167
168	packageEntries devel \
169		$developDir \
170		$dataDir/idl \
171		$dataDir/aclocal \
172		$binDir/firefox-config
173
174	addAppDeskbarSymlink $appsDir/BeZilla/BeZilla
175}
176