1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
8 DESCRIPTION
="GeoIP for V2Ray."
9 HOMEPAGE
="https://github.com/v2fly/geoip"
11 https://github.com/v2fly/geoip/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
12 https://github.com/blackteahamburger/gentoo-deps/releases/download/${P}/${P}-vendor.tar.xz
15 S
="${WORKDIR}/geoip-${PV}"
17 LICENSE
="CC-BY-SA-4.0 GeoLite2"
22 RDEPEND
="!dev-libs/v2ray-geoip-bin"
31 local distdir
="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
33 if ! [ -f "${distdir}/GeoLite2-Country-CSV.zip" ]; then
34 eerror
"Please first download GeoLite2-Country-CSV.zip from MaxMind"
35 eerror
"https://dev.maxmind.com/geoip/geoip2/geolite2/"
36 die
"GeoLite2-Country-CSV.zip not found"
38 unpack
"${distdir}/GeoLite2-Country-CSV.zip"
39 mv "${WORKDIR}"/GeoLite2
* "${S}/geolite2" || die
41 if ! [ -f "${distdir}/GeoLite2-Country.mmdb" ]; then
42 eerror
"Please first download GeoLite2-Country.mmdb from MaxMind"
43 eerror
"https://dev.maxmind.com/geoip/geoip2/geolite2/"
44 eerror
"or with net-misc/geoipupdate"
45 die
"GeoLite2-Country.mmdb not found"
47 mkdir
"${S}/geolite2" || die
48 cp "${distdir}/GeoLite2-Country.mmdb" "${S}/geolite2" || die
53 # remove unneeded outputs
54 sed -i -e '29,57d' config.json
56 use mmdb
&& eapply
"${FILESDIR}/${P}-mmdb.patch"
66 insinto
/usr
/share
/geoip
/
67 newins output
/geoip.dat v2fly.dat