netifd: add a dependency on jshn
[openwrt/openwrt.git] / package / uhttpd / Makefile
1 #
2 # Copyright (C) 2010-2011 Jo-Philipp Wich <xm@subsignal.org>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=uhttpd
11 PKG_RELEASE:=27
12
13 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
14 PKG_CONFIG_DEPENDS := \
15 CONFIG_PACKAGE_uhttpd-mod-lua \
16 CONFIG_PACKAGE_uhttpd-mod-tls \
17 CONFIG_PACKAGE_uhttpd-mod-tls_cyassl \
18 CONFIG_PACKAGE_uhttpd-mod-tls_openssl
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/uhttpd/default
23 SECTION:=net
24 CATEGORY:=Network
25 SUBMENU:=Web Servers/Proxies
26 TITLE:=uHTTPd - tiny, single threaded HTTP server
27 MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
28 endef
29
30 define Package/uhttpd
31 $(Package/uhttpd/default)
32 MENU:=1
33 endef
34
35 define Package/uhttpd/description
36 uHTTPd is a tiny single threaded HTTP server with TLS, CGI and Lua
37 support. It is intended as a drop-in replacement for the Busybox
38 HTTP daemon.
39 endef
40
41
42 define Package/uhttpd-mod-tls
43 $(Package/uhttpd/default)
44 TITLE+= (TLS plugin)
45 DEPENDS:=uhttpd +PACKAGE_uhttpd-mod-tls_cyassl:libcyassl +PACKAGE_uhttpd-mod-tls_openssl:libopenssl
46 endef
47
48 define Package/uhttpd-mod-tls/description
49 The TLS plugin adds HTTPS support to uHTTPd.
50 endef
51
52 define Package/uhttpd-mod-tls/config
53 choice
54 depends on PACKAGE_uhttpd-mod-tls
55 prompt "TLS Provider"
56 default PACKAGE_uhttpd-mod-tls_cyassl
57
58 config PACKAGE_uhttpd-mod-tls_cyassl
59 bool "CyaSSL"
60
61 config PACKAGE_uhttpd-mod-tls_openssl
62 bool "OpenSSL"
63 endchoice
64 endef
65
66 UHTTPD_TLS:=
67 TLS_CFLAGS:=
68
69 ifneq ($(CONFIG_PACKAGE_uhttpd-mod-tls_cyassl),)
70 UHTTPD_TLS:=cyassl
71 TLS_CFLAGS:=-I$(STAGING_DIR)/usr/include/cyassl
72 endif
73
74 ifneq ($(CONFIG_PACKAGE_uhttpd-mod-tls_openssl),)
75 UHTTPD_TLS:=openssl
76 endif
77
78
79 define Package/uhttpd-mod-lua
80 $(Package/uhttpd/default)
81 TITLE+= (Lua plugin)
82 DEPENDS:=uhttpd +liblua
83 endef
84
85 define Package/uhttpd-mod-lua/description
86 The Lua plugin adds a CGI-like Lua runtime interface to uHTTPd.
87 endef
88
89
90 TARGET_CFLAGS += $(TLS_CFLAGS)
91 MAKE_VARS += \
92 FPIC="$(FPIC)" \
93 LUA_SUPPORT="$(if $(CONFIG_PACKAGE_uhttpd-mod-lua),1)" \
94 TLS_SUPPORT="$(if $(CONFIG_PACKAGE_uhttpd-mod-tls),1)" \
95 UHTTPD_TLS="$(UHTTPD_TLS)"
96
97 define Build/Prepare
98 mkdir -p $(PKG_BUILD_DIR)
99 $(CP) ./src/* $(PKG_BUILD_DIR)/
100 endef
101
102 define Package/uhttpd/conffiles
103 /etc/config/uhttpd
104 /etc/uhttpd.crt
105 /etc/uhttpd.key
106 endef
107
108 define Package/uhttpd/install
109 $(INSTALL_DIR) $(1)/etc/init.d
110 $(INSTALL_BIN) ./files/uhttpd.init $(1)/etc/init.d/uhttpd
111 $(INSTALL_DIR) $(1)/etc/config
112 $(INSTALL_CONF) ./files/uhttpd.config $(1)/etc/config/uhttpd
113 $(INSTALL_DIR) $(1)/usr/sbin
114 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd
115 endef
116
117 define Package/uhttpd-mod-tls/install
118 $(INSTALL_DIR) $(1)/usr/lib
119 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_tls.so $(1)/usr/lib/
120 endef
121
122 define Package/uhttpd-mod-lua/install
123 $(INSTALL_DIR) $(1)/usr/lib
124 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_lua.so $(1)/usr/lib/
125 endef
126
127
128 $(eval $(call BuildPackage,uhttpd))
129 $(eval $(call BuildPackage,uhttpd-mod-tls))
130 $(eval $(call BuildPackage,uhttpd-mod-lua))