| 1 | # |
| 2 | # Copyright (C) 2010-2012 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:=40 |
| 12 | |
| 13 | PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) |
| 14 | PKG_CONFIG_DEPENDS := \ |
| 15 | CONFIG_PACKAGE_uhttpd_debug \ |
| 16 | CONFIG_PACKAGE_uhttpd-mod-lua \ |
| 17 | CONFIG_PACKAGE_uhttpd-mod-tls \ |
| 18 | CONFIG_PACKAGE_uhttpd-mod-tls_cyassl \ |
| 19 | CONFIG_PACKAGE_uhttpd-mod-tls_openssl \ |
| 20 | CONFIG_PACKAGE_uhttpd-mod-ubus |
| 21 | |
| 22 | include $(INCLUDE_DIR)/package.mk |
| 23 | |
| 24 | define Package/uhttpd/default |
| 25 | SECTION:=net |
| 26 | CATEGORY:=Network |
| 27 | SUBMENU:=Web Servers/Proxies |
| 28 | TITLE:=uHTTPd - tiny, single threaded HTTP server |
| 29 | MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org> |
| 30 | endef |
| 31 | |
| 32 | define Package/uhttpd |
| 33 | $(Package/uhttpd/default) |
| 34 | DEPENDS:=+libubox |
| 35 | endef |
| 36 | |
| 37 | define Package/uhttpd/description |
| 38 | uHTTPd is a tiny single threaded HTTP server with TLS, CGI and Lua |
| 39 | support. It is intended as a drop-in replacement for the Busybox |
| 40 | HTTP daemon. |
| 41 | endef |
| 42 | |
| 43 | define Package/uhttpd/config |
| 44 | config PACKAGE_uhttpd_debug |
| 45 | bool "Build with debug messages" |
| 46 | default n |
| 47 | endef |
| 48 | |
| 49 | |
| 50 | define Package/uhttpd-mod-tls |
| 51 | $(Package/uhttpd/default) |
| 52 | TITLE+= (TLS plugin) |
| 53 | DEPENDS:=uhttpd +PACKAGE_uhttpd-mod-tls_cyassl:libcyassl +PACKAGE_uhttpd-mod-tls_openssl:libopenssl |
| 54 | endef |
| 55 | |
| 56 | define Package/uhttpd-mod-tls/description |
| 57 | The TLS plugin adds HTTPS support to uHTTPd. |
| 58 | endef |
| 59 | |
| 60 | define Package/uhttpd-mod-tls/config |
| 61 | choice |
| 62 | depends on PACKAGE_uhttpd-mod-tls |
| 63 | prompt "TLS Provider" |
| 64 | default PACKAGE_uhttpd-mod-tls_cyassl |
| 65 | |
| 66 | config PACKAGE_uhttpd-mod-tls_cyassl |
| 67 | bool "CyaSSL" |
| 68 | |
| 69 | config PACKAGE_uhttpd-mod-tls_openssl |
| 70 | bool "OpenSSL" |
| 71 | endchoice |
| 72 | endef |
| 73 | |
| 74 | UHTTPD_TLS:= |
| 75 | TLS_CFLAGS:= |
| 76 | TLS_LDFLAGS:= |
| 77 | |
| 78 | ifneq ($(CONFIG_PACKAGE_uhttpd-mod-tls_cyassl),) |
| 79 | UHTTPD_TLS:=cyassl |
| 80 | TLS_CFLAGS:=-I$(STAGING_DIR)/usr/include/cyassl -DTLS_IS_CYASSL |
| 81 | TLS_LDFLAGS:=-lcyassl -lm |
| 82 | endif |
| 83 | |
| 84 | ifneq ($(CONFIG_PACKAGE_uhttpd-mod-tls_openssl),) |
| 85 | UHTTPD_TLS:=openssl |
| 86 | TLS_CFLAGS:=-DTLS_IS_OPENSSL |
| 87 | TLS_LDFLAGS:=-lssl |
| 88 | endif |
| 89 | |
| 90 | |
| 91 | define Package/uhttpd-mod-lua |
| 92 | $(Package/uhttpd/default) |
| 93 | TITLE+= (Lua plugin) |
| 94 | DEPENDS:=uhttpd +liblua |
| 95 | endef |
| 96 | |
| 97 | define Package/uhttpd-mod-lua/description |
| 98 | The Lua plugin adds a CGI-like Lua runtime interface to uHTTPd. |
| 99 | endef |
| 100 | |
| 101 | |
| 102 | define Package/uhttpd-mod-ubus |
| 103 | $(Package/uhttpd/default) |
| 104 | TITLE+= (ubus plugin) |
| 105 | DEPENDS:=uhttpd +libubus +libblobmsg-json |
| 106 | endef |
| 107 | |
| 108 | define Package/uhttpd-mod-ubus/description |
| 109 | The ubus plugin adds a HTTP/JSON RPC proxy for ubus and publishes the |
| 110 | session.* namespace and procedures. |
| 111 | endef |
| 112 | |
| 113 | |
| 114 | TARGET_CFLAGS += $(TLS_CFLAGS) $(if $(CONFIG_PACKAGE_uhttpd_debug),-DDEBUG) -ggdb3 |
| 115 | TARGET_LDFLAGS += -lubox -Wl,-rpath-link=$(STAGING_DIR)/usr/lib |
| 116 | MAKE_VARS += \ |
| 117 | FPIC="$(FPIC)" \ |
| 118 | LUA_SUPPORT="$(if $(CONFIG_PACKAGE_uhttpd-mod-lua),1)" \ |
| 119 | TLS_SUPPORT="$(if $(CONFIG_PACKAGE_uhttpd-mod-tls),1)" \ |
| 120 | UBUS_SUPPORT="$(if $(CONFIG_PACKAGE_uhttpd-mod-ubus),1)" \ |
| 121 | UHTTPD_TLS="$(UHTTPD_TLS)" \ |
| 122 | TLS_CFLAGS="$(TLS_CFLAGS)" \ |
| 123 | TLS_LDFLAGS="$(TLS_LDFLAGS)" |
| 124 | |
| 125 | define Build/Prepare |
| 126 | mkdir -p $(PKG_BUILD_DIR) |
| 127 | $(CP) ./src/* $(PKG_BUILD_DIR)/ |
| 128 | endef |
| 129 | |
| 130 | define Package/uhttpd/conffiles |
| 131 | /etc/config/uhttpd |
| 132 | /etc/uhttpd.crt |
| 133 | /etc/uhttpd.key |
| 134 | endef |
| 135 | |
| 136 | define Package/uhttpd/install |
| 137 | $(INSTALL_DIR) $(1)/etc/init.d |
| 138 | $(INSTALL_BIN) ./files/uhttpd.init $(1)/etc/init.d/uhttpd |
| 139 | $(INSTALL_DIR) $(1)/etc/config |
| 140 | $(INSTALL_CONF) ./files/uhttpd.config $(1)/etc/config/uhttpd |
| 141 | $(INSTALL_DIR) $(1)/usr/sbin |
| 142 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd |
| 143 | endef |
| 144 | |
| 145 | define Package/uhttpd-mod-tls/install |
| 146 | $(INSTALL_DIR) $(1)/usr/lib |
| 147 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_tls.so $(1)/usr/lib/ |
| 148 | endef |
| 149 | |
| 150 | define Package/uhttpd-mod-lua/install |
| 151 | $(INSTALL_DIR) $(1)/usr/lib |
| 152 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_lua.so $(1)/usr/lib/ |
| 153 | endef |
| 154 | |
| 155 | define Package/uhttpd-mod-ubus/install |
| 156 | $(INSTALL_DIR) $(1)/usr/lib |
| 157 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_ubus.so $(1)/usr/lib/ |
| 158 | endef |
| 159 | |
| 160 | |
| 161 | $(eval $(call BuildPackage,uhttpd)) |
| 162 | $(eval $(call BuildPackage,uhttpd-mod-tls)) |
| 163 | $(eval $(call BuildPackage,uhttpd-mod-lua)) |
| 164 | $(eval $(call BuildPackage,uhttpd-mod-ubus)) |
| 165 | |