Browse Source

haserl: import from packages, update to latest

Signed-off-by: Maxim Storchak <m.storchak@gmail.com>
Maxim Storchak 10 years ago
parent
commit
d6a642393f

+ 35
- 0
utils/haserl/Config.in View File

@@ -0,0 +1,35 @@
1
+if PACKAGE_haserl
2
+
3
+	config HASERL_with_lua
4
+		bool
5
+		default n
6
+
7
+	comment "Lua support"
8
+
9
+	config HASERL_shell_luac
10
+		bool
11
+		prompt "Support --shell=luac"
12
+		select HASERL_with_lua
13
+		default n
14
+		help
15
+			haserl(1):
16
+			The luac "shell" is a precompiled lua chunk, so interactive
17
+			editing and testing of scripts is not possible. However,
18
+			haserl can be compiled with luac support only, and this
19
+			allows lua support even in a small memory environment. All
20
+			haserl lua features listed above are still available. (If
21
+			luac is the only shell built into haserl, the
22
+			haserl.loadfile is disabled, as the haserl parser is not
23
+			compiled in.)
24
+
25
+	config HASERL_shell_lua
26
+		bool
27
+		prompt "Support --shell=lua"
28
+		select HASERL_with_lua
29
+		default n
30
+		help
31
+			haserl(1):
32
+			If compiled with lua support, --shell=lua will enable lua as the
33
+			script language instead of bash shell.
34
+
35
+endif

+ 50
- 0
utils/haserl/Makefile View File

@@ -0,0 +1,50 @@
1
+#
2
+# Copyright (C) 2006-2009 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:=haserl
11
+PKG_VERSION:=0.9.33
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=@SF/haserl
16
+PKG_MD5SUM:=a9decddb508944d56f71dd2f821e2ec5
17
+PKG_MAINTAINER:=Maxim Storchak <m.storchak@gmail.com>
18
+
19
+include $(INCLUDE_DIR)/package.mk
20
+
21
+define Package/haserl
22
+  SECTION:=utils
23
+  CATEGORY:=Utilities
24
+  TITLE:=A CGI wrapper to embed shell scripts in HTML documents
25
+  URL:=http://haserl.sourceforge.net/
26
+  MENU:=1
27
+  DEPENDS:= +HASERL_with_lua:liblua
28
+endef
29
+
30
+define Package/haserl/config
31
+	source "$(SOURCE)/Config.in"
32
+endef
33
+
34
+ifeq ($(CONFIG_HASERL_with_lua),y)
35
+	CONFIGURE_ARGS+=--with-lua
36
+	TARGET_LDFLAGS += -ldl
37
+endif
38
+ifneq ($(CONFIG_HASERL_shell_lua),y)
39
+	CONFIGURE_ARGS+=--disable-luashell
40
+endif
41
+ifneq ($(CONFIG_HASERL_shell_luac),y)
42
+	CONFIGURE_ARGS+=--disable-luacshell
43
+endif
44
+
45
+define Package/haserl/install
46
+	$(INSTALL_DIR) $(1)/usr/bin
47
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/haserl $(1)/usr/bin/
48
+endef
49
+
50
+$(eval $(call BuildPackage,haserl))

+ 80
- 0
utils/haserl/patches/100-replace-lua2c-with-sed.patch View File

