mirror of
https://github.com/dguglielmi/sunny-overlay.git
synced 2025-12-06 22:32:37 +01:00
net-misc/ipcalc-ng: add ebuild
This commit is contained in:
4
net-misc/ipcalc-ng/Manifest
Normal file
4
net-misc/ipcalc-ng/Manifest
Normal file
@@ -0,0 +1,4 @@
|
||||
AUX ipcalc-ng-0.2.2-fix-geoip-linking.patch 2521 BLAKE2B 6036c67f71aa7dddfef73a5c20838c97eacb385679c0efd27bca26cc1da757c83e529b87c435d72fe77bb715e413b7579ab572b4241dd5b645497bc4b9b77916 SHA512 5ddf5036d6c067f8275e1a9e0535a34f77ea1212ae5428f7b4c4f1f32aa3816ab3836b4bed9da1e439a36132362217fff9c28e37188370706b9b4fd0a5abc56a
|
||||
AUX ipcalc-ng-0.2.2-ipcalc-h-guard-header.patch 906 BLAKE2B 58bcbd47bc28556ce22c23781b816d2b2fe87f26cf62f5973dd1eae860c9d212f090524740dd660e1f16e60270bca3f99d9063b14ee2956ba9c5cf979104fb1e SHA512 41992e48057e25173c08f6695a912fd8186d5434004e3f5c10c37f6d139f42e7ac826ef20230aaadf56afb0dafed0be977bd58cb540bd53115e705f2a6fda16c
|
||||
DIST ipcalc-ng-0.2.2.tar.gz 36523 BLAKE2B 12afd7bf31dc641a7563a8e9b7f3283f0fbaca3e13acc2c9e30a6268498a13a1567151f839620c64a4317639452ffd7be934e416bd1311ec9f8e7e89ab7ce9dc SHA512 f70a8b8b98e308e2ec31703dae752658161df4ef0d530b86f27ec6a1c65e9942928b375c573a74ef1eac9bda112f25f9ce22487c34d3a2632282b62bd85702be
|
||||
EBUILD ipcalc-ng-0.2.2.ebuild 839 BLAKE2B 331709b8562795a80e2298addfcf8db71f78b8f62b211c4edeabb49c8e866958c63ec726285095e7131bb95bed19209466fa13baa39b25455004a18232c51637 SHA512 20bc23522aaf30c270a0b2b1c4ce2e67496928156686535ee40a37f24319e7aa3440dab5ed4bf7a484506557ce90ec4ca0eb4367b11989802d675e7f66f59915
|
||||
107
net-misc/ipcalc-ng/files/ipcalc-ng-0.2.2-fix-geoip-linking.patch
Normal file
107
net-misc/ipcalc-ng/files/ipcalc-ng-0.2.2-fix-geoip-linking.patch
Normal file
@@ -0,0 +1,107 @@
|
||||
diff -dNur a/ipcalc.c b/ipcalc.c
|
||||
--- a/ipcalc.c 2017-12-27 10:47:42.000000000 +0100
|
||||
+++ b/ipcalc.c 2018-05-18 00:54:51.986184370 +0200
|
||||
@@ -1290,8 +1290,15 @@
|
||||
if (hostname)
|
||||
flags |= FLAG_RESOLVE_IP;
|
||||
|
||||
+#ifdef USE_GEOIP
|
||||
+#ifdef USE_DYN_GEOIP
|
||||
if (geo_setup() == 0 && ((flags & FLAG_SHOW_ALL_INFO) == FLAG_SHOW_ALL_INFO))
|
||||
flags |= FLAG_GET_GEOIP;
|
||||
+#else
|
||||
+ if ((flags & FLAG_SHOW_ALL_INFO) == FLAG_SHOW_ALL_INFO)
|
||||
+ flags |= FLAG_GET_GEOIP;
|
||||
+#endif
|
||||
+#endif
|
||||
|
||||
if ((hostname && randomStr) || (hostname && splitStr) || (randomStr && splitStr)) {
|
||||
if (!beSilent)
|
||||
diff -dNur a/ipcalc-geoip.c b/ipcalc-geoip.c
|
||||
--- a/ipcalc-geoip.c 2017-12-27 10:47:42.000000000 +0100
|
||||
+++ b/ipcalc-geoip.c 2018-05-18 00:54:40.570361944 +0200
|
||||
@@ -34,6 +34,22 @@
|
||||
# include <GeoIP.h>
|
||||
# include <GeoIPCity.h>
|
||||
|
||||
+static int __attribute__((__format__(printf, 2, 3)))
|
||||
+safe_asprintf(char **strp, const char *fmt, ...)
|
||||
+{
|
||||
+ int ret;
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start(args, fmt);
|
||||
+ ret = vasprintf(&(*strp), fmt, args);
|
||||
+ va_end(args);
|
||||
+ if (ret < 0) {
|
||||
+ fprintf(stderr, "Memory allocation failure\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
# ifdef USE_DYN_GEOIP
|
||||
# include <dlfcn.h>
|
||||
|
||||
@@ -59,22 +75,6 @@
|
||||
|
||||
#define LIBNAME LIBPATH"/libGeoIP.so.1"
|
||||
|
||||
-static int __attribute__((__format__(printf, 2, 3)))
|
||||
-safe_asprintf(char **strp, const char *fmt, ...)
|
||||
-{
|
||||
- int ret;
|
||||
- va_list args;
|
||||
-
|
||||
- va_start(args, fmt);
|
||||
- ret = vasprintf(&(*strp), fmt, args);
|
||||
- va_end(args);
|
||||
- if (ret < 0) {
|
||||
- fprintf(stderr, "Memory allocation failure\n");
|
||||
- exit(1);
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
int geo_setup(void)
|
||||
{
|
||||
static void *ld = NULL;
|
||||
@@ -141,8 +141,10 @@
|
||||
int country_id;
|
||||
const char *p;
|
||||
|
||||
+#ifdef USE_DYN_GEOIP
|
||||
if (geo_setup() != 0)
|
||||
return;
|
||||
+#endif
|
||||
|
||||
ip.s_addr = ntohl(ip.s_addr);
|
||||
|
||||
@@ -207,8 +209,10 @@
|
||||
int country_id;
|
||||
const char *p;
|
||||
|
||||
+#ifdef USE_DYN_GEOIP
|
||||
if (geo_setup() != 0)
|
||||
return;
|
||||
+#endif
|
||||
|
||||
p_GeoIP_setup_dbfilename();
|
||||
|
||||
diff -dNur a/ipcalc.h b/ipcalc.h
|
||||
--- a/ipcalc.h 2017-12-27 10:47:42.000000000 +0100
|
||||
+++ b/ipcalc.h 2018-05-18 00:54:40.570361944 +0200
|
||||
@@ -20,11 +20,9 @@
|
||||
#ifdef USE_GEOIP
|
||||
void geo_ipv4_lookup(struct in_addr ip, char **country, char **ccode, char **city, char **coord);
|
||||
void geo_ipv6_lookup(struct in6_addr *ip, char **country, char **ccode, char **city, char **coord);
|
||||
+#ifdef USE_DYN_GEOIP
|
||||
int geo_setup(void);
|
||||
-#else
|
||||
-# define geo_ipv4_lookup(x,y,z,w,a)
|
||||
-# define geo_ipv6_lookup(x,y,z,w,a)
|
||||
-# define geo_setup() -1
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
char __attribute__((warn_unused_result)) *safe_strdup(const char *str);
|
||||
@@ -0,0 +1,30 @@
|
||||
From cfb6fab514ff7dbf2eeb641cc553349d6fc143b3 Mon Sep 17 00:00:00 2001
|
||||
From: Nikos Mavrogiannopoulos <nmav@redhat.com>
|
||||
Date: Wed, 25 Apr 2018 13:22:03 +0200
|
||||
Subject: [PATCH] ipcalc.h: guard header
|
||||
|
||||
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
|
||||
---
|
||||
ipcalc.h | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/ipcalc.h b/ipcalc.h
|
||||
index 74c8896..a3f13bc 100644
|
||||
--- a/ipcalc.h
|
||||
+++ b/ipcalc.h
|
||||
@@ -17,6 +17,9 @@
|
||||
* Nikos Mavrogiannopoulos <nmav@redhat.com>
|
||||
*/
|
||||
|
||||
+#ifndef _IPCALC_H
|
||||
+#define _IPCALC_H
|
||||
+
|
||||
#ifdef USE_GEOIP
|
||||
void geo_ipv4_lookup(struct in_addr ip, char **country, char **ccode, char **city, char **coord);
|
||||
void geo_ipv6_lookup(struct in6_addr *ip, char **country, char **ccode, char **city, char **coord);
|
||||
@@ -100,3 +103,5 @@ __attribute__ ((format(printf, 3, 4)))
|
||||
color_printf(const char *color, const char *title, const char *fmt, ...);
|
||||
|
||||
extern int beSilent;
|
||||
+
|
||||
+#endif
|
||||
41
net-misc/ipcalc-ng/ipcalc-ng-0.2.2.ebuild
Normal file
41
net-misc/ipcalc-ng/ipcalc-ng-0.2.2.ebuild
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright 1999-2018 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=6
|
||||
|
||||
inherit eutils toolchain-funcs
|
||||
|
||||
MY_PN=${PN%%-ng}
|
||||
|
||||
DESCRIPTION="an IPv4/IPv6 ipcalc tool"
|
||||
HOMEPAGE="https://github.com/nmav/ipcalc"
|
||||
SRC_URI="https://github.com/nmav/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="+geoip +static"
|
||||
|
||||
S="${WORKDIR}/${MY_PN}-${PV}"
|
||||
|
||||
DEPEND="!net-misc/ipcalc
|
||||
geoip? ( dev-libs/geoip )"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
${FILESDIR}/${P}-fix-geoip-linking.patch
|
||||
${FILESDIR}/${P}-ipcalc-h-guard-header.patch
|
||||
)
|
||||
|
||||
src_compile() {
|
||||
CC="$(tc-getCC)" LIBS="${LDFLAGS}" LIBPATH="${EPREFIX}/usr/$(get_libdir)" \
|
||||
USE_GEOIP="$(usex geoip yes no)" \
|
||||
USE_DYN_GEOIP="no" \
|
||||
emake
|
||||
}
|
||||
|
||||
src_install() {
|
||||
dobin ${MY_PN}
|
||||
doman ${MY_PN}.1
|
||||
dodoc NEWS README.md
|
||||
}
|
||||
Reference in New Issue
Block a user