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