summaryrefslogtreecommitdiffstats
path: root/libip2location.spec
blob: 2e3ccee1baab5e302c3660233f69812478a11755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# remirepo/fedora spec file for libip2location
#
# Copyright (c) 2017 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global libname      libIP2Location
%global gh_commit    e2b833065859250f8458e0983614e341613c87ba
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     chrislim2888
%global gh_project   IP2Location-C-Library

%global dbdir        %{_datadir}/ip2location

%global upstream_version 8.0.7
#global upstream_prever  RC1

Name:           libip2Location
Version:        %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
Release:        1%{?dist}
Group:          System Environment/Libraries
Summary:        IP2Location C Library

License:        MIT
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        %{url}/archive/%{gh_commit}/%{gh_project}-%{upstream_version}%{?upstream_prever}-%{gh_short}.tar.gz

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  %{_bindir}/perl
BuildRequires:  perl(Math::BigInt)


%description
IP2Location is a C library that enables the user to find the country,
region, city, latitude, longitude, zip code, time zone, ISP, domain
name, connection type, area code, weather, mobile network, elevation,
usage type by IP address or hostname originates from. The library reads
the geo location information from IP2Location BIN data file.

Supported IPv4 and IPv6 address.


%package -n ip2location-country
Group:     Development/Libraries
Summary:   Country database for %{name}
Requires:  %{name} = %{version}-%{release}
BuildArch: noarch

%description -n ip2location-country
The %{name}-country package contains IPv4 anb IPv6 country databases.


%package devel
Group:     Development/Libraries
Summary:   Development files for %{name}
Requires:  %{name}%{?_isa} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%setup -qn %{gh_project}-%{gh_commit}

sed -e 's/\r//' -i tools/download.pl
mv README.md README
sh ./bootstrap
autoreconf -i -v --force


%build
%configure --disable-static
make %{?_smp_mflags}
make -C data convert


%install
make install DESTDIR=%{buildroot}

rm %{buildroot}%{_libdir}/*.la

install -Dpm 644 data/IP-COUNTRY.BIN   %{buildroot}%{dbdir}/IP-COUNTRY.BIN
install -Dpm 644 data/IPV6-COUNTRY.BIN %{buildroot}%{dbdir}/IPV6-COUNTRY.BIN
install -Dpm 755 tools/download.pl     %{buildroot}%{dbdir}/download.pl


%check
make check


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%{_libdir}/%{libname}.so.1*
%dir %{dbdir}
     %{dbdir}/download.pl

%files -n ip2location-country
%{dbdir}/IP*BIN

%files devel
%doc Developers_Guide.txt
%{_includedir}/IP*.h
%{_libdir}/%{libname}.so


%changelog
* Tue Nov  7 2017 Remi Collet <remi@remirepo.net> - 8.0.7-1
- initial package