Skip to content

Commit 55d836b

Browse files
committed
fix(eui-neo): install() 里的布局归一不能用 shell —— Windows 上没有
`workspace (windows default 0/1)` 红。install() 是**每个平台都跑**的,而里面 那段归一 wrap 层的逻辑用了 `sh -c`;Windows runner 上没有这个东西。Linux 与 macOS 都过了,正好说明问题只在这一处。 改成纯 xmake Lua:按名字**问**归档的形状,而不是去**发现**它 —— 这个沙箱里既没有 `os.files` 也没有 `path.basename`,列目录本来就做不到。 四个候选名覆盖 GitHub 的 `EUI-NEO-<v>` 与镜像可能的小写/带 v 拼法;真扁平的 包走 `os.cp("*", layer)`。 `stage_glib` 里的 `cp -a` 保留,并写明理由:那一支被 `os.host() ~= "linux"` 挡住,而且 glib 的 `libgio-2.0.so -> .so.0 -> .so.0.8000.0` 是符号链接, 解引用会变成三份完整拷贝并丢掉链接器解析的那个名字。 本机复验:三项 lint 通过,消费者仍然 `eui_tray_init -> 1`。
1 parent 4d6e316 commit 55d836b

1 file changed

Lines changed: 25 additions & 18 deletions

File tree

pkgs/e/compat.eui-neo.lua

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -582,24 +582,27 @@ end
582582
-- downloaded. `os.exec` / `os.isfile` / `os.isdir` / `os.mkdir` are what the
583583
-- rest of this index uses, so they are what this uses.
584584
local function normalise_layout(layer)
585-
os.mkdir(layer)
586-
os.exec("sh -c " .. sh_quote(
587-
'set -e; '
588-
-- A wrapped archive: one top-level directory and no loose files that
589-
-- belong to the tree. Move its CONTENTS up into the layer, so the
590-
-- result is one level deep whichever shape arrived.
591-
.. 'if [ ! -f CMakeLists.txt ]; then '
592-
.. 'd=$(ls -1d */ 2>/dev/null | head -1); '
593-
.. 'if [ -n "$d" ] && [ -f "$d/CMakeLists.txt" ]; then '
594-
.. 'mv "$d"/* ' .. sh_quote(layer) .. '/ 2>/dev/null || true; '
595-
.. 'mv "$d"/.[!.]* ' .. sh_quote(layer) .. '/ 2>/dev/null || true; '
596-
.. 'exit 0; '
597-
.. 'fi; '
598-
.. 'fi; '
599-
-- A flat archive: everything at the top level IS the tree.
600-
.. 'for e in ./*; do [ -e "$e" ] || continue; '
601-
.. 'mv "$e" ' .. sh_quote(layer) .. '/ 2>/dev/null || true; done'))
602-
return os.isfile(path.join(layer, "CMakeLists.txt"))
585+
-- ⚠️ NO SHELL. `sh -c` does not exist on a Windows runner, and this hook
586+
-- runs on every platform -- the flag that says otherwise is further down,
587+
-- and it only guards the glib staging. Listing a directory is also out
588+
-- (`os.files` is not in this sandbox), so the archive's shape is ASKED
589+
-- ABOUT by name rather than discovered.
590+
local v = pkginfo.version()
591+
for _, name in ipairs({ "EUI-NEO-" .. v, "eui-neo-" .. v,
592+
"EUI-NEO-v" .. v, "eui-neo-v" .. v }) do
593+
if os.isfile(path.join(name, "CMakeLists.txt")) then
594+
os.mv(name, layer)
595+
return os.isfile(path.join(layer, "CMakeLists.txt"))
596+
end
597+
end
598+
-- A mirror that flattened its tarball: everything at this level IS the
599+
-- tree, so give it the one layer the globs expect.
600+
if os.isfile("CMakeLists.txt") then
601+
os.mkdir(layer)
602+
os.cp("*", layer)
603+
return os.isfile(path.join(layer, "CMakeLists.txt"))
604+
end
605+
return false
603606
end
604607

605608
local function stage_glib(outdir)
@@ -629,6 +632,10 @@ local function stage_glib(outdir)
629632

630633
local libout = path.join(outdir, "lib")
631634
os.mkdir(libout)
635+
-- `cp -a`, in the shell, and only here: this branch is Linux-only (see the
636+
-- host guard in install()), and preserving the SYMLINKS matters. glib ships
637+
-- `libgio-2.0.so -> .so.0 -> .so.0.8000.0`; dereferencing them would stage
638+
-- three full copies of each library and lose the name the linker resolves.
632639
for _, pattern in ipairs(glib_libs) do
633640
os.exec("for lib in " .. sh_quote(path.join(glib.path, "lib")) .. "/" .. pattern ..
634641
"; do [ -e \"$lib\" ] || continue; " ..

0 commit comments

Comments
 (0)