app-shells/zfe: add nvchecker
[gentoo-zh.git] / dev-libs / v2ray-geoip / v2ray-geoip-202412201411.ebuild
bloba0c76f63cb699cca3085b903825f7cbbdbd170f8
1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit go-module
8 DESCRIPTION="GeoIP for V2Ray."
9 HOMEPAGE="https://github.com/v2fly/geoip"
10 SRC_URI="
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"
18 SLOT="0"
19 KEYWORDS="~amd64"
20 IUSE="mmdb"
22 RDEPEND="!dev-libs/v2ray-geoip-bin"
23 BDEPEND="
24 >=dev-lang/go-1.21
25 app-arch/unzip
28 src_unpack() {
29 go-module_src_unpack
31 local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
32 if use !mmdb; then
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
40 else
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
52 src_prepare() {
53 # remove unneeded outputs
54 sed -i -e '29,57d' config.json
56 use mmdb && eapply "${FILESDIR}/${P}-mmdb.patch"
58 default
61 src_compile() {
62 ego run ./
65 src_install() {
66 insinto /usr/share/geoip/
67 newins output/geoip.dat v2fly.dat