-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGeoIP.spec
232 lines (177 loc) · 6.77 KB
/
GeoIP.spec
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
227
228
229
230
231
232
# data_stamp should be the date of the included database as Source1.
# When a new database is included, this should be changed.
%define data_stamp %(date +\%Y\%m\%d)
Name: GeoIP
Version: 1.4.8
Release: 1%{?dist}
Summary: C library finding what country an IP/hostname originates from
Group: System Environment/Libraries
License: GPL
URL: http://www.maxmind.com/app/c
Source0: http://www.maxmind.com/download/geoip/api/c/%{name}-%{version}.tar.gz
#added by CentOS, newest GeoIP database as a seperate source
Source1: http://www.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Source2: http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
Source3: http://www.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
Source4: http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
Source5: geoip-fetch
Buildrequires: gzip
Buildrequires: zlib-devel
Buildrequires: csv2bin
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
GeoIP is a C library that enables the user to find the country that any IP
address or hostname originates from. It uses a file based database that is
accurate as of March 2003. This database simply contains IP blocks as keys,
and countries as values. This database should be more complete and accurate
than using reverse DNS lookups. Commercial databases and automatic update
services are available from http://www.maxmind.com/
This module can be used to automatically select the geographically closest
mirror, to analyze your web server logs to determine the countries of your
visitors, for credit card fraud detection, and for software export controls.
%package devel
Summary: GeoIP headers, libraries
Group: Development/Libraries
Requires: %{name} <= %{version}
%description devel
This package contain the devel files for GeoIP.
%package data
Summary: GeoIP database file
Group: System Environment/Libraries
Version: %{data_stamp}
Release: %{release}
Requires: %{name}
%description data
This package contains the database for ipt_geoip.
%package databin
Summary: GeoIP csv to bin file
Group: System Environment/Libraries
Version: %{data_stamp}
Release: %{release}
#Requires: %{name}
%description databin
This package contains the csv file convertet to bin for ipt_geoip.
%package datacsv
Summary: GeoIP csv file
Group: System Environment/Libraries
Version: %{data_stamp}
Release: %{release}
#Requires: %{name}
%description datacsv
This package contains the csv file for GeoIP.
%prep
%setup -q
#added by CentOS ... use latest GeoIP database
%{__cp} -a %{SOURCE1} data/
gunzip -f data/GeoIP.dat.gz
%{__mkdir} datacsv
%{__cp} -a %{SOURCE2} data/
unzip data/GeoIPCountryCSV.zip -d data
%{__cp} -a %{SOURCE3} data/
gunzip -f data/GeoIPv6.dat.gz
%{__cp} -a %{SOURCE4} data/
gunzip -f data/GeoLiteCity.dat.gz
csv2bin data/GeoIPCountryWhois.csv
%{__cp} -a geoipdb.* data/
#
%build
# --with-dbdir doesn't work!
%configure --datadir=%{_localstatedir}/lib
%{__make} %{?_smp_mflags}
#%{?!_without_test:%{__make} check}
%install
%{__rm} -rf $RPM_BUILD_ROOT
%makeinstall
# fix CONF_DIR in geoipupdate man page
%{__sed} 's,CONF_DIR,%{_sysconfdir},' man/geoipupdate.1 > $RPM_BUILD_ROOT/%{_mandir}/man1/geoipupdate.1
# Fixup permissions on shared libraries so that findreqs will work right.
%{__chmod} 755 $RPM_BUILD_ROOT%{_libdir}/*
# strip binaries
%{__strip} $RPM_BUILD_ROOT%{_bindir}/*
%{__strip} $RPM_BUILD_ROOT%{_libdir}/*.so.*
# put databases where they should be
%{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/lib
%{__mv} $RPM_BUILD_ROOT/%{_datadir}/%{name} $RPM_BUILD_ROOT/%{_localstatedir}/lib/
install -D -m 0644 data/GeoIPv6.dat $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/GeoIPv6.dat
install -D -m 0644 data/GeoLiteCity.dat $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/GeoLiteCity.dat
install -D -m 0644 data/GeoIPCountryWhois.csv $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/GeoIPCountryWhois.csv
install -D -m 0644 data/geoipdb.* $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/
install -D -m 0755 %{SOURCE5} %{buildroot}%{_sbindir}/geoip-fetch
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog README TODO conf/GeoIP.conf.default
%attr(0755,root,root) %{_libdir}/*.so.*
%{_bindir}/*
%{_sbindir}/geoip-fetch
%config(noreplace) %{_sysconfdir}/*
%exclude %{_sysconfdir}/*.default
%dir %{_localstatedir}/lib/%{name}
%{_mandir}/*/*
%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/*.a
%exclude %{_libdir}/*.la
%files data
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}/*.dat
%files databin
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}/geoipdb.*
%files datacsv
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}/*.csv
%changelog
* Fri Feb 22 2013 David Hrbáč <[email protected]> - 1.4.8-1
- new upstream release
* Mon Oct 24 2011 David Hrbáč <[email protected]> - 1.4.7-1
- new upstream release
* Thu Jul 16 2009 David Hrbáč <[email protected]> - 1.4.6-2
- added CVS to bin database for ipt_geoip
* Thu Jul 2 2009 David Hrbáč <[email protected]> - 1.4.6-1
- new upstream version
- added CVS database
- added IPV6 database
- added City Lite database
- new GeoIP data fetch tool (geoip-fetch)
* Wed Sep 17 2008 David Hrbáč <[email protected]> - 1.4.5-1
- new upstream version
* Wed Sep 17 2008 David Hrbáč <[email protected]> - 1.4.4-1
- initial rebuild, upgrade db to Sep 2008
* Tue Apr 1 2008 Johnny Hughes
- upgraded to upstream version 1.4.4 and to the Mar 2008 dataabse
* Wed Jul 4 2007 Johnny Hughes <[email protected]> 1.4.2-1%{?dist}
- upgraded to upstream version 1.4.2 and to the Jul 2007 database
* Wed Sep 13 2006 Johnny Hughes <[email protected]> 1.4.0-1%{?dist}
- upgraded to upstream version 1.4.0 and to the Sep 2006 database
* Thu May 4 2006 Johnny Hughes <[email protected]> 1.3.14-2%{dist}
- modified to add the May 2006 database
* Sat Feb 11 2006 Johnny Hughes <[email protected]> 1.3.14-1%{dist}
- built for Centos Extras, modified to allow importing new database
* Thu Feb 02 2006 Marius FERARU <[email protected]> 1.3.14-1.n0i.1
- version 1.3.14
* Mon Aug 01 2005 Marius FERARU <[email protected]> 1.3.13-1.n0i.1
- version 1.3.13
* Sat Jul 23 2005 Marius FERARU <[email protected]> 1.3.8-3.n0i.1
- minor spec tweaks
- rebuild
* Sat Dec 04 2004 Marius FERARU <[email protected]> 0:1.3.8-2.n0i.2
- version 1.3.8
* Thu Jan 08 2004 Marius FERARU <[email protected]> 0:1.3.1-0.n0i.1
- Fedora-ized spec file
- moved .so files into devel package
- excluded duplicate configuration file
- excluded *.la filed from devel package
- stripped binaries
- moved dbdir into /var/lib/%{name}
- moved database file into a separate package
- fixed CONF_DIR in geoipupdate man page
* Mon Sep 8 2003 Dr. Peter Bieringer
- Fix for RHL 9, created a new devel package definition.
* Thu Feb 27 2003 Ryan Weaver <[email protected]>
- Initial RPM Build