1SUMMARY="The GNOME Web browser (formerly named Epiphany)"
2DESCRIPTION="'Web' is the web browser for the GNOME desktop and for elementary OS, \
3based on the popular WebKit engine. It offers a simple and clean view of the web, featuring \
4a built-in adblocker (enabled by default), and 'Intelligent Tracking Prevention' to protect \
5your privacy.
6With no useless widgets or wasted space, Web fits GNOME's and Haiku's design philosophy.
7Its code name is Epiphany."
8HOMEPAGE="https://wiki.gnome.org/Apps/Web"
9COPYRIGHT="2005-2023 The GNOME Project"
10LICENSE="GNU GPL v3"
11REVISION="1"
12SOURCE_URI="https://gitlab.gnome.org/GNOME/epiphany/-/archive/$portVersion/epiphany-$portVersion.tar.bz2"
13CHECKSUM_SHA256="d617a16f305d38925033bcacfab971aaea5ad27323f24c1a3643815c922fb688"
14PATCHES="epiphany-$portVersion.patchset"
15ADDITIONAL_FILES="
16	epiphany.rdef.in
17	compile-schemas.sh
18	icons.zip
19	"
20
21ARCHITECTURES="all !x86_gcc2"
22SECONDARY_ARCHITECTURES="x86"
23
24POST_INSTALL_SCRIPTS="
25	$relativePostInstallDir/compile-schemas.sh
26	"
27
28PROVIDES="
29	epiphany$secondaryArchSuffix = $portVersion
30	cmd:epiphany = $portVersion
31	app:Epiphany = $portVersion
32	app:Web = $portVersion
33	"
34REQUIRES="
35	haiku$secondaryArchSuffix
36	shared_mime_info$secondaryArchSuffix
37	lib:libappstream_glib$secondaryArchSuffix
38	lib:libarchive$secondaryArchSuffix
39	lib:libbrotlidec$secondaryArchSuffix
40	lib:libdazzle_1.0$secondaryArchSuffix
41	lib:libgcr_3$secondaryArchSuffix
42	lib:libgdk_3$secondaryArchSuffix
43	lib:libgdk_pixbuf_2.0$secondaryArchSuffix
44	lib:libgmp$secondaryArchSuffix
45	lib:libgtk_3$secondaryArchSuffix
46	lib:libglib_2.0$secondaryArchSuffix
47	lib:libhandy_1$secondaryArchSuffix
48	lib:libhogweed$secondaryArchSuffix
49	lib:libintl$secondaryArchSuffix
50	lib:libjson_glib_1.0$secondaryArchSuffix
51	lib:libnettle$secondaryArchSuffix
52	lib:libnghttp2$secondaryArchSuffix
53	lib:libpng16$secondaryArchSuffix
54	lib:libportal$secondaryArchSuffix
55	lib:libportal_gtk3$secondaryArchSuffix
56	lib:libpsl$secondaryArchSuffix
57	lib:libsecret_1$secondaryArchSuffix
58	lib:libsoup_3.0$secondaryArchSuffix
59	lib:libsqlite3$secondaryArchSuffix
60	lib:libwebkit2gtk_4.1$secondaryArchSuffix
61	lib:libxml2$secondaryArchSuffix
62	lib:libz$secondaryArchSuffix
63	"
64
65BUILD_REQUIRES="
66	haiku${secondaryArchSuffix}_devel
67	iso_codes
68	gsettings_desktop_schemas$secondaryArchSuffix
69	devel:libappstream_glib$secondaryArchSuffix
70	devel:libarchive$secondaryArchSuffix
71	devel:libbrotlidec$secondaryArchSuffix
72	devel:libdazzle_1.0$secondaryArchSuffix
73	devel:libgcr_3$secondaryArchSuffix
74	devel:libgdk_3$secondaryArchSuffix
75	devel:libgdk_pixbuf_2.0$secondaryArchSuffix
76	devel:libgmp$secondaryArchSuffix
77	devel:libgtk_3$secondaryArchSuffix
78	devel:libglib_2.0$secondaryArchSuffix
79	devel:libhandy_1$secondaryArchSuffix
80	devel:libhogweed$secondaryArchSuffix
81	devel:libjson_glib_1.0$secondaryArchSuffix
82	devel:libnettle$secondaryArchSuffix
83	devel:libnghttp2$secondaryArchSuffix
84	devel:libpng16$secondaryArchSuffix
85	devel:libportal$secondaryArchSuffix
86	devel:libpsl$secondaryArchSuffix
87	devel:libsecret_1$secondaryArchSuffix
88	devel:libsoup_3.0$secondaryArchSuffix
89	devel:libsqlite3$secondaryArchSuffix
90	devel:libwebkit2gtk_4.1$secondaryArchSuffix
91	devel:libxml2$secondaryArchSuffix
92	devel:libz$secondaryArchSuffix
93	"
94BUILD_PREREQUIRES="
95	cmd:find
96	cmd:gcc$secondaryArchSuffix
97	cmd:itstool
98	cmd:meson
99	cmd:ninja
100	cmd:pkg_config$secondaryArchSuffix
101	cmd:xargs
102	cmd:unzip
103	"
104
105PATCH()
106{
107	cd $sourceDir
108	find src lib embed -type f -regex '.*\(c\|ui\|css\)' -print0 | xargs -0 sed -i 's/-symbolic//g'
109	unzip -o $sourceDir/../../additional-files/icons.zip -d $sourceDir
110}
111
112BUILD()
113{
114	LDFLAGS="-lnetwork"  \
115	meson Build \
116		--buildtype=release \
117		--prefix="$prefix" \
118		--bindir="$appsDir/GNOME Web" \
119		--libdir="$appsDir/GNOME Web/libexec" \
120		--libexecdir="$appsDir/GNOME Web/libexec" \
121		--datadir="$dataDir" \
122		--localedir="$dataDir/locale" \
123		--sysconfdir="$settingsDir" \
124		--mandir="$manDir" \
125		-Dunit_tests=disabled
126
127	ninja -C Build
128}
129
130INSTALL()
131{
132	ninja  install -C Build
133
134	mv "$appsDir/GNOME Web/epiphany" "$appsDir/GNOME Web/Web"
135	rm -rf $dataDir/{help,gnome-shell,dbus-1,applications}
136	rm -rf $dataDir/icons/hicolor/symbolic
137
138	mkdir $prefix/bin
139	ln -s "$appsDir/GNOME Web/Web" $prefix/bin/epiphany
140
141	mkdir -p $postInstallDir
142	cp -f $portDir/additional-files/compile-schemas.sh $postInstallDir
143	chmod -v a+rx $postInstallDir/compile-schemas.sh
144
145	local APP_SIGNATURE="application/x-vnd.gnome-web"
146	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
147	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
148	local MINOR="0"
149	local LONG_INFO="$SUMMARY"
150	sed \
151		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
152		-e "s|@MAJOR@|$MAJOR|" \
153		-e "s|@MIDDLE@|$MIDDLE|" \
154		-e "s|@MINOR@|$MINOR|" \
155		-e "s|@LONG_INFO@|$LONG_INFO|" \
156		$portDir/additional-files/epiphany.rdef.in > epiphany.rdef
157
158	addResourcesToBinaries epiphany.rdef "$appsDir/GNOME Web/Web"
159	addAppDeskbarSymlink "$appsDir/GNOME Web/Web"
160}
161