2e6d29a58496945c94da155d6e1ff1a957b292db
[packages.git] / net / apache / Makefile
1 #
2 # Copyright (C) 2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$ 
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=apache
12 PKG_VERSION:=2.2.6
13 PKG_RELEASE:=2
14 PKG_SOURCE_NAME:=httpd
15
16 PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://ftp.uni-erlangen.de/pub/mirrors/apache/httpd/ \
18                 http://apache.imsam.info/httpd/
19 PKG_MD5SUM:=d050a49bd7532ec21c6bb593b3473a5d
20 PKG_CAT:=zcat
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/apache/Default
28   SECTION:=net
29   CATEGORY:=Network
30   SUBMENU:=Web
31   TITLE:=The Apache Web Server
32   URL:=http://httpd.apache.org/
33 endef
34
35 define Package/apache
36   $(call Package/apache/Default)
37   MENU=1
38   DEPENDS:=+libapr +libaprutil +zlib +libexpat +libpcre +libopenssl +libsqlite3
39 endef
40
41 define Package/apache-server
42   $(call Package/apache/Default)
43   TITLE:=The apache server & and some tools
44   DEPENDS:=apache
45   DESCRIPTION:=\
46         Take care that you don't include apache at the moment into your image\\\
47         please select it only as module because busybox will override\\\
48         /usr/sbin/httpd. It'll be solved soon. If you need to include this\\\
49         package in the image anyway, remove httpd from busybox\\\
50         (Base system --> Configuration --> Networking Utilities --> httpd).\\\
51         Also you should take care for the initscripts, apache's httpd isn't\\\
52         compatible with the one from busybox, so if you want to use apache\\\
53         for running your webif, you'll need to change the parameters in the\\\
54         scripts and configure the rest in /etc/httpd.conf.
55 endef
56
57 define Package/apache-server/conffiles
58 /etc/apache/httpd.conf
59 /etc/apache/extra/httpd-autoindex.conf
60 /etc/apache/extra/httpd-dav.conf
61 /etc/apache/extra/httpd-default.conf
62 /etc/apache/extra/httpd-info.conf
63 /etc/apache/extra/httpd-languages.conf
64 /etc/apache/extra/httpd-manual.conf
65 /etc/apache/extra/httpd-mpm.conf
66 /etc/apache/extra/httpd-multilang-errordoc.conf
67 /etc/apache/extra/httpd-ssl.conf
68 /etc/apache/extra/httpd-userdir.conf
69 /etc/apache/extra/httpd-vhosts.conf
70 /etc/apache/magic
71 /etc/apache/mime.types
72 endef
73
74 define Package/apache-icons
75   $(call Package/apache/Default)
76   TITLE:=Icons from Apache
77   DEPENDS:=apache
78 endef
79
80 define Build/Configure  
81         $(call Build/Configure/Default, \
82                 --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \
83                 --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \
84                 --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \
85                 --enable-http \
86                 --enable-ssl \
87                 --enable-proxy \
88                 --disable-disk-cache \
89                 --enable-maintainer-mode \
90                 --enable-mime-magic \
91                 --without-suexec-bin \
92                 --sysconfdir=/etc/apache \
93                 ap_void_ptr_lt_long=no \
94                 logfiledir="/var/log" \
95         )
96 endef
97
98 define Build/Compile    
99         $(MAKE) -C $(PKG_BUILD_DIR) \
100                 DESTDIR="$(PKG_INSTALL_DIR)" \
101                 all install
102 endef
103
104 define Build/InstallDev
105         rm -rf  $(PKG_INSTALL_DIR)/usr/man/ \
106                 $(PKG_INSTALL_DIR)/usr/share/manual/
107         # if you need docs take a look into the build-dir :)
108         mkdir -p $(1)/etc
109         $(CP)   $(PKG_INSTALL_DIR)/etc/* \
110                 $(1)/etc
111         mkdir -p $(1)/usr/include
112         $(CP)   $(PKG_INSTALL_DIR)/usr/include/* \
113                 $(1)/usr/include
114         mkdir -p $(1)/usr/lib
115         $(CP)   $(PKG_INSTALL_DIR)/usr/lib/httpd.exp \
116                 $(1)/usr/lib
117         mkdir -p $(1)/usr/sbin
118         $(CP)   $(PKG_INSTALL_DIR)/usr/sbin/* \
119                 $(1)/usr/sbin
120         mkdir -p $(1)/usr/share
121         $(CP)   $(PKG_INSTALL_DIR)/usr/share/* \
122                 $(1)/usr/share
123 endef
124
125 define Build/UninstallDev
126         rm -rf  $(STAGING_DIR)/usr/include/{ap_*,http*,mod_*,mpm*,os.h,scoreboard.h,unixd.h,util_*} \
127                 $(STAGING_DIR)/etc/{httpd.conf,magic,mime.types,extra,original} \
128                 $(STAGING_DIR)/usr/sbin/{ab,apachectl,apxs,checkgid,dbmmanage,envvars,envvars-std,htcacheclean,htdbm,htdigest,htpasswd,httpd,httxt2dbm,logresolve,rotatelogs} \
129                 $(STAGING_DIR)/usr/share/{error,icons,htdocs,cgi-bin,build} \
130                 $(STAGING_DIR)/usr/lib/httpd.exp
131 endef
132
133 define Package/apache-server/preinst
134         rm /usr/sbin/httpd
135         echo -e "You should take a look in the initscripts, busybox's httpd \n\
136         uses some parameters which are maybe unsupported by apache."
137 endef
138
139 define Package/apache-server/install
140         $(INSTALL_DIR) $(1)/usr/sbin
141         # we don't need apxs on the router, it's just for building apache modules.  
142         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/{ab,apachectl,checkgid,dbmmanage,envvars,envvars-std,htcacheclean,htdbm,htdigest,htpasswd,httpd,httxt2dbm,logresolve,rotatelogs} $(1)/usr/sbin/
143         $(INSTALL_DIR) $(1)/usr/lib
144         $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp $(1)/usr/lib/
145         $(INSTALL_DIR) $(1)/usr/share
146         $(CP) $(PKG_INSTALL_DIR)/usr/share/{error,htdocs,cgi-bin,build} $(1)/usr/share/
147         $(INSTALL_DIR) $(1)/etc/apache
148         $(CP) $(PKG_INSTALL_DIR)/etc/apache/{magic,mime.types,extra} $(1)/etc/apache/
149         $(CP) ./files/etc/apache/httpd.conf $(1)/etc/apache/
150 endef
151
152 define Package/apache-server/postrm
153         rm -rf /usr/sbin/httpd
154         ln -s /bin/busybox /usr/sbin/httpd
155         echo -e "You may need to change your initscripts back for the use \n\
156                 with busybox's httpd."
157 endef
158
159 define Package/apache-icons/install
160         $(INSTALL_DIR) $(1)/usr/share
161         $(CP) $(PKG_INSTALL_DIR)/usr/share/icons $(1)/usr/share/
162 endef
163
164 $(eval $(call BuildPackage,apache))
165 $(eval $(call BuildPackage,apache-server))
166 $(eval $(call BuildPackage,apache-icons))