cae56407c7a04734715a4c6758088f69bdf3e644
[people/pmueller/ipfire-2.x.git] / lfs / squid
1 ###############################################################################
2 #                                                                             #
3 # IPFire.org - A linux based firewall                                         #
4 # Copyright (C) 2007-2018  IPFire Team  <info@ipfire.org>                     #
5 #                                                                             #
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.                                         #
10 #                                                                             #
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.                                #
15 #                                                                             #
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/>.       #
18 #                                                                             #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER        = 3.5.28
28
29 THISAPP    = squid-$(VER)
30 DL_FILE    = $(THISAPP).tar.xz
31 DL_FROM    = $(URL_IPFIRE)
32 DIR_APP    = $(DIR_SRC)/$(THISAPP)
33 TARGET     = $(DIR_INFO)/$(THISAPP)
34
35 CXXFLAGS+= -Wno-error=format-truncation
36
37 ###############################################################################
38 # Top-level Rules
39 ###############################################################################
40
41 objects = $(DL_FILE)
42
43 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
44
45 $(DL_FILE)_MD5 = 9367e0375ea53ba0e99f77054d4402c5
46
47 install : $(TARGET)
48
49 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
50
51 download :$(patsubst %,$(DIR_DL)/%,$(objects))
52
53 md5 : $(subst %,%_MD5,$(objects))
54
55 ###############################################################################
56 # Downloading, checking, md5sum
57 ###############################################################################
58
59 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
60         @$(CHECK)
61
62 $(patsubst %,$(DIR_DL)/%,$(objects)) :
63         @$(LOAD)
64
65 $(subst %,%_MD5,$(objects)) :
66         @$(MD5)
67
68 ###############################################################################
69 # Installation Details
70 ###############################################################################
71
72 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
73         @$(PREBUILD)
74         @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xaf $(DIR_DL)/$(DL_FILE)
75         cd $(DIR_APP) && patch -Np0 -i $(DIR_SRC)/src/patches/squid/squid-3.5.28-fix-max-file-descriptors.patch
76
77         cd $(DIR_APP) && autoreconf -vfi
78         cd $(DIR_APP)/libltdl && autoreconf -vfi
79
80         cd $(DIR_APP) && CXXFLAGS="$(CXXFLAGS)" ./configure \
81                 --prefix=/usr \
82                 --sysconfdir=/etc/squid \
83                 --datadir=/usr/lib/squid \
84                 --mandir=/usr/share/man \
85                 --libexecdir=/usr/lib/squid \
86                 --localstatedir=/var \
87                 --disable-ssl \
88                 --disable-icmp \
89                 --disable-wccp \
90                 --disable-wccpv2 \
91                 --disable-kqueue \
92                 --disable-esi \
93                 --disable-arch-native \
94                 --enable-ipv6 \
95                 --enable-poll \
96                 --enable-ident-lookups \
97                 --enable-storeio=aufs,diskd,ufs \
98                 --enable-underscores \
99                 --enable-http-violations \
100                 --enable-removal-policies=heap,lru \
101                 --enable-delay-pools \
102                 --enable-linux-netfilter \
103                 --enable-snmp \
104                 --enable-auth \
105                 --enable-auth-basic \
106                 --enable-auth-digest \
107                 --enable-auth-negotiate \
108                 --enable-auth-ntlm \
109                 --enable-log-daemon-helpers \
110                 --enable-url-rewrite-helpers \
111                 --enable-build-info \
112                 --enable-eui \
113                 --enable-async-io=16 \
114                 --enable-unlinkd \
115                 --enable-internal-dns \
116                 --enable-epoll \
117                 --enable-select \
118                 --enable-cache-digests \
119                 --enable-forw-via-db \
120                 --enable-htcp \
121                 --enable-kill-parent-hack \
122                 --enable-icap-client \
123                 --enable-zph-qos \
124                 --with-dl \
125                 --with-filedescriptors=$$(( 16384 * 64 )) \
126                 --with-large-files
127
128         cd $(DIR_APP) && make $(MAKETUNING)
129         cd $(DIR_APP) && make install
130
131         rm -f /etc/squid/squid.conf
132         ln -sf /var/ipfire/proxy/squid.conf /etc/squid/squid.conf
133         rm -f /etc/squid/cachemgr.conf
134         ln -sf /var/ipfire/proxy/cachemgr.conf /etc/squid/cachemgr.conf
135         rm -f /etc/squid/errors
136         ln -sf /usr/lib/squid/errors/en /etc/squid/errors
137
138         -mkdir -p /var/log/cache /var/log/squid /var/log/updatexlrator
139         touch /var/log/squid/access.log
140         chown -R squid:squid /var/log/squid /var/log/cache /var/log/updatexlrator
141
142         cp /usr/lib/squid/cachemgr.cgi /srv/web/ipfire/cgi-bin/cachemgr.cgi
143         chown nobody.nobody /srv/web/ipfire/cgi-bin/cachemgr.cgi
144
145         cp -f $(DIR_SRC)/config/updxlrator/updxlrator /usr/sbin/updxlrator
146         cp -f $(DIR_SRC)/config/updxlrator/checkup /var/ipfire/updatexlrator/bin/checkup
147         cp -f $(DIR_SRC)/config/updxlrator/download /var/ipfire/updatexlrator/bin/download
148         cp -f $(DIR_SRC)/config/updxlrator/convert /var/ipfire/updatexlrator/bin/convert
149         cp -f $(DIR_SRC)/config/updxlrator/lscache /var/ipfire/updatexlrator/bin/lscache
150         cp -f $(DIR_SRC)/config/updxlrator/checkdeaddl /var/ipfire/updatexlrator/bin/checkdeaddl
151
152         cp -f $(DIR_SRC)/config/updxlrator/updxlrator-lib.pl /var/ipfire/updatexlrator/updxlrator-lib.pl
153
154         chmod 755 /usr/sbin/updxlrator /var/ipfire/updatexlrator/bin/checkup \
155                 /var/ipfire/updatexlrator/bin/download \
156                 /var/ipfire/updatexlrator/bin/convert \
157                 /var/ipfire/updatexlrator/bin/lscache \
158                 /var/ipfire/updatexlrator/bin/checkdeaddl
159
160         ln -fs /bin/false /var/ipfire/updatexlrator/autocheck/cron.daily
161         ln -fs /bin/false /var/ipfire/updatexlrator/autocheck/cron.monthly
162         ln -fs /bin/false /var/ipfire/updatexlrator/autocheck/cron.weekly
163
164         chown -R nobody:nobody /var/ipfire/updatexlrator
165         chown nobody.squid /var/updatecache
166         chown nobody.squid /var/updatecache/download
167         chown nobody.squid /var/updatecache/metadata
168         chmod 775 /var/updatecache
169         chmod 775 /var/updatecache/download
170         chmod 775 /var/updatecache/metadata
171         chmod 755 /var/log/updatexlrator
172         chmod 755 /srv/web/ipfire/html/images/updbooster
173         
174         chown squid:squid /var/log/squid
175         ln -sf /usr/lib/squid /usr/lib/squid/auth
176         cp -f $(DIR_SRC)/config/proxy/proxy.pac /srv/web/ipfire/html/proxy.pac
177         chown nobody.nobody /srv/web/ipfire/html/proxy.pac
178         ln -sf /srv/web/ipfire/html/proxy.pac /srv/web/ipfire/html/wpad.dat
179
180         #Copy stylesheets for the errorpages
181         cp -f $(DIR_SRC)/config/proxy/errorpage-ipfire.css /var/ipfire/proxy/
182         cp -f /etc/squid/errorpage.css /var/ipfire/proxy/errorpage-squid.css
183
184         @rm -rf $(DIR_APP)
185         @$(POSTBUILD)