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