BUILDING IP2LOCATION
--------------------
If you want to use the IP2Location library with ipv6calc, you will
have to build and install it yourself separately.
Versions below 2.1.3 are NOT suported.


Instructions for version 4.0.2 building as RPM

Check for installed "libtool" package (otherwise, following error message appears: "configure.ac:40: error: possibly undefined macro: AC_PROG_LIBTOOL")


Rebuild available SRPMS (this requires an RPM build environment):

-Download SRPMS from http://rpm.pbone.net/index.php3
  e.g. ftp://ftp.icm.edu.pl/vol/rzm2/linux-mandriva/official/2011/SRPMS/contrib/release/ip2location-4.0.2-1.src.rpm

- extend .rpmmacros:

# for Mandrake SRPMS on non Mandrake systems
%mkrel()          %1
%mklibname(ds)    %{1}%{?2:%{2}}%{?3:_%{3}}%{-s:-static}%{-d:-devel}
%mdkversion       201200
%configure2_5x    %configure
%make             make
%makeinstall_std  %makeinstall

- rebuild by

$ rpmbuild --rebuild ip2location-4.0.2-1.src.rpm

at least on Fedora 17 + RHEL/CentOS 6:
$ QA_RPATHS=$[ 0x0002 ] rpmbuild --rebuild /tmp/ip2location-4.0.2-1.src.rpm


Instructions for version 6.0.1 building as RPM "on-top" of SRPMS for 4.0.2

- download RPM from above, install source rpm
   rpm -ihv PATH/TO/ip2location-4.0.2-1.src.rpm
- download newest version: https://www.ip2location.com/downloads/ip2location-c-6.0.1.tar.gz
- store file in rpmbuild/SOURCES
- apply changes to spec file
   - change version and source in spec file
	Version:        6.0.1
	Source0:        https://www.ip2location.com/downloads/ip2location-c-%{version}.tar.gz
   - remove Patch0 lines
   - remove IP2LOCATION_PRODUCTS_CATALOG.PDF from 2 lines
- build binary package
   rpm -bb rpmbuild/SPECS/ip2location.spec



From source code:

Download C Library from https://www.ip2location.com/developers/c

Extract, configure & compile

$ tar xzf C-IP2Location-4.0.2.tar.gz
$ cd C-IP2Location-4.0.2
$ autoreconf -i && ./configure && make

Install as user "root"

# make install

This will install following files:

/usr/local/include/IP2Location.h
/usr/local/include/imath.h
/usr/local/lib/libIP2Location.a
/usr/local/lib/libIP2Location.la
/usr/local/lib/libIP2Location.so


Extend dynamic linking

# echo "/usr/local/lib" >>/etc/ld.so.conf.d/usr-local-lib.conf
# ldconfig


Install databases

# mkdir -p /var/local/share/IP2Location
# cp data/IP* /var/local/share/IP2Location/
# chmod 644 /var/local/share/IP2Location/*

Update databases (requires subscription)
http://www.ip2location.com/IPV6-COUNTRY.aspx


Enable IP2Location support by using following configure options:
  --enable-ip2location

  In case, dynamic load of library should be enabled (conditional IP2Location support), add
     --with-ip2location-dynamic

  Having IP2Location databases not stored in /usr/share/IP2Location (or a softlink created), add e.g.
     --with-ip2location-db=/var/local/share/IP2Location

  For more specifc options see ./configure --help
