1SUMMARY="Adblocker that creates a hosts file from multiple sources"
2DESCRIPTION="hBlock is a POSIX-compliant shell script that gets a list of domains that serve \
3ads, tracking scripts and malware from multiple sources and creates a hosts \
4file, among other formats, that prevents your system from connecting to them."
5HOMEPAGE="https://github.com/hectorm/hblock"
6COPYRIGHT="2023 H��ctor Molinero Fern��ndez"
7LICENSE="MIT"
8REVISION="1"
9SOURCE_URI="https://github.com/hectorm/hblock/archive/v${portVersion:?}.tar.gz"
10CHECKSUM_SHA256="d578e81a4ec1a4ebd3308e9c53591a7496403b016420ad47e7600660e3fd06cd"
11PATCHES="hblock-$portVersion.patchset"
12
13ARCHITECTURES="any"
14
15PROVIDES="
16	hblock = ${portVersion:?}
17	cmd:hblock
18	"
19REQUIRES="
20	haiku
21	cmd:curl
22	"
23
24BUILD_PREREQUIRES="
25	cmd:install
26	cmd:make
27	cmd:sed
28	"
29
30PATCH()
31{
32	# Replace hardcoded paths.
33	bSystemEtcDirectory=$(finddir B_SYSTEM_ETC_DIRECTORY)
34	bSystemSettingsDirectory=$(finddir B_SYSTEM_SETTINGS_DIRECTORY)
35	sed -i \
36		-e "s|\"\${ETCDIR?}/hosts\"|\"${bSystemSettingsDirectory:?}/network/hosts\"|" \
37		-e "s|'/etc'|'${bSystemEtcDirectory:?}'|" \
38		./hblock
39	sed -i \
40		-e "s|,/etc/hosts|,${bSystemSettingsDirectory:?}/network/hosts|" \
41		-e "s|,/etc/|,${bSystemEtcDirectory:?}/|" \
42		./hblock.1
43}
44
45INSTALL()
46{
47	make install prefix="${prefix:?}" bindir="${binDir:?}" mandir="${manDir:?}"
48}
49