uhttpd: update to the latest version, adds a small json handler fix
[openwrt/staging/mkresin.git] / package / network / services / uhttpd / Makefile
1 #
2 # Copyright (C) 2010-2015 Jo-Philipp Wich <jo@mein.io>
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_VERSION:=2016-10-06
12 PKG_RELEASE=$(PKG_SOURCE_VERSION)
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL=$(LEDE_GIT)/project/uhttpd.git
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE_VERSION:=c0b5444b533e7177394ceaa247de4495307f72d6
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
19 PKG_MIRROR_MD5SUM:=24fbdd2a4e353668a64c9f729db74b3abdcfbbded6b63649696876ace455f252
20 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
21 PKG_LICENSE:=ISC
22
23 PKG_BUILD_DEPENDS = ustream-ssl
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/cmake.mk
27 include $(INCLUDE_DIR)/version.mk
28
29 define Package/uhttpd/default
30 SECTION:=net
31 CATEGORY:=Network
32 SUBMENU:=Web Servers/Proxies
33 TITLE:=uHTTPd - tiny, single threaded HTTP server
34 endef
35
36 define Package/uhttpd
37 $(Package/uhttpd/default)
38 DEPENDS:=+libubox +libblobmsg-json +libjson-script
39 endef
40
41 define Package/uhttpd/description
42 uHTTPd is a tiny single threaded HTTP server with TLS, CGI and Lua
43 support. It is intended as a drop-in replacement for the Busybox
44 HTTP daemon.
45 endef
46
47 define Package/uhttpd/config
48 config PACKAGE_uhttpd_debug
49 bool "Build with debug messages"
50 default n
51 endef
52
53
54 define Package/uhttpd-mod-tls
55 $(Package/uhttpd/default)
56 TITLE+= (TLS plugin)
57 DEPENDS:=uhttpd \
58 +PACKAGE_uhttpd-mod-tls_polarssl:libustream-polarssl \
59 +PACKAGE_uhttpd-mod-tls_mbedtls:libustream-mbedtls \
60 +PACKAGE_uhttpd-mod-tls_cyassl:libustream-cyassl \
61 +PACKAGE_uhttpd-mod-tls_openssl:libustream-openssl
62 endef
63
64 define Package/uhttpd-mod-tls/description
65 The TLS plugin adds HTTPS support to uHTTPd.
66 endef
67
68 define Package/uhttpd-mod-tls/config
69 choice
70 depends on PACKAGE_uhttpd-mod-tls
71 prompt "TLS Provider"
72 default PACKAGE_uhttpd-mod-tls_polarssl
73
74 config PACKAGE_uhttpd-mod-tls_mbedtls
75 bool "mbedTLS"
76
77 config PACKAGE_uhttpd-mod-tls_polarssl
78 bool "PolarSSL"
79
80 config PACKAGE_uhttpd-mod-tls_cyassl
81 bool "CyaSSL"
82
83 config PACKAGE_uhttpd-mod-tls_openssl
84 bool "OpenSSL"
85 endchoice
86 endef
87
88 define Package/uhttpd-mod-lua
89 $(Package/uhttpd/default)
90 TITLE+= (Lua plugin)
91 DEPENDS:=uhttpd +liblua
92 endef
93
94 define Package/uhttpd-mod-lua/description
95 The Lua plugin adds a CGI-like Lua runtime interface to uHTTPd.
96 endef
97
98
99 define Package/uhttpd-mod-ubus
100 $(Package/uhttpd/default)
101 TITLE+= (ubus plugin)
102 DEPENDS:=uhttpd +libubus +libblobmsg-json
103 endef
104
105 define Package/uhttpd-mod-ubus/description
106 The ubus plugin adds a HTTP/JSON RPC proxy for ubus and publishes the
107 session.* namespace and procedures.
108 endef
109
110 define Package/uhttpd/conffiles
111 /etc/config/uhttpd
112 /etc/uhttpd.crt
113 /etc/uhttpd.key
114 endef
115
116 ifneq ($(CONFIG_USE_GLIBC),)
117 TARGET_CFLAGS += -D_DEFAULT_SOURCE
118 endif
119
120 TARGET_LDFLAGS += -lcrypt
121
122 CMAKE_OPTIONS = -DTLS_SUPPORT=on
123
124 define Package/uhttpd/install
125 $(INSTALL_DIR) $(1)/etc/init.d
126 $(INSTALL_BIN) ./files/uhttpd.init $(1)/etc/init.d/uhttpd
127 $(INSTALL_DIR) $(1)/etc/config
128 $(INSTALL_CONF) ./files/uhttpd.config $(1)/etc/config/uhttpd
129 $(VERSION_SED_SCRIPT) $(1)/etc/config/uhttpd
130 $(INSTALL_DIR) $(1)/usr/sbin
131 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd
132 endef
133
134 define Package/uhttpd-mod-tls/install
135 true
136 endef
137
138 define Package/uhttpd-mod-lua/install
139 $(INSTALL_DIR) $(1)/usr/lib
140 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_lua.so $(1)/usr/lib/
141 endef
142
143 define Package/uhttpd-mod-ubus/install
144 $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/uci-defaults
145 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_ubus.so $(1)/usr/lib/
146 $(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus
147 endef
148
149
150 $(eval $(call BuildPackage,uhttpd))
151 $(eval $(call BuildPackage,uhttpd-mod-tls))
152 $(eval $(call BuildPackage,uhttpd-mod-lua))
153 $(eval $(call BuildPackage,uhttpd-mod-ubus))