summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-10-23 00:38:13 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2015-10-23 12:56:18 +0200
commit504791031307da2bd380ac5f6da02fc67ea71731 (patch)
treec4429b0220fb615f7e3e4f94c4d2f894c306d2d7 /meta-oe
parent2ce3086aa859178fb5f7d6db9876229c8ed5a6eb (diff)
downloadmeta-openembedded-504791031307da2bd380ac5f6da02fc67ea71731.tar.gz
sysdig: Fix build with lua >= 5.2
It was still using deprecated lua contructs also fix for musl while at it Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch50
-rw-r--r--meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch108
-rw-r--r--meta-oe/recipes-extended/sysdig/sysdig_git.bb7
3 files changed, 163 insertions, 2 deletions
diff --git a/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch b/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch
new file mode 100644
index 000000000..7d3f8a19d
--- /dev/null
+++ b/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch
@@ -0,0 +1,50 @@
1From 290703a5d21f34ea5ec23efc815a9f4df241e7e8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 23 Oct 2015 00:33:32 -0700
4Subject: [PATCH] Fix build with musl, backtrace() APIs are glibc specific
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 userspace/libsinsp/utils.cpp | 4 +++-
9 userspace/libsinsp/utils.h | 2 +-
10 2 files changed, 4 insertions(+), 2 deletions(-)
11
12diff --git a/userspace/libsinsp/utils.cpp b/userspace/libsinsp/utils.cpp
13index 8f23f9c..c496a57 100644
14--- a/userspace/libsinsp/utils.cpp
15+++ b/userspace/libsinsp/utils.cpp
16@@ -21,7 +21,9 @@ along with sysdig. If not, see <http://www.gnu.org/licenses/>.
17 #include <limits.h>
18 #include <stdlib.h>
19 #include <sys/time.h>
20+#ifdef __GLIBC__
21 #include <execinfo.h>
22+#endif
23 #include <unistd.h>
24 #include <sys/time.h>
25 #include <netdb.h>
26@@ -741,7 +743,7 @@ uint64_t sinsp_utils::get_current_time_ns()
27 return tv.tv_sec * (uint64_t) 1000000000 + tv.tv_usec * 1000;
28 }
29
30-#ifndef _WIN32
31+#if defined(_WIN32) && defined(__GLIBC__)
32 void sinsp_utils::bt(void)
33 {
34 static const char start[] = "BACKTRACE ------------";
35diff --git a/userspace/libsinsp/utils.h b/userspace/libsinsp/utils.h
36index 600d00b..4ab4650 100644
37--- a/userspace/libsinsp/utils.h
38+++ b/userspace/libsinsp/utils.h
39@@ -79,7 +79,7 @@ public:
40
41 static uint64_t get_current_time_ns();
42
43-#ifndef _WIN32
44+#if not defined(_WIN32) && defined(__GLIBC__)
45 //
46 // Print the call stack
47 //
48--
492.6.2
50
diff --git a/meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch b/meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch
new file mode 100644
index 000000000..8fec0ca59
--- /dev/null
+++ b/meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch
@@ -0,0 +1,108 @@
1From c2782a6ca968190e221c25b0890600ba8cd43798 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 23 Oct 2015 00:23:15 -0700
4Subject: [PATCH] libsinsp: Port to build with lua >= 5.2
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 userspace/libsinsp/chisel.cpp | 40 +++++++++++++++++++++++++++++-----------
9 1 file changed, 29 insertions(+), 11 deletions(-)
10
11diff --git a/userspace/libsinsp/chisel.cpp b/userspace/libsinsp/chisel.cpp
12index 3cfbd8d..2db9348 100644
13--- a/userspace/libsinsp/chisel.cpp
14+++ b/userspace/libsinsp/chisel.cpp
15@@ -94,7 +94,7 @@ void lua_stackdump(lua_State *L)
16 // Lua callbacks
17 ///////////////////////////////////////////////////////////////////////////////
18 #ifdef HAS_LUA_CHISELS
19-const static struct luaL_reg ll_sysdig [] =
20+const static struct luaL_Reg ll_sysdig [] =
21 {
22 {"set_filter", &lua_cbacks::set_global_filter},
23 {"set_snaplen", &lua_cbacks::set_snaplen},
24@@ -120,7 +120,7 @@ const static struct luaL_reg ll_sysdig [] =
25 {NULL,NULL}
26 };
27
28-const static struct luaL_reg ll_chisel [] =
29+const static struct luaL_Reg ll_chisel [] =
30 {
31 {"request_field", &lua_cbacks::request_field},
32 {"set_filter", &lua_cbacks::set_filter},
33@@ -131,7 +131,7 @@ const static struct luaL_reg ll_chisel [] =
34 {NULL,NULL}
35 };
36
37-const static struct luaL_reg ll_evt [] =
38+const static struct luaL_Reg ll_evt [] =
39 {
40 {"field", &lua_cbacks::field},
41 {"get_num", &lua_cbacks::get_num},
42@@ -853,10 +853,28 @@ bool sinsp_chisel::parse_view_info(lua_State *ls, OUT chisel_desc* cd)
43
44
45 #ifdef HAS_LUA_CHISELS
46+static void chisel_lua_registerlib(lua_State *L, const char *libname,
47+ const luaL_Reg *l, int ind)
48+{
49+#if LUA_VERSION_NUM >= 502
50+ if (libname)
51+ {
52+ lua_newtable(L);
53+ luaL_setfuncs(L, l, ind);
54+ lua_pushvalue(L, -1);
55+ lua_setglobal(L, libname);
56+ }
57+ else
58+ luaL_setfuncs(L, l, ind);
59+#else
60+ luaL_register(L, libname, l);
61+#endif
62+}
63+
64 // Initializes a lua chisel
65 bool sinsp_chisel::init_lua_chisel(chisel_desc &cd, string const &fpath)
66 {
67- lua_State* ls = lua_open();
68+ lua_State* ls = luaL_newstate();
69 if(ls == NULL)
70 {
71 return false;
72@@ -867,9 +885,9 @@ bool sinsp_chisel::init_lua_chisel(chisel_desc &cd, string const &fpath)
73 //
74 // Load our own lua libs
75 //
76- luaL_openlib(ls, "sysdig", ll_sysdig, 0);
77- luaL_openlib(ls, "chisel", ll_chisel, 0);
78- luaL_openlib(ls, "evt", ll_evt, 0);
79+ chisel_lua_registerlib(ls, "sysdig", ll_sysdig, 0);
80+ chisel_lua_registerlib(ls, "chisel", ll_chisel, 0);
81+ chisel_lua_registerlib(ls, "evt", ll_evt, 0);
82
83 //
84 // Add our chisel paths to package.path
85@@ -1111,16 +1129,16 @@ void sinsp_chisel::load(string cmdstr)
86 //
87 // Open the script
88 //
89- m_ls = lua_open();
90+ m_ls = luaL_newstate();
91
92 luaL_openlibs(m_ls);
93
94 //
95 // Load our own lua libs
96 //
97- luaL_openlib(m_ls, "sysdig", ll_sysdig, 0);
98- luaL_openlib(m_ls, "chisel", ll_chisel, 0);
99- luaL_openlib(m_ls, "evt", ll_evt, 0);
100+ chisel_lua_registerlib(m_ls, "sysdig", ll_sysdig, 0);
101+ chisel_lua_registerlib(m_ls, "chisel", ll_chisel, 0);
102+ chisel_lua_registerlib(m_ls, "evt", ll_evt, 0);
103
104 //
105 // Add our chisel paths to package.path
106--
1072.6.2
108
diff --git a/meta-oe/recipes-extended/sysdig/sysdig_git.bb b/meta-oe/recipes-extended/sysdig/sysdig_git.bb
index 62aa433b3..717fab93a 100644
--- a/meta-oe/recipes-extended/sysdig/sysdig_git.bb
+++ b/meta-oe/recipes-extended/sysdig/sysdig_git.bb
@@ -11,8 +11,11 @@ inherit cmake pkgconfig
11DEPENDS = "luajit zlib ncurses" 11DEPENDS = "luajit zlib ncurses"
12RDEPENDS_${PN} = "bash" 12RDEPENDS_${PN} = "bash"
13 13
14SRC_URI = "git://github.com/draios/sysdig.git;branch=master" 14SRC_URI = "git://github.com/draios/sysdig.git;branch=master \
15SRCREV = "b7394e29ced4f1a991af03c0381a5828abcbab7a" 15 file://0001-libsinsp-Port-to-build-with-lua-5.2.patch \
16 file://0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch \
17 "
18SRCREV = "85d16f33a82a17f87ccdbc088749271c71d87013"
16PV = "0.1.102+git${SRCPV}" 19PV = "0.1.102+git${SRCPV}"
17 20
18S = "${WORKDIR}/git" 21S = "${WORKDIR}/git"