[*] Added update libc scripts and improved support for debian build boxes

This commit is contained in:
Reece Wilson 2024-06-30 03:29:48 +01:00
parent f132d8980c
commit 8b8aadaa86

View File

@ -98,21 +98,50 @@ local function addUserDestCopy(name, type, config, platformName, arch, dir, proj
io.writefile(outputPath .. ".exe", "#!/bin/bash\nchmod +x \"$(dirname \"$0\")/ld-Aurora.System.Linux.x86_64.so\"\nchmod +x \"$(dirname \"$0\")/".. fileName .. "\"\n\"$(dirname \"$0\")/ld-Aurora.System.Linux.x86_64.so\" \"$(dirname \"$0\")/".. fileName .. "\" $@")
end
postbuildcommands("cp -f /lib64/ld-linux-x86-64.so.2 \"" .. dir .. "/ld-Aurora.System.Linux.x86_64.so\"")
postbuildcommands("cp -f /lib64/libc.so.6 \"" .. dir .. "/libc." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib64/libm.so.6 \"" .. dir .. "/libm." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib64/libgcc_s.so.1 \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\"")
local kUpdateLib64String = "#!/bin/bash\n\ntest -e /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 && cp -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ld-Aurora.System.Linux.x86_64.so || echo skipped\ntest -e /lib/x86_64-linux-gnu/libc.so.6 && cp -f /lib/x86_64-linux-gnu/libc.so.6 libc.System.Linux.x86_64.so || echo skipped\ntest -e /lib/x86_64-linux-gnu/libm.so.6 && cp -f /lib/x86_64-linux-gnu/libm.so.6 libm.System.Linux.x86_64.so || echo skipped\ntest -e /lib64/ld-linux-x86-64.so.2 && cp -f /lib64/ld-linux-x86-64.so.2 ld-Aurora.System.Linux.x86_64.so || echo skipped\ntest -e /lib64/libc.so.6 && cp -f /lib64/libc.so.6 libc.System.Linux.x86_64.so || echo skipped\ntest -e /lib64/libm.so.6 && cp -f /lib64/libm.so.6 libm.System.Linux.x86_64.so || echo skipped\n\nif which patchelf >/dev/null; then\n\n patchelf --replace-needed libc.so.6 libc.System.Linux.x86_64.so libm.System.Linux.x86_64.so\n patchelf --replace-needed libgcc_s.so.1 libgcc.System.Linux.x86_64.so libm.System.Linux.x86_64.so\n \n patchelf --replace-needed libm.so.6 libm.System.Linux.x86_64.so libc.System.Linux.x86_64.so\n patchelf --replace-needed libgcc_s.so.1 libgcc.System.Linux.x86_64.so libc.System.Linux.x86_64.so\n \n patchelf --replace-needed libc.so.6 libc.System.Linux.x86_64.so libgcc.System.Linux.x86_64.so\n patchelf --replace-needed libm.so.6 libm.System.Linux.x86_64.so libgcc.System.Linux.x86_64.so\n\nfi"
io.writefile(dir .. "/update_libc64.sh", kUpdateLib64String)
if (os.isdir("/lib/x86_64-linux-gnu")) then
postbuildcommands("test -e /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 && cp -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \"" .. dir .. "/ld-Aurora.System.Linux.x86_64.so\" || echo SKIP")
postbuildcommands("test -e /lib/x86_64-linux-gnu/libc.so.6 && cp -f /lib/x86_64-linux-gnu/libc.so.6 \"" .. dir .. "/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/x86_64-linux-gnu/libm.so.6 && cp -f /lib/x86_64-linux-gnu/libm.so.6 \"" .. dir .. "/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/x86_64-linux-gnu/libgcc_s.so.1 && cp -f /lib/x86_64-linux-gnu/libgcc_s.so.1 \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
else
postbuildcommands("test -e /lib64/ld-linux-x86-64.so.2 && cp -f /lib64/ld-linux-x86-64.so.2 \"" .. dir .. "/ld-Aurora.System.Linux.x86_64.so\" || echo SKIP")
postbuildcommands("test -e /lib64/libc.so.6 && cp -f /lib64/libc.so.6 \"" .. dir .. "/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib64/libm.so.6 && cp -f /lib64/libm.so.6 \"" .. dir .. "/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib64/libgcc_s.so.1 && cp -f /lib64/libgcc_s.so.1 \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
end
else
if (isExec) then
postbuildcommands("patchelf --set-interpreter \"ld-Aurora.System.Linux.x86_32.so\" \"" .. outputPath .. "\"")
io.writefile(outputPath .. ".exe", "#!/bin/bash\nchmod +x \"$(dirname \"$0\")/ld-Aurora.System.Linux.x86_32.so\"\nchmod +x \"$(dirname \"$0\")/".. fileName .. "\"\n\"$(dirname \"$0\")/ld-Aurora.System.Linux.x86_32.so\" \"$(dirname \"$0\")/".. fileName .. "\" $@")
end
postbuildcommands("cp -f /lib/ld-linux.so.2 \"" .. dir .. "/ld-Aurora.System.Linux.x86_32.so\"")
postbuildcommands("cp -f /lib/libc.so.6 \"" .. dir .. "/libc." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib/libm.so.6 \"" .. dir .. "/libm." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib/libgcc_s.so.1 \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\"")
local kUpdateLib32String = "#!/bin/bash\n\ntest -e /lib/i386-linux-gnu/ld-linux.so.2 && cp -f /lib/i386-linux-gnu/ld-linux.so.2 ld-Aurora.System.Linux.x86_32.so || echo skipped\ntest -e /lib/i386-linux-gnu/libc.so.6 && cp -f /lib/i386-linux-gnu/libc.so.6 libc.System.Linux.x86_32.so || echo skipped\ntest -e /lib/i386-linux-gnu/libm.so.6 && cp -f /lib/i386-linux-gnu/libm.so.6 libm.System.Linux.x86_32.so || echo skipped\ntest -e /lib/ld-linux.so.2 && cp -f /lib/ld-linux.so.2 ld-Aurora.System.Linux.x86_32.so || echo skipped\ntest -e /lib/libc.so.6 && cp -f /lib/libc.so.6 libc.System.Linux.x86_32.so || echo skipped\ntest -e /lib/libm.so.6 && cp -f /lib/libm.so.6 libm.System.Linux.x86_32.so || echo skipped\n\nif which patchelf >/dev/null; then\n\n patchelf --replace-needed libc.so.6 libc.System.Linux.x86_32.so libm.System.Linux.x86_32.so\n patchelf --replace-needed libgcc_s.so.1 libgcc.System.Linux.x86_32.so libm.System.Linux.x86_32.so\n \n patchelf --replace-needed libm.so.6 libm.System.Linux.x86_32.so libc.System.Linux.x86_32.so\n patchelf --replace-needed libgcc_s.so.1 libgcc.System.Linux.x86_32.so libc.System.Linux.x86_32.so\n \n patchelf --replace-needed libc.so.6 libc.System.Linux.x86_32.so libgcc.System.Linux.x86_32.so\n patchelf --replace-needed libm.so.6 libm.System.Linux.x86_32.so libgcc.System.Linux.x86_32.so\n \nfi"
io.writefile(dir .. "/update_libc32.sh", kUpdateLib32String)
if (os.isdir("/lib/i386-linux-gnu")) then
postbuildcommands("test -e /lib/i386-linux-gnu/ld-linux.so.2 && cp -f /lib/i386-linux-gnu/ld-linux.so.2 \"" .. dir .. "/ld-Aurora.System.Linux.x86_32.so\" || echo SKIP")
postbuildcommands("test -e /lib/i386-linux-gnu/libc.so.6 && cp -f /lib/i386-linux-gnu/libc.so.6 \"" .. dir .. "/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/i386-linux-gnu/libm.so.6 && cp -f /lib/i386-linux-gnu/libm.so.6 \"" .. dir .. "/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/i386-linux-gnu/libgcc_s.so.1 && cp -f /lib/i386-linux-gnu/libgcc_s.so.1 \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
else
postbuildcommands("test -e /lib/ld-linux.so.2 && cp -f /lib/ld-linux.so.2 \"" .. dir .. "/ld-Aurora.System.Linux.x86_32.so\" || echo SKIP")
postbuildcommands("test -e /lib/libc.so.6 && cp -f /lib/libc.so.6 \"" .. dir .. "/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/libm.so.6 && cp -f /lib/libm.so.6 \"" .. dir .. "/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/libgcc_s.so.1 && cp -f /lib/libgcc_s.so.1 \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
end
end
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"" .. dir .. "/libm." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"" .. dir .. "/libm." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"" .. dir .. "/libc." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"" .. dir .. "/libc." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"" .. dir .. "/libgcc." .. platformSuffix .. ".so\"")
if (os.isfile(dir .. "/libunwind-x86_64.so.8")) then
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. "System.Linux.x86_64" .. ".so \"" .. dir .. "/libunwind-x86_64.so.8\"")
@ -166,22 +195,40 @@ local function patchPortableElf(name, type, config, platform, platformName, arch
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"" .. outputPath .. "\"")
if (arch == "x86_64" or arch == "ARM64" or arch == "aarch64" or arch == "mips64") then
postbuildcommands("cp -f /lib64/ld-linux-x86-64.so.2 \"" .. "%{cfg.targetdir}/ld-Aurora.System.Linux.x86_64.so\"")
postbuildcommands("cp -f /lib64/libc.so.6 \"" .. "%{cfg.targetdir}/libc." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib64/libm.so.6 \"" .. "%{cfg.targetdir}/libm." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib64/libgcc_s.so.1 \"" .. "%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\"")
if (os.isdir("/lib/x86_64-linux-gnu")) then
postbuildcommands("test -e /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 && cp -f /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \"" .. "%{cfg.targetdir}/ld-Aurora.System.Linux.x86_64.so\" || echo SKIP")
postbuildcommands("test -e /lib/x86_64-linux-gnu/libc.so.6 && cp -f /lib/x86_64-linux-gnu/libc.so.6 \"" .. "%{cfg.targetdir}/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/x86_64-linux-gnu/libm.so.6 && cp -f /lib/x86_64-linux-gnu/libm.so.6 \"" .. "%{cfg.targetdir}/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/x86_64-linux-gnu/libgcc_s.so.1 && cp -f /lib/x86_64-linux-gnu/libgcc_s.so.1 \"" .. "%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
else
postbuildcommands("cp -f /lib/ld-linux.so.2 \"" .. "%{cfg.targetdir}/ld-Aurora.System.Linux.x86_32.so\"")
postbuildcommands("cp -f /lib/libc.so.6 \"" .. "%{cfg.targetdir}/libc." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib/libm.so.6 \"" .. "%{cfg.targetdir}/libm." .. platformSuffix .. ".so\"")
postbuildcommands("cp -f /lib/libgcc_s.so.1 \"" .. "%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\"")
postbuildcommands("test -e /lib64/ld-linux-x86-64.so.2 && cp -f /lib64/ld-linux-x86-64.so.2 \"" .. "%{cfg.targetdir}/ld-Aurora.System.Linux.x86_64.so\" || echo SKIP")
postbuildcommands("test -e /lib64/libc.so.6 && cp -f /lib64/libc.so.6 \"" .. "%{cfg.targetdir}/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib64/libm.so.6 && cp -f /lib64/libm.so.6 \"" .. "%{cfg.targetdir}/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib64/libgcc_s.so.1 && cp -f /lib64/libgcc_s.so.1 \"" .. "%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
end
else
if (os.isdir("/lib/i386-linux-gnu")) then
postbuildcommands("test -e /lib/i386-linux-gnu/ld-linux.so.2 && cp -f /lib/i386-linux-gnu/ld-linux.so.2 \"" .."%{cfg.targetdir}/ld-Aurora.System.Linux.x86_32.so\" || echo SKIP")
postbuildcommands("test -e /lib/i386-linux-gnu/libc.so.6 && cp -f /lib/i386-linux-gnu/libc.so.6 \"" .."%{cfg.targetdir}/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/i386-linux-gnu/libm.so.6 && cp -f /lib/i386-linux-gnu/libm.so.6 \"" .."%{cfg.targetdir}/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/i386-linux-gnu/libgcc_s.so.1 && cp -f /lib/i386-linux-gnu/libgcc_s.so.1 \"" .."%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
else
postbuildcommands("test -e /lib/ld-linux.so.2 && cp -f /lib/ld-linux.so.2 \"" .. "%{cfg.targetdir}/ld-Aurora.System.Linux.x86_32.so\" || echo SKIP")
postbuildcommands("test -e /lib/libc.so.6 && cp -f /lib/libc.so.6 \"" .. "%{cfg.targetdir}/libc." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/libm.so.6 && cp -f /lib/libm.so.6 \"" .. "%{cfg.targetdir}/libm." .. platformSuffix .. ".so\" || echo SKIP")
postbuildcommands("test -e /lib/libgcc_s.so.1 && cp -f /lib/libgcc_s.so.1 \"" .. "%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\" || echo SKIP")
end
end
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"%{cfg.targetdir}/libm." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"%{cfg.targetdir}/libm." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"%{cfg.targetdir}/libm." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"%{cfg.targetdir}/libc." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"%{cfg.targetdir}/libc." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\"")
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"%{cfg.targetdir}/libgcc." .. platformSuffix .. ".so\"")
end
local function addDest(name, projectType, dest)