0d7b11ed0532f0e82426ed58ad0dddc1a8fda684
[ipfire-2.x.git] / lfs / apache2
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2014 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 ###############################################################################
23 # Definitions
24 ###############################################################################
25
26 include Config
27
28 VER = 2.2.29
29
30 THISAPP = httpd-$(VER)
31 DL_FILE = $(THISAPP).tar.bz2
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 ifeq "$(PASS)" "C"
35 TARGET = $(DIR_INFO)/$(THISAPP)-config
36 else
37 TARGET = $(DIR_INFO)/$(THISAPP)
38 endif
39
40 ###############################################################################
41 # Top-level Rules
42 ###############################################################################
43
44 objects = $(DL_FILE) \
45 httpd-2.2.2-config-1.patch
46
47 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
48 httpd-2.2.2-config-1.patch = $(DL_FROM)/httpd-2.2.2-config-1.patch
49
50 $(DL_FILE)_MD5 = 579342fdeaa7b8b68d17fee91f8fab6e
51 httpd-2.2.2-config-1.patch_MD5 = e02a3ec5925eb9e111400b9aa229f822
52
53 install : $(TARGET)
54
55 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
56
57 download :$(patsubst %,$(DIR_DL)/%,$(objects))
58
59 md5 : $(subst %,%_MD5,$(objects))
60
61 ###############################################################################
62 # Downloading, checking, md5sum
63 ###############################################################################
64
65 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
66 @$(CHECK)
67
68 $(patsubst %,$(DIR_DL)/%,$(objects)) :
69 @$(LOAD)
70
71 $(subst %,%_MD5,$(objects)) :
72 @$(MD5)
73
74 ###############################################################################
75 # Installation Details
76 ###############################################################################
77
78 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
79 @$(PREBUILD)
80 ifeq "$(PASS)" "C"
81 # DO THIS IN AN EXTRA STEP BECAUSE PHP AND SUBVERSION WILL FAIL.
82
83 cp -rf $(DIR_CONF)/httpd/* /etc/httpd/conf
84 ln -sf $(CONFIG_ROOT)/main/hostname.conf /etc/httpd/conf/
85
86 # Copy all html/cgi-bin files
87 mkdir -p /srv/web/ipfire/{cgi-bin,html}
88 mkdir -p /var/updatecache/{download,metadata}
89 cp -aR $(DIR_SRC)/html/* /srv/web/ipfire
90
91 # Change CONFIG_ROOT in cgi-scripts
92 for i in /srv/web/ipfire/cgi-bin/{*,logs.cgi/*,vpn.cgi/*}; do \
93 if [ -f $$i ]; then \
94 sed -i "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i; \
95 fi; \
96 done
97 chown -R root:root /srv/web/ipfire
98 chmod -R 755 /srv/web/ipfire/cgi-bin
99 chmod -R 644 /srv/web/ipfire/html
100 chmod 755 /srv/web/ipfire/html /srv/web/ipfire/html/{index.cgi,redirect.cgi,dial.cgi,images,include,themes,themes/*,themes/*/*}
101 ln -svf ipfire /srv/web/ipfire/html/themes/ipfire-rounded
102
103 # Reset permissions of redirect templates and theme directories
104 find /srv/web/ipfire/html/{redirect-templates,themes} -type d | xargs chmod -v 755
105 else
106 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
107 cd $(DIR_APP) && patch -Np1 -i $(DIR_DL)/httpd-2.2.2-config-1.patch
108
109 ### Add IPFire's layout, too
110 echo "# IPFire layout" >> $(DIR_APP)/config.layout
111 echo "<Layout IPFire>" >> $(DIR_APP)/config.layout
112 echo " prefix: /usr" >> $(DIR_APP)/config.layout
113 echo " exec_prefix: /usr" >> $(DIR_APP)/config.layout
114 echo " bindir: /usr/bin" >> $(DIR_APP)/config.layout
115 echo " sbindir: /usr/sbin" >> $(DIR_APP)/config.layout
116 echo " libdir: /usr/lib" >> $(DIR_APP)/config.layout
117 echo " libexecdir: /usr/lib/apache" >> $(DIR_APP)/config.layout
118 echo " mandir: /usr/share/man" >> $(DIR_APP)/config.layout
119 echo " sysconfdir: /etc/httpd/conf" >> $(DIR_APP)/config.layout
120 echo " datadir: /srv/web/ipfire" >> $(DIR_APP)/config.layout
121 echo " installbuilddir: /usr/lib/apache/build" >> $(DIR_APP)/config.layout
122 echo " errordir: /srv/web/ipfire/error" >> $(DIR_APP)/config.layout
123 echo " iconsdir: /srv/web/ipfire/icons" >> $(DIR_APP)/config.layout
124 echo " htdocsdir: /srv/web/ipfire/htdocs" >> $(DIR_APP)/config.layout
125 echo " manualdir: /srv/web/ipfire/manual" >> $(DIR_APP)/config.layout
126 echo " cgidir: /srv/web/ipfire/cgi-bin" >> $(DIR_APP)/config.layout
127 echo " includedir: /usr/include/apache" >> $(DIR_APP)/config.layout
128 echo " localstatedir: /srv/web/ipfire" >> $(DIR_APP)/config.layout
129 echo " runtimedir: /var/run" >> $(DIR_APP)/config.layout
130 echo " logfiledir: /var/log/httpd" >> $(DIR_APP)/config.layout
131 echo " proxycachedir: /var/cache/apache/proxy" >> $(DIR_APP)/config.layout
132 echo "</Layout>" >> $(DIR_APP)/config.layout
133
134 cd $(DIR_APP) && ./configure --enable-layout=IPFire \
135 --enable-ssl --enable-mods-shared=all --enable-proxy
136 cd $(DIR_APP) && make $(MAKETUNING)
137 cd $(DIR_APP) && make install
138 chown -v root:root /usr/lib/apache/httpd.exp \
139 /usr/sbin/{apxs,apachectl,dbmmanage,envvars{,-std}} \
140 /usr/share/man/man1/{dbmmanage,ht{dbm,digest,passwd,txt2dbm}}.1 \
141 /usr/share/man/man8/{ab,apachectl,apxs,htcacheclean,httpd}.8 \
142 /usr/share/man/man8/{logresolve,rotatelogs,suexec}.8
143 @rm -rf $(DIR_APP)
144 endif
145 @$(POSTBUILD)