-
Notifications
You must be signed in to change notification settings - Fork 2
/
mmdb-vmod.spec
80 lines (65 loc) · 1.92 KB
/
mmdb-vmod.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
%define checkoutName %{name}-%{version}-%{_build_arch}-%{suffix: %{dist}}
%define varnishSrc https://github.com/varnish/Varnish-Cache.git
%define varnishDir VarnishCache-%{_build_arch}
%define source https://github.com/russellsimpkins-nyt/varnish-mmdb-vmod.git
Name: mmdb-vmod
Version: 1.0.1
Release: %{_build_number}%{?dist}
Summary: A varnish module to do IP lookup using libmaxminddb
Group: Content APIS/DU
License: Proprietary
URL: https://github.com/russellsimpkins-nyt/varnish-mmdb-vmod
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{_build_arch}-root-%(%{__id_u} -n)
BuildRequires: libmaxminddb git
%description
This provides the MaxMind GeoIP feature.
%prep
rm -rf "%{checkoutName}"
if [ ! -d "%{_builddir}/%{varnishDir}" ]; then
git clone "%{varnishSrc}" "%{varnishDir}"
cd "%{_builddir}/%{varnishDir}"
git branch 3.0 -t origin/3.0
git checkout 3.0
git checkout 1a89b1f75895bbf874e83cfc6f6123737a3fd76f
./autogen.sh
./configure --prefix=/usr
make clean
make
cd "%{_builddir}"
fi
src="%{source}"
if [[ "${src:0:7}" = "file://" ]] ; then :
cp -R "${src:7}" "%{checkoutName}"
else
git clone "%{source}" "%{checkoutName}"
cd "%{checkoutName}"
fi
%build
cd %{checkoutName}
mkdir buildinfo
echo "%{source}" >> buildinfo/source.txt
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
./autogen.sh
%configure VARNISHSRC=%{_builddir}/%{varnishDir} VMODDIR=%{_libdir}/varnish/vmods --with-maxminddbfile=/mnt/mmdb/GeoIP2-City.mmdb
make clean
make %{?_smp_mflags}
%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