From be24bac5ac0d418b863d8f7f785b923e4d392da2 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 24 Jul 2022 21:50:04 +0200 Subject: [PATCH] lua-language-server: fix build on ppc* and probably somewhere else I don't see why this bundles bee.lua three times, but okay (that is why the fixes are duplicated three times) In any case, fixes two things: 1) bee.lua implements a custom spinlock (why???) which needs a cpu_relax, which was unimplemented on ppc* so fill that in 2) at some point this random test was added, which I do not see what it is supposed to accomplish, since Lua does not guarantee order of iteration in a table in any way, so technically this should fail in most cases (the tests are run on every build, why does it not fail on x86?) - the commit message is literally just "add a test" in chinese, so it is not particularly helpful --- .../patches/fix-stupid-broken-tests.patch | 82 +++++++++++++++++++ srcpkgs/lua-language-server/patches/ppc.patch | 45 ++++++++++ 2 files changed, 127 insertions(+) create mode 100644 srcpkgs/lua-language-server/patches/fix-stupid-broken-tests.patch create mode 100644 srcpkgs/lua-language-server/patches/ppc.patch diff --git a/srcpkgs/lua-language-server/patches/fix-stupid-broken-tests.patch b/srcpkgs/lua-language-server/patches/fix-stupid-broken-tests.patch new file mode 100644 index 00000000000..40287346b52 --- /dev/null +++ b/srcpkgs/lua-language-server/patches/fix-stupid-broken-tests.patch @@ -0,0 +1,82 @@ +commit 59f1baf712f50873af54148cb2a3f379ce796353 +Author: q66 +Date: Sun Jul 24 21:34:59 2022 +0200 + + remove stupid broken tests + + I don't even know what the purpose of this is supposed to be, + considering lua does not guarantee iteration order in a hash + table in any way, and it comes out different on every run. + +diff --git a/3rd/bee.lua/test/test_lua.lua b/3rd/bee.lua/test/test_lua.lua +index 5b85af7..cf653c0 100644 +--- a/3rd/bee.lua/test/test_lua.lua ++++ b/3rd/bee.lua/test/test_lua.lua +@@ -21,19 +21,4 @@ function test_lua:test_stack_overflow_2() + end + + function test_lua:test_next() +- local t = {} +- for i = 1, 26 do +- t[string.char(0x40+i)] = true +- end +- local expected = { +- 'Z', 'Y', 'V', 'U', 'X', 'W', 'R', 'Q', 'T', 'S', 'N', 'M', 'P', 'O', 'J', 'I', 'L', 'K', 'F', 'E', 'H', 'G', 'B', 'A', 'D', 'C' +- } +- local function checkOK() +- local key +- for i = 1, 26 do +- key = next(t, key) +- lt.assertEquals(key, expected[i]) +- end +- end +- checkOK() + end +diff --git a/3rd/luamake/3rd/bee.lua/test/test_lua.lua b/3rd/luamake/3rd/bee.lua/test/test_lua.lua +index 5b85af7..cf653c0 100644 +--- a/3rd/luamake/3rd/bee.lua/test/test_lua.lua ++++ b/3rd/luamake/3rd/bee.lua/test/test_lua.lua +@@ -21,19 +21,4 @@ function test_lua:test_stack_overflow_2() + end + + function test_lua:test_next() +- local t = {} +- for i = 1, 26 do +- t[string.char(0x40+i)] = true +- end +- local expected = { +- 'Z', 'Y', 'V', 'U', 'X', 'W', 'R', 'Q', 'T', 'S', 'N', 'M', 'P', 'O', 'J', 'I', 'L', 'K', 'F', 'E', 'H', 'G', 'B', 'A', 'D', 'C' +- } +- local function checkOK() +- local key +- for i = 1, 26 do +- key = next(t, key) +- lt.assertEquals(key, expected[i]) +- end +- end +- checkOK() + end +diff --git a/luamake/3rd/bee.lua/test/test_lua.lua b/luamake/3rd/bee.lua/test/test_lua.lua +index 5b85af7..cf653c0 100644 +--- a/luamake/3rd/bee.lua/test/test_lua.lua ++++ b/luamake/3rd/bee.lua/test/test_lua.lua +@@ -21,19 +21,4 @@ function test_lua:test_stack_overflow_2() + end + + function test_lua:test_next() +- local t = {} +- for i = 1, 26 do +- t[string.char(0x40+i)] = true +- end +- local expected = { +- 'Z', 'Y', 'V', 'U', 'X', 'W', 'R', 'Q', 'T', 'S', 'N', 'M', 'P', 'O', 'J', 'I', 'L', 'K', 'F', 'E', 'H', 'G', 'B', 'A', 'D', 'C' +- } +- local function checkOK() +- local key +- for i = 1, 26 do +- key = next(t, key) +- lt.assertEquals(key, expected[i]) +- end +- end +- checkOK() + end diff --git a/srcpkgs/lua-language-server/patches/ppc.patch b/srcpkgs/lua-language-server/patches/ppc.patch new file mode 100644 index 00000000000..681e0d1a006 --- /dev/null +++ b/srcpkgs/lua-language-server/patches/ppc.patch @@ -0,0 +1,45 @@ +commit ffb877fd6ac8b004f3263e284b584d778fd681e5 +Author: q66 +Date: Sun Jul 24 21:10:55 2022 +0200 + + fix build on ppc* + +diff --git a/3rd/bee.lua/bee/thread/spinlock.h b/3rd/bee.lua/bee/thread/spinlock.h +index ad0cf4e..f4c2f22 100644 +--- a/3rd/bee.lua/bee/thread/spinlock.h ++++ b/3rd/bee.lua/bee/thread/spinlock.h +@@ -18,6 +18,8 @@ + asm volatile ("div %0, %0, zero" : "=r" (dummy)); + asm volatile ("" ::: "memory"); + }} ++#elif defined(__powerpc__) ++ namespace bee { inline void cpu_relax() { asm volatile ("or 27,27,27" ::: "memory"); }} + #else + #error unsupport platform + #endif +diff --git a/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h b/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h +index ad0cf4e..f4c2f22 100644 +--- a/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h ++++ b/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h +@@ -18,6 +18,8 @@ + asm volatile ("div %0, %0, zero" : "=r" (dummy)); + asm volatile ("" ::: "memory"); + }} ++#elif defined(__powerpc__) ++ namespace bee { inline void cpu_relax() { asm volatile ("or 27,27,27" ::: "memory"); }} + #else + #error unsupport platform + #endif +diff --git a/luamake/3rd/bee.lua/bee/thread/spinlock.h b/luamake/3rd/bee.lua/bee/thread/spinlock.h +index ad0cf4e..f4c2f22 100644 +--- a/luamake/3rd/bee.lua/bee/thread/spinlock.h ++++ b/luamake/3rd/bee.lua/bee/thread/spinlock.h +@@ -18,6 +18,8 @@ + asm volatile ("div %0, %0, zero" : "=r" (dummy)); + asm volatile ("" ::: "memory"); + }} ++#elif defined(__powerpc__) ++ namespace bee { inline void cpu_relax() { asm volatile ("or 27,27,27" ::: "memory"); }} + #else + #error unsupport platform + #endif