@@ -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.
584584local 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
603606end
604607
605608local 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