MONSTER-REVISION!
[ipfire-2.x.git] / lfs / apache2
1 ###############################################################################
2 # This file is part of the IPCop Firewall.                                    #
3 #                                                                             #
4 # IPCop is free software; you can redistribute it and/or modify               #
5 # it under the terms of the GNU General Public License as published by        #
6 # the Free Software Foundation; either version 2 of the License, or           #
7 # (at your option) any later version.                                         #
8 #                                                                             #
9 # IPCop is distributed in the hope that it will be useful,                    #
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
12 # GNU General Public License for more details.                                #
13 #                                                                             #
14 # You should have received a copy of the GNU General Public License           #
15 # along with IPCop; if not, write to the Free Software                        #
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
17 #                                                                             #
18 # Makefiles are based on LFSMake, which is                                    #
19 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
20 #                                                                             #
21 ###############################################################################
22
23 ###############################################################################
24 # Definitions
25 ###############################################################################
26
27 include Config
28
29 VER        = 2.2.2
30
31 THISAPP    = httpd-$(VER)
32 DL_FILE    = $(THISAPP).tar.bz2
33 DL_FROM    = $(URL_IPFIRE)
34 DIR_APP    = $(DIR_SRC)/$(THISAPP)
35 ifeq "$(PASS)" "CONFIG"
36         TARGET     = $(DIR_INFO)/$(THISAPP)-config
37 else
38         TARGET     = $(DIR_INFO)/$(THISAPP)
39 endif
40
41 ###############################################################################
42 # Top-level Rules
43 ###############################################################################
44
45 objects = $(DL_FILE) \
46         httpd-2.2.2-config-1.patch
47
48 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
49 httpd-2.2.2-config-1.patch = $(DL_FROM)/httpd-2.2.2-config-1.patch
50
51 $(DL_FILE)_MD5 = 9c759a9744436de6a6aa2ddbc49d6e81
52 httpd-2.2.2-config-1.patch_MD5 = e02a3ec5925eb9e111400b9aa229f822
53
54 install : $(TARGET)
55
56 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
57
58 download :$(patsubst %,$(DIR_DL)/%,$(objects))
59
60 md5 : $(subst %,%_MD5,$(objects))
61
62 ###############################################################################
63 # Downloading, checking, md5sum
64 ###############################################################################
65
66 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
67         @$(CHECK)
68
69 $(patsubst %,$(DIR_DL)/%,$(objects)) :
70         @$(LOAD)
71
72 $(subst %,%_MD5,$(objects)) :
73         @$(MD5)
74
75 ###############################################################################
76 # Installation Details
77 ###############################################################################
78
79 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
80         @$(PREBUILD)
81 ifeq "$(PASS)" "CONFIG"
82         # DO THIS IN AN EXTRA STEP BECAUSE PHP AND SUBVERSION WILL FAIL.
83
84         cp -rf $(DIR_CONF)/httpd/* /etc/httpd/conf
85         ln -sf $(CONFIG_ROOT)/main/hostname.conf /etc/httpd/conf/
86         -find /etc/httpd/conf -name .svn -exec rm -rf {} \;
87
88         # Copy all html/cgi-bin files
89         mkdir -p /home/httpd/{cgi-bin,html}
90         cp -aR $(DIR_SRC)/html/* /home/httpd
91         -find /home/httpd -name .svn -exec rm -rf {} \;
92         cp $(DIR_DL)/sflogo.png /home/httpd/html/images/
93
94         # Change CONFIG_ROOT in cgi-scripts
95         for i in /home/httpd/cgi-bin/{*,logs.cgi/*,vpn.cgi/*}; do \
96             if [ -f $$i ]; then \
97                 sed -i "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i; \
98             fi; \
99         done
100         chown -R root:root /home/httpd
101         chmod -R 755 /home/httpd/cgi-bin
102         chmod -R 644 /home/httpd/html
103         chmod 755 /home/httpd/html /home/httpd/html/{index.cgi,redirect.cgi,dial.cgi,images,include}
104 else
105         @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
106         cd $(DIR_APP) && patch -Np1 -i $(DIR_DL)/httpd-2.2.2-config-1.patch
107
108         ### Add IPFire's layout, too
109         echo "# IPFire layout" >> $(DIR_APP)/config.layout
110         echo "<Layout IPFire>" >> $(DIR_APP)/config.layout
111         echo "    prefix:             /usr" >> $(DIR_APP)/config.layout
112         echo "    exec_prefix:        /usr" >> $(DIR_APP)/config.layout
113         echo "    bindir:             /usr/bin" >> $(DIR_APP)/config.layout
114         echo "    sbindir:            /usr/sbin" >> $(DIR_APP)/config.layout
115         echo "    libdir:             /usr/lib" >> $(DIR_APP)/config.layout
116         echo "    libexecdir:         /usr/lib/apache" >> $(DIR_APP)/config.layout
117         echo "    mandir:             /usr/share/man" >> $(DIR_APP)/config.layout
118         echo "    sysconfdir:         /etc/httpd/conf" >> $(DIR_APP)/config.layout
119         echo "    datadir:            /home/httpd" >> $(DIR_APP)/config.layout
120         echo "    installbuilddir:    /usr/lib/apache/build" >> $(DIR_APP)/config.layout
121         echo "    errordir:           /home/httpd/error" >> $(DIR_APP)/config.layout
122         echo "    iconsdir:           /home/httpd/icons" >> $(DIR_APP)/config.layout
123         echo "    htdocsdir:          /home/httpd/htdocs" >> $(DIR_APP)/config.layout
124         echo "    manualdir:          /home/httpd/manual" >> $(DIR_APP)/config.layout
125         echo "    cgidir:             /home/httpd/cgi-bin" >> $(DIR_APP)/config.layout
126         echo "    includedir:         /usr/include/apache" >> $(DIR_APP)/config.layout
127         echo "    localstatedir:      /home/httpd" >> $(DIR_APP)/config.layout
128         echo "    runtimedir:         /var/run" >> $(DIR_APP)/config.layout
129         echo "    logfiledir:         /var/log/httpd" >> $(DIR_APP)/config.layout
130         echo "    proxycachedir:      /var/cache/apache/proxy" >> $(DIR_APP)/config.layout
131         echo "</Layout>" >> $(DIR_APP)/config.layout
132
133         cd $(DIR_APP) && ./configure --enable-layout=IPFire \
134                                 --enable-ssl --enable-mods-shared=all
135         cd $(DIR_APP) && make
136         cd $(DIR_APP) && make install
137         chown -v root:root /usr/lib/apache/httpd.exp \
138             /usr/sbin/{apxs,apachectl,dbmmanage,envvars{,-std}} \
139             /usr/share/man/man1/{dbmmanage,ht{dbm,digest,passwd}}.1 \
140             /usr/share/man/man8/{ab,apachectl,apxs,htcacheclean,httpd}.8 \
141             /usr/share/man/man8/{logresolve,rotatelogs,suexec}.8
142         @rm -rf $(DIR_APP)
143 endif
144         @$(POSTBUILD)