From: Florian Fainelli Date: Mon, 5 May 2014 19:31:06 +0000 (+0000) Subject: haserl: uptate to 0.9.32, add optional lua support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5bf93bcaa5c4b47729404e878c48e72ac0a04fee;p=openwrt%2Fsvn-archive%2Fpackages.git haserl: uptate to 0.9.32, add optional lua support This patch updates haserl to version 0.9.32 and introduces optional lua support See http://haserl.sourceforge.net/manpage.html#lbAM Note: to implement lua support I had to change build process slightly to get rid of host precompilation of lua script. I decided to patch existing Makefile.in instead of patching Makefile.am and regenerating everything from scratch. If this approach is wrong and it's better to patch Makefile.am, please let me know. Signed-off-by: Maxim Storchak [florian: fix missing quote after source] Signed-off-by: Florian Fainelli SVN-Revision: 40702 --- diff --git a/utils/haserl/Config.in b/utils/haserl/Config.in new file mode 100644 index 000000000..e5fb90dba --- /dev/null +++ b/utils/haserl/Config.in @@ -0,0 +1,35 @@ +if PACKAGE_haserl + + config HASERL_with_lua + bool + default n + + comment "Lua support" + + config HASERL_shell_luac + bool + prompt "Support --shell=luac" + select HASERL_with_lua + default n + help + haserl(1): + The luac "shell" is a precompiled lua chunk, so interactive + editing and testing of scripts is not possible. However, + haserl can be compiled with luac support only, and this + allows lua support even in a small memory environment. All + haserl lua features listed above are still available. (If + luac is the only shell built into haserl, the + haserl.loadfile is disabled, as the haserl parser is not + compiled in.) + + config HASERL_shell_lua + bool + prompt "Support --shell=lua" + select HASERL_with_lua + default n + help + haserl(1): + If compiled with lua support, --shell=lua will enable lua as the + script language instead of bash shell. + +endif diff --git a/utils/haserl/Makefile b/utils/haserl/Makefile index 4d7164f38..607db28ae 100644 --- a/utils/haserl/Makefile +++ b/utils/haserl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=haserl -PKG_VERSION:=0.9.29 +PKG_VERSION:=0.9.32 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/haserl -PKG_MD5SUM:=4cac9409530200b4a7a82a48ec174800 +PKG_MD5SUM:=18e2208aea6d772d1670c1a648bb6b77 include $(INCLUDE_DIR)/package.mk @@ -22,8 +22,25 @@ define Package/haserl CATEGORY:=Utilities TITLE:=A CGI wrapper to embed shell scripts in HTML documents URL:=http://haserl.sourceforge.net/ + MENU:=1 + DEPENDS:= +HASERL_with_lua:liblua endef +define Package/haserl/config + source "$(SOURCE)/Config.in" +endef + +ifeq ($(CONFIG_HASERL_with_lua),y) + CONFIGURE_ARGS+=--with-lua + TARGET_LDFLAGS += -ldl +endif +ifneq ($(CONFIG_HASERL_shell_lua),y) + CONFIGURE_ARGS+=--disable-luashell +endif +ifneq ($(CONFIG_HASERL_shell_luac),y) + CONFIGURE_ARGS+=--disable-luacshell +endif + define Package/haserl/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/haserl $(1)/usr/bin/ diff --git a/utils/haserl/patches/100-replace-lua2c-with-sed.patch b/utils/haserl/patches/100-replace-lua2c-with-sed.patch new file mode 100644 index 000000000..5b19fc1ec --- /dev/null +++ b/utils/haserl/patches/100-replace-lua2c-with-sed.patch @@ -0,0 +1,80 @@ +--- a/src/Makefile.in 2013-09-20 23:52:15.000000000 +0300 ++++ b/src/Makefile.in 2014-05-03 23:06:17.000000000 +0300 +@@ -76,7 +76,6 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : +-@USE_LUA_TRUE@noinst_PROGRAMS = lua2c$(EXEEXT) + @INCLUDE_LUASHELL_TRUE@@USE_LUA_TRUE@am__append_1 = h_lua.c h_lua.h + @INCLUDE_LUACSHELL_TRUE@@USE_LUA_TRUE@am__append_2 = h_luac.c h_luac.h + bin_PROGRAMS = haserl$(EXEEXT) +@@ -115,9 +114,6 @@ + haserl_DEPENDENCIES = $(am__DEPENDENCIES_1) + haserl_LINK = $(CCLD) $(haserl_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +-lua2c_SOURCES = lua2c.c +-lua2c_OBJECTS = lua2c.$(OBJEXT) +-lua2c_LDADD = $(LDADD) + AM_V_P = $(am__v_P_@AM_V@) + am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) + am__v_P_0 = false +@@ -150,8 +146,8 @@ + am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) + am__v_CCLD_0 = @echo " CCLD " $@; + am__v_CCLD_1 = +-SOURCES = $(haserl_SOURCES) $(nodist_haserl_SOURCES) lua2c.c +-DIST_SOURCES = $(am__haserl_SOURCES_DIST) lua2c.c ++SOURCES = $(haserl_SOURCES) $(nodist_haserl_SOURCES) ++DIST_SOURCES = $(am__haserl_SOURCES_DIST) + am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ +@@ -273,7 +269,7 @@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-EXTRA_DIST = haserl_lualib.lua lua2c.c ++EXTRA_DIST = haserl_lualib.lua + + # Not strictly required, but we explicitly do not distribute the generated inc file + nodist_haserl_SOURCES = haserl_lualib.inc +@@ -386,10 +382,6 @@ + @rm -f haserl$(EXEEXT) + $(AM_V_CCLD)$(haserl_LINK) $(haserl_OBJECTS) $(haserl_LDADD) $(LIBS) + +-@USE_LUA_FALSE@lua2c$(EXEEXT): $(lua2c_OBJECTS) $(lua2c_DEPENDENCIES) $(EXTRA_lua2c_DEPENDENCIES) +-@USE_LUA_FALSE@ @rm -f lua2c$(EXEEXT) +-@USE_LUA_FALSE@ $(AM_V_CCLD)$(LINK) $(lua2c_OBJECTS) $(lua2c_LDADD) $(LIBS) +- + mostlyclean-compile: + -rm -f *.$(OBJEXT) + +@@ -406,7 +398,6 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-haserl.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-rfc2388.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-sliding_buffer.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lua2c.Po@am__quote@ + + .c.o: + @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@@ -758,17 +749,13 @@ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + + +-# lua2c_LIBS ?= -llua -ldl -lm +-@USE_LUA_TRUE@lua2c_LDFLAGS ?= -Wl,-E +-@USE_LUA_TRUE@lua2c: lua2c.c +-@USE_LUA_TRUE@ $(CC_FOR_BUILD) $(CFLAGS) $(LUA_CFLAGS) $(LDFLAGS) $(lua2c_LDFLAGS) \ +-@USE_LUA_TRUE@ -o $@ $^ $(LIBS) $(LUA_LIBS) + +-@USE_LUA_TRUE@haserl_lualib.inc : haserl_lualib.lua lua2c +-@USE_LUA_TRUE@ if ! ./lua2c haserl_lualib haserl_lualib.lua >$@; then \ ++@USE_LUA_TRUE@haserl_lualib.inc : haserl_lualib.lua ++@USE_LUA_TRUE@ if ! sed -re '/--\[\[/,/\]\]--/d; s/[[:space:]]*--.*//g; s/^[[:space:]]*//g; /^$$/d; s/ (=+) /\1/g; s/,[[:space:]]*/,/g; s/ ([()])/\1/g; s/key/k/g; s/value/v/g; s/^/"/; s/$$/\\n"/' haserl_lualib.lua >$@.tmp; then \ + @USE_LUA_TRUE@ rm $@; \ + @USE_LUA_TRUE@ exit 1 ;\ + @USE_LUA_TRUE@ fi ++@USE_LUA_TRUE@ { echo "static const char haserl_lualib[] = "; cat $@.tmp; echo ";"; rm $@.tmp; } >$@ + + @USE_LUA_TRUE@h_lua_common.c : haserl_lualib.inc + diff --git a/utils/haserl/patches/101-adjust-script-size.patch b/utils/haserl/patches/101-adjust-script-size.patch new file mode 100644 index 000000000..a4b7d9a4d --- /dev/null +++ b/utils/haserl/patches/101-adjust-script-size.patch @@ -0,0 +1,11 @@ +--- a/src/h_lua_common.c 2013-09-20 23:35:19.000000000 +0300 ++++ b/src/h_lua_common.c 2014-05-03 19:27:43.000000000 +0300 +@@ -79,7 +79,7 @@ + + /* and load our haserl library */ + if (luaL_loadbuffer +- (lua_vm, (const char *) &haserl_lualib, sizeof (haserl_lualib), ++ (lua_vm, (const char *) haserl_lualib, sizeof(haserl_lualib)-1, + "luascript.lua") || lua_pcall (lua_vm, 0, 0, 0)) + { + die_with_message (NULL, NULL,