GENERAL
-------
IP2Location changed the API layer several times
	2.x (no longer in scope)
	4.x -> 6.x
	6.x -> 7.x
	7.x -> 8.x

To avoid issues caused by undetectable incompatibilities (no library version function provided so far),
 program will not start in case of dynamic linking an incompatible library.

Supported so far:
	compiled with 4.0.2, supported library: 4.0.2 - 6.0.3 
	compiled with 6.0.x, supported library: 6.0.1 - 6.0.3 
	compiled with 7.0.0, supported library: 7.0.0
	compiled with 8.0.4, supported library: 8.0.0 -

In dynamic load configuration, this will detected and features will be deactivated

Description of the various fields:
http://www.ip2location.com/databases/db24-ip-country-region-city-latitude-longitude-zipcode-timezone-isp-domain-netspeed-areacode-weather-mobile-elevation-usagetype


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 supported.


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:

See also instructions on https://www.ip2location.com/developers/c
Note that sources are now available on GitHub

Extract, configure & compile

$ unzip -l master.zip
$ cd IP2Location-C-Library-master
$ 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


DATA UPDATE
---------------------
Create as user "root" database custom data directories:

# mkdir -p /var/local/share/IP2Location

For regular (monthls) updates of available free and permitted commercial databases a download tool is also provided:
        IP2Location-update.sh
