/*
 * $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.:
 *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 geo-ip.txt geo-ipv6.txt

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

URL4 = https://download.ip2location.com/lite/IP2LOCATION-LITE-DB1.CSV.ZIP
URL6 = https://download.ip2location.com/lite/IP2LOCATION-LITE-DB1.IPV6.CSV.ZIP
GEODB4 = IP2LOCATION-LITE-DB1.CSV
GEODB6 = IP2LOCATION-LITE-DB1.IPV6.CSV
TMP = tmp

.FORCE:

$(GEODB4).ZIP: .FORCE
	@if test -f $(TOP)/.package; then \
		wget -N $(URL4); \
	else touch $@; fi

$(GEODB6).ZIP: .FORCE
	@if test -f $(TOP)/.package; then \
		wget -N $(URL6); \
	else touch $@; fi

geo-ip.txt: $(GEODB4).ZIP
	@if test -f $(TOP)/.package; then \
		rm -rf $(TMP); \
		mkdir $(TMP); \
		(cd $(TMP); unzip ../$(GEODB4).ZIP); \
		(cd $(TMP); \
			../$(TOP)/scripts/geo-to-db.pl -ic $(GEODB4) >../geo-ip.txt); \
	else touch $@; fi

geo-ipv6.txt: $(GEODB6).ZIP
	@if test -f $(TOP)/.package; then \
		rm -rf $(TMP); \
		mkdir $(TMP); \
		(cd $(TMP); unzip ../$(GEODB6).ZIP); \
		(cd $(TMP); \
			../$(TOP)/scripts/geo6-to-db.pl -i $(GEODB6) >../geo-ipv6.txt); \
	else touch $@; fi

local_clean::
	rm -rf $(TMP)
	rm -f $(GEODB4).ZIP
	rm -f $(GEODB6).ZIP
