1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2023 IPFire Team <info@ipfire.org> #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
30 THISAPP = libloc-$(VER)
31 DL_FILE = $(THISAPP).tar.gz
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/libloc-$(VER)
34 TARGET = $(DIR_INFO)/$(THISAPP)
36 ###############################################################################
38 ###############################################################################
40 objects = $(DL_FILE) \
41 location-$(DB_DATE).db.xz
43 $(DL_FILE) = https://source.ipfire.org/releases/libloc/$(DL_FILE)
44 location-$(DB_DATE).db.xz = https://location.ipfire.org/databases/1/archive/location-$(DB_DATE).db.xz
46 $(DL_FILE)_BLAKE2 = b0bf860ebaccd3cb49c58c066c430f7a1f936a2029957db9b88e22c04240af0268a8f6388e8ca512102f14033037a2ab8bbb93fe83e525b9859c790c5c382df4
47 location-$(DB_DATE).db.xz_BLAKE2 = 24ad4dc2496d3c0a7fe645374a02c8d4bf4724796ccf4ed00d2de9adfaa08f31cb70314afa5d8f7b7acebd4ccbd4d1f8a15b8da09a27b0092d74412cf30aa721
51 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
53 download :$(patsubst %,$(DIR_DL)/%,$(objects))
55 b2 : $(subst %,%_BLAKE2,$(objects))
60 ###############################################################################
61 # Downloading, checking, b2sum
62 ###############################################################################
64 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
67 $(patsubst %,$(DIR_DL)/%,$(objects)) :
70 $(subst %,%_BLAKE2,$(objects)) :
73 ###############################################################################
74 # Installation Details
75 ###############################################################################
77 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
79 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xvf $(DIR_DL)/$(DL_FILE)
81 # https://lists.ipfire.org/pipermail/development/2022-November/014763.html
82 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.17-Revert-Install-Perl-files-to-Perl-vendor-directory.patch
84 cd $(DIR_APP) && ./autogen.sh
85 cd $(DIR_APP) && ./configure \
89 --localstatedir=/var \
91 --with-database-path=/var/lib/location/database.db
92 cd $(DIR_APP) && make $(MAKETUNING)
93 cd $(DIR_APP) && make install
95 # Copy database to correct location.
96 cd $(DIR_APP) && cp -avf $(DIR_DL)/location-$(DB_DATE).db.xz /var/lib/location/database.db.xz
98 # Uncompress database.
99 cd $(DIR_APP) && rm -f /var/lib/location/database.db
100 cd $(DIR_APP) && xz -d /var/lib/location/database.db.xz
102 # Create directory for ipset databases.
103 cd $(DIR_APP) && mkdir -pv /var/lib/location/ipset
105 # Launch location util and export all locations in ipset compatible format.
106 cd $(DIR_APP) && /usr/bin/location export \
107 --directory=/var/lib/location/ipset \
111 # Remove exported IPv6 zones.
112 cd $(DIR_APP) && rm -rvf /var/lib/location/ipset/*.ipset6