Name:           libmaxminddb
Version:        1.7.1
Release:        1
Summary:        C library for working with MaxMind DB files
License:        ASL 2.0 and BSD
URL:            https://github.com/maxmind/libmaxminddb
Source0:        https://github.com/maxmind/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1:        maxminddb_config.h

BuildRequires:  gcc perl-interpreter make libtool automake autoconf gcc-c++
BuildRequires:  perl-File-Temp perl-Test-Simple >= 0.88 perl-Test-Output

%description
The libmaxminddb library provides a C library for reading MaxMind DB files,
including the GeoIP2 databases from MaxMind. This is a custom binary format
designed to facilitate fast lookups of IP addresses while allowing for great flexibility
in the type of data associated with an address.

The MaxMind DB format is an open format. The spec is available at http://maxmind.github.io/MaxMind-DB/.
This spec is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.

See http://dev.maxmind.com/ for more details about MaxMind's GeoIP2 products.

%package devel
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       pkgconfig
Summary:        Development header files for libmaxminddb

%description devel
libmaxminddb header files and mmdblookup utility for ip address lookup in maxmind DB file.

%package help
Requires:      %{name}%{?_isa} = %{version}-%{release}
Summary:       man information and changelog document for user

%description help
the help package include man information and changelog document for user.

%prep
%setup -q
autoreconf --force --install

%build
%configure --disable-static
%disable_rpath
sed -i -e 's/ -shared / -Wl,--as-needed\0/g' libtool

%make_build

%check
LD_PRELOAD=%{buildroot}%{_libdir}/libmaxminddb.so make check

%install
%make_install
%ldconfig_scriptlets

%files
%license LICENSE NOTICE
%{_libdir}/libmaxminddb.so.*
%exclude %{_libdir}/*.la

%files devel
%{_bindir}/mmdblookup
%{_includedir}/maxminddb.h
%{_includedir}/maxminddb_config.h
%{_libdir}/libmaxminddb.so
%{_libdir}/pkgconfig/libmaxminddb.pc

%files help
%doc Changes.md 
%{_mandir}/man1/*
%{_mandir}/man3/*

%changelog
* Fri Feb 17 2023 li-long315 <lilong@kylinos.cn> - 1.7.1-1
- Upgrade to 1.7.1

* Mon Jun 27 2022 dillon chen <dillon.chen@gmail.com> - 1.5.2-1
- update to 1.5.2

* Tue Jan 26 2021 liudabo <liudabo1@huawei.com> - 1.5.0-1
- upgrade version to 1.5.0

* Tue Sep 3 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.2.0-7
- Package init