geodata.xml is now generated correctly

Data is downloaded from geonames.org, and processed with an AWK and a Perl
script. The result is the part of the distribution, so the average user
(or a packager) doesn't have to download that much of data.
This commit is contained in:
2013-09-09 22:56:09 +02:00
parent 45e4308692
commit 12d2e57c55
6 changed files with 94 additions and 22 deletions

View File

@@ -5,7 +5,58 @@ EXTRA_DIST = geodata.xml
MAINTAINERCLEANFILES = geodata.xml
geodata.xml:
countryInfoURL = "http://download.geonames.org/export/dump/countryInfo.txt"
timeZonesURL = "http://download.geonames.org/export/dump/timeZones.txt"
allCountriesURL = "http://download.geonames.org/export/dump/allCountries.zip"
countryInfo.txt:
@-if test -x $(WGET); then \
$(WGET) $(countryInfoURL); \
else \
if test -x $(CURL); then \
$(CURL) $(countryInfoURL) > "$@" ; \
else \
echo "wget and curl could not be found in your PATH."; \
echo "One of them is needed to create geodata.xml!"; \
fi; \
fi
timeZones.txt:
@-if test -x $(WGET); then \
$(WGET) $(timeZonesURL); \
else \
if test -x $(CURL); then \
$(CURL) $(timeZonesURL) > "$@" ; \
else \
echo "wget and curl could not be found in your PATH."; \
echo "One of them is needed to create geodata.xml!"; \
fi; \
fi
allCountries.zip:
@-if test -x $(WGET); then \
$(WGET) $(allCountriesURL); \
else \
if test -x $(CURL); then \
$(CURL) $(allCountriesURL) > "$@" ; \
else \
echo "wget and curl could not be found in your PATH."; \
echo "One of them is needed to create geodata.xml!"; \
fi; \
fi;
cities.txt: allCountries.zip
$(AM_V_GEN) if test -x $(UNZIP); then \
$(UNZIP) allCountries.zip; \
else \
echo "unzip could not be found in your PATH."; \
echo "It is needed to create geodata.xml!"; \
fi; \
if test -f allCountries.txt; then \
$(AWK) -f geonames_process.awk allCountries.txt > $@ ; \
fi
geodata.xml: countryInfo.txt timeZones.txt cities.txt
$(AM_V_GEN) if test -x "$(PERL)"; then \
if test "x$(have_geonames_perl_modules)" = "xyes" -o "x$(I_HAVE_PERL_MODULES)" = "xyes"; then \
$(PERL) geonames_process.pl; \