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