2013-05-02 16:29:29 +02:00
|
|
|
|
##############################################
|
|
|
|
|
# OpenWrt Makefile for Doodle3D WifiBox firmware
|
|
|
|
|
##############################################
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
2013-05-14 15:09:56 +02:00
|
|
|
|
#NOTE: this hack is required to get files included inside a define block, see this link:
|
|
|
|
|
#http://stackoverflow.com/questions/3524726/how-to-make-eval-shell-work-in-gnu-make
|
|
|
|
|
#The '<27>' character must not appear in included scripts.
|
|
|
|
|
define newline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
IncludeWithNewlines = $(subst <20>,$(newline),$(shell cat $1 | tr '\n' '<27>'))
|
|
|
|
|
|
|
|
|
|
|
2013-05-02 16:29:29 +02:00
|
|
|
|
# Name and release number of this package
|
2013-05-14 17:26:21 +02:00
|
|
|
|
PKG_NAME := wifibox
|
2013-12-06 15:10:07 +01:00
|
|
|
|
PKG_VERSION := 0.1.1
|
2013-12-12 14:08:22 +01:00
|
|
|
|
PKG_RELEASE := 8
|
2013-05-02 16:29:29 +02:00
|
|
|
|
|
|
|
|
|
# This specifies the directory where we're going to build the program.
|
|
|
|
|
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
|
|
|
|
|
# directory in your OpenWrt SDK directory
|
|
|
|
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
|
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
|
|
|
|
|
define Package/wifibox
|
|
|
|
|
SECTION:=mods
|
2013-08-26 09:53:58 +02:00
|
|
|
|
CATEGORY:=Doodle3D
|
2013-05-02 16:29:29 +02:00
|
|
|
|
MENU:=1
|
|
|
|
|
# DEFAULT:=y
|
|
|
|
|
TITLE:=Doodle3D WifiBox firmware
|
|
|
|
|
URL:=http://www.doodle3d.com/wifibox
|
2013-10-22 18:32:53 +02:00
|
|
|
|
DEPENDS:=+lua +luafilesystem +libuci-lua +libiwinfo-lua +uhttpd +uhttpd-mod-lua +doodle3d-client +print3d
|
2013-05-02 16:29:29 +02:00
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Package/wifibox/description
|
|
|
|
|
Doodle3D WifiBox firmware
|
|
|
|
|
Web interface to draw doodles and print them with ease.
|
|
|
|
|
Automatically connects to known network or provide one to connect with.
|
|
|
|
|
Intended to be used on TP-Link WR703n or MR3020.
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Package/wifibox/config
|
|
|
|
|
source "$(SOURCE)/Config.in"
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# Specify what needs to be done to prepare for building the package.
|
|
|
|
|
# In our case, we need to copy the source files to the build directory.
|
|
|
|
|
# This is NOT the default. The default uses the PKG_SOURCE_URL and the
|
|
|
|
|
# PKG_SOURCE which is not defined here to download the source from the web.
|
|
|
|
|
# In order to just build a simple program that we have just written, it is
|
|
|
|
|
# much easier to do it this way.
|
|
|
|
|
define Build/Prepare
|
|
|
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
|
|
|
$(CP) -r ./src/* $(PKG_BUILD_DIR)/
|
2013-12-12 14:08:22 +01:00
|
|
|
|
$(CP) -r ./ReleaseNotes.md $(PKG_BUILD_DIR)/
|
2013-05-02 16:29:29 +02:00
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/Configure
|
|
|
|
|
# no configuration necessary
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/Compile directives
|
|
|
|
|
# no compilation necessary (although possible with luac?)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# The $(1) variable represents the root directory on the router running
|
|
|
|
|
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
|
|
|
|
|
# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the
|
|
|
|
|
# command to copy the binary file from its current location (in our case the build
|
|
|
|
|
# directory) to the install directory.
|
2013-05-14 16:09:01 +02:00
|
|
|
|
|
2013-06-30 19:06:55 +02:00
|
|
|
|
WIFIBOX_BASE_DIR := $(PKG_BUILD_DIR)
|
|
|
|
|
TGT_LUA_DIR_SUFFIX := usr/share/lua/wifibox
|
2013-05-14 16:09:01 +02:00
|
|
|
|
|
2013-05-02 16:29:29 +02:00
|
|
|
|
define Package/wifibox/install
|
2013-05-14 16:09:01 +02:00
|
|
|
|
### create required directories (autowifi)
|
2013-05-02 16:29:29 +02:00
|
|
|
|
|
2013-06-30 19:06:55 +02:00
|
|
|
|
# $(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)
|
|
|
|
|
$(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)/network
|
2013-07-12 17:26:12 +02:00
|
|
|
|
# $(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)/rest
|
|
|
|
|
$(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)/rest/api
|
2013-06-30 19:06:55 +02:00
|
|
|
|
$(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)/script
|
|
|
|
|
$(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)/util
|
2013-10-17 21:45:23 +02:00
|
|
|
|
$(INSTALL_DIR) $(1)/bin
|
|
|
|
|
#$(INSTALL_DIR) $(1)/etc
|
2013-05-14 17:26:21 +02:00
|
|
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
2013-08-22 18:34:45 +02:00
|
|
|
|
$(INSTALL_DIR) $(1)/etc/config
|
2013-12-12 14:08:22 +01:00
|
|
|
|
#$(INSTALL_DIR) $(1)/www
|
2013-05-02 16:29:29 +02:00
|
|
|
|
$(INSTALL_DIR) $(1)/www/cgi-bin
|
|
|
|
|
|
2013-05-14 16:09:01 +02:00
|
|
|
|
### create all files in /usr/share/lua/autowifi (autowifi)
|
2013-05-02 16:29:29 +02:00
|
|
|
|
|
2013-07-26 01:12:00 +02:00
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/opkg.conf $(1)/$(TGT_LUA_DIR_SUFFIX)/
|
2013-06-30 19:06:55 +02:00
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/*.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/
|
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/network/*.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/network/
|
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/rest/*.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/rest/
|
2013-07-12 17:26:12 +02:00
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/rest/api/*.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/rest/api/
|
2013-06-30 19:06:55 +02:00
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/util/*.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/util/
|
2013-05-02 16:29:29 +02:00
|
|
|
|
|
2013-10-17 21:45:23 +02:00
|
|
|
|
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3d-updater.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/script
|
2013-10-18 16:02:22 +02:00
|
|
|
|
$(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/d3d-updater.lua $(1)/bin/d3d-updater
|
2013-11-29 21:14:59 +01:00
|
|
|
|
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifibox_init $(1)/etc/init.d/wifibox
|
|
|
|
|
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/dhcpcheck_init $(1)/etc/init.d/dhcpcheck
|
2013-07-26 01:12:00 +02:00
|
|
|
|
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3dapi $(1)/$(TGT_LUA_DIR_SUFFIX)/script
|
2013-09-27 18:38:31 +02:00
|
|
|
|
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/signin.sh $(1)/$(TGT_LUA_DIR_SUFFIX)/script
|
2013-08-22 18:34:45 +02:00
|
|
|
|
|
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/script/wifibox.uci.config $(1)/etc/config/wifibox # copy base configuration to uci config dir
|
2013-10-17 21:45:23 +02:00
|
|
|
|
$(CP) $(WIFIBOX_BASE_DIR)/FIRMWARE-VERSION $(1)/etc/wifibox-version
|
2013-12-12 14:08:22 +01:00
|
|
|
|
|
|
|
|
|
echo "<html><body><pre><code>" > $(1)/www/ReleaseNotes.html
|
|
|
|
|
cat $(WIFIBOX_BASE_DIR)/ReleaseNotes.md >> $(1)/www/ReleaseNotes.html
|
|
|
|
|
echo "</code></pre></body></html>" >> $(1)/www/ReleaseNotes.html
|
2013-10-17 21:45:23 +02:00
|
|
|
|
|
2013-05-02 16:29:29 +02:00
|
|
|
|
ifeq ($(CONFIG_WIFIBOX_DEVEL_PACKAGE),y)
|
2013-10-22 22:44:51 +02:00
|
|
|
|
# $(INSTALL_DIR) $(1)/$(TGT_LUA_DIR_SUFFIX)/test
|
|
|
|
|
# $(CP) $(WIFIBOX_BASE_DIR)/test/* $(1)/$(TGT_LUA_DIR_SUFFIX)/test/
|
2013-10-22 18:32:53 +02:00
|
|
|
|
# $(LN) -s /$(TGT_LUA_DIR_SUFFIX)/test $(1)/www/
|
2013-05-02 16:29:29 +02:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
2013-05-14 16:09:01 +02:00
|
|
|
|
### create links elsewhere in the system (autowifi)
|
2013-06-30 19:06:55 +02:00
|
|
|
|
$(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/d3dapi $(1)/www/cgi-bin
|
2013-10-30 20:20:29 +01:00
|
|
|
|
$(LN) -s /root/sketches $(1)/www/
|
2013-05-02 16:29:29 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2013-05-03 01:09:46 +02:00
|
|
|
|
define Package/wifibox/postinst
|
2013-05-14 15:09:56 +02:00
|
|
|
|
$(call IncludeWithNewlines,post-install.sh)
|
2013-05-03 01:09:46 +02:00
|
|
|
|
endef
|
|
|
|
|
|
2013-05-14 17:26:21 +02:00
|
|
|
|
define Package/wifibox/prerm
|
|
|
|
|
$(call IncludeWithNewlines,pre-remove.sh)
|
|
|
|
|
endef
|
|
|
|
|
|
2013-05-14 15:09:56 +02:00
|
|
|
|
define Package/wifibox/postrm
|
|
|
|
|
$(call IncludeWithNewlines,post-remove.sh)
|
|
|
|
|
endef
|
2013-05-02 16:29:29 +02:00
|
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,wifibox))
|