/*
 * $Id$
 *
 * Copyright (c) 2003, Raphael Manfredi
 *
 * Extra files installed in various directories.
 *
 *----------------------------------------------------------------------
 * This file is part of gtk-gnutella.
 *
 *  gtk-gnutella is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  gtk-gnutella is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with gtk-gnutella; if not, write to the Free Software
 *  Foundation, Inc.:
 *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *----------------------------------------------------------------------
 */

;# $Id$

all::		/* So that default target is not clobber! */

EXTRA_FILES = \
	bogons.txt \
	favicon.png \
	geo-ip.txt \
	geo-ipv6.txt \
	gwcache.boot \
	hostiles.txt \
	robots.txt \
	spam.txt \
	spam_sha1.txt

PIXMAP_FILES = \
	gtk-gnutella.png	\
	gtk-gnutella.svg

DESKTOP_FILES = \
	gtk-gnutella.desktop

APPDATA_FILES = \
	gtk-gnutella.appdata.xml

INSTALLFLAGS = -m 444

MakeInstallDirectories($(PRIVLIB))
InstallMultiple($(EXTRA_FILES), $(PRIVLIB))
InstallMultiple($(DESKTOP_FILES), $(INSTALLPREFIX)/share/applications)
InstallMultiple($(APPDATA_FILES), $(INSTALLPREFIX)/share/appdata)
InstallMultiple($(PIXMAP_FILES), $(INSTALLPREFIX)/share/pixmaps)

SetSubdirs(el en it fr ja tr)

;#
;# Update the bogons and GeoIp databases
;#

update: update_bogons update_geoip

update_bogons:
;# Target disabled, site seems to be down definitively? -- RAM, 2009-01-16
	: wget http://www.completewhois.com/bogons/data/bogons-cidr-all.txt \
		-O bogons.txt

GEODB = GeoLite2-Country-CSV.zip
URL = https://geolite.maxmind.com/download/geoip/database/$(GEODB)
TMP = tmp

;#
;# The fetched GEODB zip file unzips itself into a sub-directory.
;#
;# Hence the strategy is to create a tempory directory where we unzip it,
;# and then descend in the single created directory below it to find the
;# CSV files containing the CIDR mappings to country codes.
;#
;# We therefore issue "cd tmp/*" to be at the location of the extracted files.
;#
/* We use the "/^^*" construct below since "/*" is a comment for cpp */
update_geoip:
	rm -f $(GEODB)
	rm -rf $(TMP)
	wget $(URL)
	mkdir $(TMP)
	(cd $(TMP); unzip ../$(GEODB))
	(cd $(TMP)/^^*; \
		../../$(TOP)/scripts/geolite-to-db.pl \
		../../geo-ip.txt GeoLite2-Country-Blocks-IPv4.csv)
	(cd $(TMP)/^^*; \
		../../$(TOP)/scripts/geolite-to-db.pl \
		../../geo-ipv6.txt GeoLite2-Country-Blocks-IPv6.csv)

local_clean::
	rm -rf $(TMP)
	rm -f $(GEODB)