@@ -0,0 +1,80 @@
1
+--- a/src/Makefile.in	2013-09-20 23:52:15.000000000 +0300
2
++++ b/src/Makefile.in	2014-05-03 23:06:17.000000000 +0300
3
+@@ -76,7 +76,6 @@
4
+ NORMAL_UNINSTALL = :
5
+ PRE_UNINSTALL = :
6
+ POST_UNINSTALL = :
7
+-@USE_LUA_TRUE@noinst_PROGRAMS = lua2c$(EXEEXT)
8
+ @INCLUDE_LUASHELL_TRUE@@USE_LUA_TRUE@am__append_1 = h_lua.c h_lua.h
9
+ @INCLUDE_LUACSHELL_TRUE@@USE_LUA_TRUE@am__append_2 = h_luac.c h_luac.h
10
+ bin_PROGRAMS = haserl$(EXEEXT)
11
+@@ -115,9 +114,6 @@
12
+ haserl_DEPENDENCIES = $(am__DEPENDENCIES_1)
13
+ haserl_LINK = $(CCLD) $(haserl_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
14
+ 	$(LDFLAGS) -o $@
15
+-lua2c_SOURCES = lua2c.c
16
+-lua2c_OBJECTS = lua2c.$(OBJEXT)
17
+-lua2c_LDADD = $(LDADD)
18
+ AM_V_P = $(am__v_P_@AM_V@)
19
+ am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
20
+ am__v_P_0 = false
21
+@@ -150,8 +146,8 @@
22
+ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
23
+ am__v_CCLD_0 = @echo "  CCLD    " $@;
24
+ am__v_CCLD_1 = 
25
+-SOURCES = $(haserl_SOURCES) $(nodist_haserl_SOURCES) lua2c.c
26
+-DIST_SOURCES = $(am__haserl_SOURCES_DIST) lua2c.c
27
++SOURCES = $(haserl_SOURCES) $(nodist_haserl_SOURCES)
28
++DIST_SOURCES = $(am__haserl_SOURCES_DIST)
29
+ am__can_run_installinfo = \
30
+   case $$AM_UPDATE_INFO_DIR in \
31
+     n|no|NO) false;; \
32
+@@ -273,7 +269,7 @@
33
+ top_build_prefix = @top_build_prefix@
34
+ top_builddir = @top_builddir@
35
+ top_srcdir = @top_srcdir@
36
+-EXTRA_DIST = haserl_lualib.lua lua2c.c
37
++EXTRA_DIST = haserl_lualib.lua
38
+ 
39
+ # Not strictly required, but we explicitly do not distribute the generated inc file
40
+ nodist_haserl_SOURCES = haserl_lualib.inc
41
+@@ -386,10 +382,6 @@
42
+ 	@rm -f haserl$(EXEEXT)
43
+ 	$(AM_V_CCLD)$(haserl_LINK) $(haserl_OBJECTS) $(haserl_LDADD) $(LIBS)
44
+ 
45
+-@USE_LUA_FALSE@lua2c$(EXEEXT): $(lua2c_OBJECTS) $(lua2c_DEPENDENCIES) $(EXTRA_lua2c_DEPENDENCIES) 
46
+-@USE_LUA_FALSE@	@rm -f lua2c$(EXEEXT)
47
+-@USE_LUA_FALSE@	$(AM_V_CCLD)$(LINK) $(lua2c_OBJECTS) $(lua2c_LDADD) $(LIBS)
48
+-
49
+ mostlyclean-compile:
50
+ 	-rm -f *.$(OBJEXT)
51
+ 
52
+@@ -406,7 +398,6 @@
53
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-haserl.Po@am__quote@
54
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-rfc2388.Po@am__quote@
55
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-sliding_buffer.Po@am__quote@
56
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lua2c.Po@am__quote@
57
+ 
58
+ .c.o:
59
+ @am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
60
+@@ -758,17 +749,13 @@
61
+ 	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
62
+ 
63
+ 
64
+-# lua2c_LIBS ?= -llua -ldl -lm
65
+-@USE_LUA_TRUE@lua2c_LDFLAGS ?= -Wl,-E
66
+-@USE_LUA_TRUE@lua2c:	lua2c.c
67
+-@USE_LUA_TRUE@	$(CC_FOR_BUILD) $(CFLAGS) $(LUA_CFLAGS) $(LDFLAGS) $(lua2c_LDFLAGS) \
68
+-@USE_LUA_TRUE@		-o $@ $^ $(LIBS) $(LUA_LIBS)
69
+ 
70
+-@USE_LUA_TRUE@haserl_lualib.inc : haserl_lualib.lua lua2c
71
+-@USE_LUA_TRUE@	if ! ./lua2c haserl_lualib haserl_lualib.lua >$@; then \
72
++@USE_LUA_TRUE@haserl_lualib.inc : haserl_lualib.lua
73
++@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 \
74
+ @USE_LUA_TRUE@		rm $@; \
75
+ @USE_LUA_TRUE@		exit 1 ;\
76
+ @USE_LUA_TRUE@	fi
77
++@USE_LUA_TRUE@	{ echo "static const char haserl_lualib[] = "; cat $@.tmp; echo ";"; rm $@.tmp; } >$@
78
+ 
79
+ @USE_LUA_TRUE@h_lua_common.c : haserl_lualib.inc
80
+ 

+ 11
- 0
utils/haserl/patches/101-adjust-script-size.patch View File

@@ -0,0 +1,11 @@
1
+--- a/src/h_lua_common.c	2013-09-20 23:35:19.000000000 +0300
2
++++ b/src/h_lua_common.c	2014-05-03 19:27:43.000000000 +0300
3
+@@ -79,7 +79,7 @@
4
+ 
5
+   /* and load our haserl library */
6
+   if (luaL_loadbuffer
7
+-      (lua_vm, (const char *) &haserl_lualib, sizeof (haserl_lualib),
8
++      (lua_vm, (const char *) haserl_lualib, sizeof(haserl_lualib)-1,
9
+        "luascript.lua") || lua_pcall (lua_vm, 0, 0, 0))
10
+     {
11
+       die_with_message (NULL, NULL,