summaryrefslogtreecommitdiffstats
path: root/IP2Location.spec
blob: d495772e9c0af5ee3ca75497c56d506d3f34cd0d (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# remirepo spec file for IP2Location, from
#
# fedora spec file for IP2Location
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please, preserve the changelog entries
#
%define	version 8.2.0
%define soname 3

# enable the following for intermediate builds
#define gitcommit 6e49424dfc998856fa790df498bf77520e72ca28

%if 0%{?gitcommit:1}
%global shortcommit %(c=%{gitcommit}; echo ${c:0:7})
%define build_timestamp %(date +"%Y%m%d")
%global gittag .%{build_timestamp}git%{shortcommit}
%endif

Name:		IP2Location
Summary:	C library for mapping IP address to geolocation information
Version:	%{version}
Release:	0%{?gittag}%{?dist}
License:	MIT
URL:		http://www.ip2location.com/
%if 0%{?gitcommit:1}
Source0:	https://github.com/chrislim2888/IP2Location-C-Library/archive/%{gitcommit}/%{name}-%{gitcommit}.tar.gz
%else
Source0:	https://github.com/chrislim2888/IP2Location-C-Library/archive/%{version}/%{name}-%{version}.tar.gz
%endif
BuildRequires:	libtool
BuildRequires:	perl(Math::BigInt)
BuildRequires:  gcc
BuildRequires:  autoconf
BuildRequires:  automake

Obsoletes:	libip2location < %{version}
Provides:	libip2location = %{version}


%description
IP2Location C library enables the user to get the country, region, city,
coordinates, ZIP code, time zone, ISP, domain name, connection type,
area code, weather info, mobile carrier, elevation and usage type from any IP
address or hostname. This library has been optimized for speed and memory
utilization. The library contains API to query all IP2Location LITE and
commercial binary databases.

Users can download the latest LITE database from IP2Location web site using e.g.
the included downloader.


%package 	devel
Summary:	Static library and header files for the IP2Location library
Requires:	%{name} = %{version}-%{release}
Provides:	%{name}-devel = %{version}-%{release}

Obsoletes:	libip2location-devel < %{version}
Provides:	libip2location-devel = %{version}


%description 	devel
IP2Location C library enables the user to get the country, region, city,
coordinates, ZIP code, time zone, ISP, domain name, connection type,
area code, weather info, mobile carrier, elevation and usage type from any IP
address or hostname. This library has been optimized for speed and memory
utilization. The library contains API to query all IP2Location LITE and
commercial binary databases.

This package contains the development files for the IP2Location library.


%package 	data-sample
Summary:	Sample data files for the IP2Location library
Requires:	%{name} = %{version}-%{release}

Obsoletes:	ip2location-country < %{version}
Provides:	ip2location-country = %{version}


%description 	data-sample
IP2Location C library enables the user to get the country, region, city,
coordinates, ZIP code, time zone, ISP, domain name, connection type,
area code, weather info, mobile carrier, elevation and usage type from any IP
address or hostname. This library has been optimized for speed and memory
utilization. The library contains API to query all IP2Location LITE and
commercial binary databases.

This package contains the sample data files for testing the library.

Latest lite databases can be downloaded from
	https://lite.ip2location.com

Further sample databases can be downloaded from
	https://www.ip2location.com/development-libraries/ip2location/c


%prep
%if 0%{?gitcommit:1}
%setup -q -n IP2Location-C-Library-%{gitcommit}
%else
%setup -q -n IP2Location-C-Library-%{version}
%endif

# remove a warning option which break configure on older gcc versions
# (at least gcc version 4.1.2 20080704)
perl -pi -e 's/-Wno-unused-result//' configure.ac


%build
sh ./bootstrap
autoreconf -fiv

%configure --disable-static
%if 0%{?make_build:1}
%make_build COPTS="$RPM_OPT_FLAGS"
%else
make %{?_smp_mflags} COPTS="$RPM_OPT_FLAGS"
%endif


# convert CSV to BIN
make -C data convert


%check
LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH make check


%install
%if 0%{?make_install:1}
%make_install
%else
make install DESTDIR=%{buildroot}
%endif

# cleanup
rm -f %{buildroot}%{_libdir}/*.*a

# tools
install -d %{buildroot}%{_datadir}/%{name}/tools
install -pm 0755 tools/download.pl %{buildroot}%{_datadir}/%{name}/tools

# database directory
install -d %{buildroot}%{_datadir}/%{name}/
# note: according to https://www.ip2location.com/development-libraries/ip2location/c
# IPv6 sample file has *.SAMPLE* while IPv4 has *-SAMPLE* in ZIP file
install -p data/IP-COUNTRY.BIN %{buildroot}%{_datadir}/%{name}/IP-COUNTRY-SAMPLE.BIN
install -p data/IPV6-COUNTRY.BIN %{buildroot}%{_datadir}/%{name}/IPV6-COUNTRY.SAMPLE.BIN


%files
%{!?_licensedir:%global license %%doc}
%license COPYING LICENSE.TXT

%doc AUTHORS ChangeLog README.md NEWS

%{_libdir}/libIP2Location.so.%{soname}
%{_libdir}/libIP2Location.so.%{soname}.0.0

%{_datadir}/%{name}/tools/

%dir %{_datadir}/%{name}/


%files devel
%{_includedir}/IP2Loc*.h
%{_libdir}/libIP2Location.so

%doc Developers_Guide.txt


%files data-sample
%attr(644,-,-) %{_datadir}/%{name}/*.BIN


%changelog
* Sat Oct 17 2020 Remi Collet <remi@remirepo.net> - 8.2.0-0
- sync with Fedora and rename to IP2location
- rebuild for #remirepo with release = 0
  to manage update from old version

* Wed Oct 07 2020 Peter Bieringer <pb@bieringer.de> - 8.2.0-12
- update version to 8.2.0 (soname: 3)

* Tue Oct  6 2020 Remi Collet <remi@remirepo.net> - 8.1.3-0
- sync with Fedora and rename to IP2location
- rebuild for #remirepo with release = 0
  to manage update from old version

* Fri Sep 25 2020 Peter Bieringer <pb@bieringer.de> - 8.1.3-11
- update version to 8.1.3

* Fri Sep 25 2020 Peter Bieringer <pb@bieringer.de> - 8.1.2-11
- update version to 8.1.2 (soname: 2)

* Thu Sep 24 2020 Remi Collet <remi@remirepo.net> - 8.0.9-0
- sync with Fedora and rename to IP2location
- rebuild for #remirepo with release = 0
  to manage update from old version

* Thu Sep 24 2020 Peter Bieringer <pb@bieringer.de> - 8.0.9-10
- add additional Obsoletes/Provides/BuildRequires

* Tue Sep 15 2020 Peter Bieringer <pb@bieringer.de> - 8.0.9-8
- subpackage data-sample: add suffix "SAMPLE" to included BIN files, fix file permissions
- use latest sources, git commit 6e49424dfc998856fa790df498bf77520e72ca28

* Fri Sep 11 2020 Peter Bieringer <pb@bieringer.de> - 8.0.9-7
- use latest sources, git commit 9a987645663b2e13191072df9d8866bf65bc85f5
- add subpackage data-sample including the generated BIN files

* Tue Sep 08 2020 Peter Bieringer <pb@bieringer.de> - 8.0.9-6
- add patch to sync with upstream
- add patch to make rpmlint happy

* Fri Aug 28 2020 Peter Bieringer <pb@bieringer.de>
- fix spec file according to BZ#1873302

* Sat Oct  5 2019 Peter Bieringer <pb@bieringer.de> - 8.0.9-5
- update version to 8.0.9

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