This repository has been archived by the owner on Apr 27, 2021. It is now read-only.
forked from russellsimpkins-nyt/varnish-mmdb-vmod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
libvmod-maxmind-geoip.spec
78 lines (65 loc) · 1.93 KB
/
libvmod-maxmind-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
%define checkoutName %{name}-%{version}-%{_build_arch}-%{suffix: %{dist}}
%define varnishSrc https://github.com/varnish/Varnish-Cache.git
%define varnishDir VarnishCache-%{_build_arch}
%{!?_build_number: %define _build_number 1}
%{!?_version_number: %define _version_number 1.0.1}
%{!?source: %define source https://github.com/nytm/varnish-mmdb-vmod.git}
%{!?_build_number: %define _build_number 1}
Name: libvmod-maxmind-geoip
Version: %{_version_number}
Release: %{_build_number}%{?dist}
Summary: A varnish module to do IP lookup using libmaxminddb
Group: Content APIS/DU
License: Proprietary
URL: https://github.com/nytm/varnish-mmdb-vmod
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{_build_arch}-root-%(%{__id_u} -n)
BuildRequires: libmaxminddb git varnish-cache
Requires: libmaxminddb
%description
This provides the MaxMind GeoIP feature.
%prep
rm -rf "%{checkoutName}"
src="%{source}"
if [[ "${src:0:7}" = "file://" ]] ; then :
cp -R "${src:7}" "%{checkoutName}"
else
if [ ! -d "%{checkoutName}" ]; then
git clone "%{source}" "%{checkoutName}"
fi
cd "%{checkoutName}"
fi
%build
cd %{checkoutName}
if [ ! -d buildinfo ]; then
mkdir buildinfo
echo "%{source}" >> buildinfo/source.txt
# git checkout -b master origin/master
git branch > buildinfo/branch.txt
git status > buildinfo/status.txt
git remote --verbose show -n origin > buildinfo/origin.txt
git log --max-count=1 --pretty=fuller > buildinfo/log.txt
fi
./autogen.sh
%configure VMODDIR=%{_libdir}/varnish/vmods --with-maxminddbfile=/mnt/mmdb/GeoIP2-City.mmdb
make -C tests tests.c
make clean
make -C tests tests.c
make %{?_smp_mflags}
%debug_package
%install
cd %{checkoutName}
rm -rf %{buildroot}
mkdir %{buildroot}
make install DESTDIR=%{buildroot}
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
#rm -rf %{checkoutName}
%files
%defattr(-,root,root,-)
/usr/*
%doc
%changelog