2021-11-13 08:31:32 +00:00
|
|
|
local kPathPrefix = "!"
|
|
|
|
|
|
|
|
local function normalizeCpyPath(absPath)
|
2022-02-18 09:08:35 +00:00
|
|
|
return absPath -- path.getrelative(os.getcwd(), Aurora.Settings.sAbsRoot) .. '/' .. path.getrelative(Aurora.Settings.sAbsRoot, absPath)
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- file name, type, directory, extension, is windows, configuration, real name
|
2024-06-29 13:37:41 +00:00
|
|
|
local function formatCpy(name, type, dir, ex, iswin, config, platformName, arch, realName)
|
2021-11-13 08:31:32 +00:00
|
|
|
local pathSuffix = "";
|
2023-12-19 04:16:12 +00:00
|
|
|
local hack2 = os.host() == "windows" and _ACTION == "gmake2"
|
2021-11-13 08:31:32 +00:00
|
|
|
|
2023-12-19 04:16:12 +00:00
|
|
|
if (iswin and not hack2) then
|
2021-11-13 08:31:32 +00:00
|
|
|
pathSuffix = "*\"";
|
|
|
|
else
|
|
|
|
pathSuffix = "\"";
|
|
|
|
end
|
|
|
|
|
2022-02-18 09:08:35 +00:00
|
|
|
local platform = Aurora.Platforms[platformName]
|
|
|
|
if (platform) then
|
|
|
|
platformName = platform.outputName
|
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
if (Aurora.Settings.bDefinePartialABIInTargetName) then
|
2022-02-18 09:08:35 +00:00
|
|
|
name = string.format("%s.%s.%s.%s", name, config, platformName, arch)
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local outputPath = string.format("%s/%s%s", dir, name, ex)
|
|
|
|
local outputTarget = string.format("%s/%s", dir, name)
|
|
|
|
local uglyBuildPath = string.format("%%{cfg.targetdir}/%s%s", name, ex)
|
2023-12-19 04:16:12 +00:00
|
|
|
local hack = "{COPY}"
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2023-12-19 04:16:12 +00:00
|
|
|
if (hack2) then
|
|
|
|
hack = "cp -rf"
|
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
|
|
|
local nameAndExt = name .. ex
|
|
|
|
|
|
|
|
return string.format("%s \"%s\" \"%s%s", hack, uglyBuildPath, outputPath, pathSuffix), outputPath, uglyBuildPath, name
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
2024-06-29 13:37:41 +00:00
|
|
|
local function gnuCoreUtilsMkdirRecursive(dir)
|
2021-11-13 08:31:32 +00:00
|
|
|
return string.format("mkdir -p \"%s\"", dir);
|
|
|
|
end
|
|
|
|
|
|
|
|
local function archiveShipPdb(pdbPath)
|
|
|
|
-- TODO (reece):
|
|
|
|
end
|
|
|
|
|
2021-11-16 11:03:56 +00:00
|
|
|
local function isUtils(projectType)
|
2022-05-22 04:24:43 +00:00
|
|
|
return projectType:lower() == "blank" or projectType:lower() == "utility" or projectType:lower() == "none"
|
2021-11-16 11:03:56 +00:00
|
|
|
end
|
|
|
|
|
2021-11-16 10:38:53 +00:00
|
|
|
local function isNoLinkType(projectType)
|
2021-11-16 11:03:56 +00:00
|
|
|
return projectType == "StaticLib" or isUtils(projectType)
|
2021-11-16 10:38:53 +00:00
|
|
|
end
|
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
local function addUserDestCopy(name, type, config, platformName, arch, dir, projectType)
|
2021-11-13 08:31:32 +00:00
|
|
|
local isWin = platformName == "win32"
|
|
|
|
local debugSymbolPath = nil
|
|
|
|
|
|
|
|
local platform = Aurora.Platforms[platformName]
|
|
|
|
if (not platform) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local ext = (platform.exts or {})[type] or ""
|
|
|
|
|
2024-06-29 13:37:41 +00:00
|
|
|
local copy, outputPath, file, fileName = formatCpy(Aurora.Settings.sLibPrefix .. name, type, dir, ext, isWin, config, platformName, arch, name)
|
2021-11-13 08:31:32 +00:00
|
|
|
|
2021-11-14 16:38:07 +00:00
|
|
|
if (platform.devChainCoreUtils) then
|
2024-06-29 13:37:41 +00:00
|
|
|
-- TODO: why was this never executed until now?
|
|
|
|
os.execute(gnuCoreUtilsMkdirRecursive(dir))
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
2021-11-14 16:38:07 +00:00
|
|
|
if (platform.devChainRequiresElfStrip and
|
2024-06-29 13:37:41 +00:00
|
|
|
platform.devChainSupportsElfStrip) then
|
|
|
|
|
|
|
|
-- never straight copy, just in case
|
|
|
|
-- id rather objcopy fail and leave us with no copy than have missed a symbol strip step
|
2023-08-11 12:40:05 +00:00
|
|
|
postbuildcommands("objcopy --strip-debug --strip-unneeded \"" .. file .. "\" \"" .. outputPath .. "\"")
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
if (config ~= Aurora.Settings.sNameOfShip) then
|
2024-06-29 13:37:41 +00:00
|
|
|
local debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".dwarf"
|
2022-03-20 08:01:11 +00:00
|
|
|
postbuildcommands("objcopy --add-gnu-debuglink=\"" .. debugSymbolPath .. "\" \"" .. outputPath .. "\"")
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
|
|
|
if (not Aurora.Settings.bUseAuBuildHooks) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
if (platform.forcePortableLibc and not os.getenv("AURORA_LINK_NOT_PORTABLE")) then
|
|
|
|
local platformSuffix = "System." .. platform.outputName .. "." .. arch
|
2024-06-29 13:37:41 +00:00
|
|
|
local isExec = type == "WindowedApp" or type == "ConsoleApp"
|
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
if (arch == "x86_64" or arch == "ARM64" or arch == "aarch64" or arch == "mips64") then
|
2024-06-29 13:37:41 +00:00
|
|
|
if (isExec) then
|
2024-06-28 10:37:59 +00:00
|
|
|
postbuildcommands("patchelf --set-interpreter \"ld-Aurora.System.Linux.x86_64.so\" \"" .. outputPath .. "\"")
|
2024-06-29 13:37:41 +00:00
|
|
|
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 .. "\" $@")
|
2024-06-28 10:37:59 +00:00
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2024-06-30 02:29:48 +00:00
|
|
|
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
|
2024-06-28 10:37:59 +00:00
|
|
|
else
|
2024-06-29 13:37:41 +00:00
|
|
|
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 .. "\" $@")
|
2024-06-28 10:37:59 +00:00
|
|
|
end
|
2024-06-30 02:29:48 +00:00
|
|
|
|
|
|
|
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
|
2024-06-28 10:37:59 +00:00
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2024-06-30 02:29:48 +00:00
|
|
|
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\"")
|
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
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\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. "System.Linux.x86_64" .. ".so \"" .. dir .. "/libunwind-x86_64.so.8\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. "System.Linux.x86_64" .. ".so \"" .. dir .. "/libunwind-x86_64.so.8\"")
|
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
if (os.isfile(dir .. "/libunwind.so.8")) then
|
|
|
|
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"" .. dir .. "/libunwind.so.8\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"" .. dir .. "/libunwind.so.8\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"" .. dir .. "/libunwind.so.8\"")
|
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
if (os.isfile(dir .. "/liblzma.so.5")) then
|
|
|
|
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"" .. dir .. "/liblzma.so.5\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"" .. dir .. "/liblzma.so.5\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"" .. dir .. "/liblzma.so.5\"")
|
|
|
|
end
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2024-06-28 10:37:59 +00:00
|
|
|
if (os.isfile(dir .. "/liblzma.so.6")) then
|
|
|
|
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"" .. dir .. "/liblzma.so.6\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"" .. dir .. "/liblzma.so.6\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libgcc_s.so.1 libgcc." .. platformSuffix .. ".so \"" .. dir .. "/liblzma.so.6\"")
|
|
|
|
end
|
|
|
|
end
|
2021-11-13 08:31:32 +00:00
|
|
|
else
|
|
|
|
postbuildcommands(copy)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-06-29 13:37:41 +00:00
|
|
|
local function patchPortableElf(name, type, config, platform, platformName, arch, dir)
|
|
|
|
local ext = (platform.exts or {})[type] or ""
|
|
|
|
|
|
|
|
if (not Aurora.Settings.bUseAuBuildHooks) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if (not platform.forcePortableLibc) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if (os.getenv("AURORA_LINK_NOT_PORTABLE")) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local copy, outputPath, file, fileName = formatCpy(Aurora.Settings.sLibPrefix .. name, type, "%{cfg.targetdir}", ext, isWin, config, platformName, arch, name)
|
|
|
|
local platformSuffix = "System." .. platform.outputName .. "." .. arch
|
|
|
|
|
|
|
|
postbuildcommands("patchelf --replace-needed libm.so.6 libm." .. platformSuffix .. ".so \"" .. outputPath .. "\"")
|
|
|
|
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. platformSuffix .. ".so \"" .. outputPath .. "\"")
|
|
|
|
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
|
2024-06-30 02:29:48 +00:00
|
|
|
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("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
|
2024-06-29 13:37:41 +00:00
|
|
|
else
|
2024-06-30 02:29:48 +00:00
|
|
|
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
|
2024-06-29 13:37:41 +00:00
|
|
|
end
|
|
|
|
|
2024-06-30 02:29:48 +00:00
|
|
|
postbuildcommands("patchelf --replace-needed libc.so.6 libc." .. 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\"")
|
|
|
|
|
2024-06-29 13:37:41 +00:00
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
local function addDest(name, projectType, dest)
|
|
|
|
local lookup = {}
|
|
|
|
local append = ""
|
2024-06-29 13:37:41 +00:00
|
|
|
|
2021-11-16 10:38:53 +00:00
|
|
|
if (isNoLinkType(projectType)) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
if (dest:starts(kPathPrefix)) then
|
|
|
|
append = dest:sub(#kPathPrefix + 1)
|
|
|
|
local fu = auFilterConfig(Aurora.Settings.sNameOfDebug)
|
|
|
|
|
|
|
|
lookup[Aurora.Settings.sNameOfDebug] = normalizeCpyPath(Aurora.Settings.sAbsDebug)
|
|
|
|
lookup[Aurora.Settings.sNameOfInternal] = normalizeCpyPath(Aurora.Settings.sAbsStage)
|
|
|
|
lookup[Aurora.Settings.sNameOfShip] = normalizeCpyPath(Aurora.Settings.sAbsShip)
|
|
|
|
else
|
|
|
|
lookup[Aurora.Settings.sNameOfDebug] = dest
|
|
|
|
lookup[Aurora.Settings.sNameOfInternal] = dest
|
|
|
|
lookup[Aurora.Settings.sNameOfShip] = dest
|
|
|
|
end
|
|
|
|
|
|
|
|
auFilterForConfigPlatforms(function(config, platform, arch)
|
2024-06-28 10:37:59 +00:00
|
|
|
addUserDestCopy(name, projectType, config, platform, arch, lookup[config] .. append, projectType)
|
2021-11-13 08:31:32 +00:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function postBuildCommands(name, type, config, platformName, arch)
|
2022-03-20 08:01:11 +00:00
|
|
|
local compilerDirectOutput = nil
|
|
|
|
|
2022-01-17 20:36:04 +00:00
|
|
|
if (platformName == "win32") then
|
2021-11-13 08:31:32 +00:00
|
|
|
postbuildcommands(formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sAbsSymbols), ".pdb", true, config, platformName, arch, name))
|
|
|
|
|
2024-06-29 13:37:41 +00:00
|
|
|
if (type == "SharedLib" or
|
2021-11-13 08:31:32 +00:00
|
|
|
type == "StaticLib") then
|
2022-02-18 09:08:35 +00:00
|
|
|
postbuildcommands(formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sAbsLinkLibs), ".lib", true, config, platformName, arch, name))
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
else
|
2022-03-20 08:01:11 +00:00
|
|
|
local ext = (Aurora.Platforms[platformName].exts[type] or "")
|
2024-06-29 13:37:41 +00:00
|
|
|
if (type == "SharedLib" or
|
2021-11-13 08:31:32 +00:00
|
|
|
type == "StaticLib") then
|
2022-03-20 08:01:11 +00:00
|
|
|
local ext = (Aurora.Platforms[platformName].exts[type] or "")
|
|
|
|
local cmd = nil
|
|
|
|
cmd, compilerDirectOutput = formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sAbsLinkLibs), ext, false, config, platformName, arch, name)
|
|
|
|
postbuildcommands(cmd)
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
2022-03-20 08:01:11 +00:00
|
|
|
local idc = nil
|
|
|
|
idc, idc, compilerDirectOutput = formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sAbsLinkLibs), ext, false, config, platformName, arch, name)
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
2021-11-16 11:03:56 +00:00
|
|
|
if (config == Aurora.Settings.sNameOfDebug) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local platform = Aurora.Platforms[platformName]
|
|
|
|
if (not platform) then
|
|
|
|
return
|
|
|
|
end
|
2021-11-14 16:38:07 +00:00
|
|
|
|
2021-11-16 11:03:56 +00:00
|
|
|
local debugSymbolPath = nil
|
|
|
|
local debugExt = ""
|
2021-11-13 08:31:32 +00:00
|
|
|
|
2021-11-16 11:03:56 +00:00
|
|
|
if (platform.devChainRequiresElfStrip and
|
|
|
|
platform.devChainSupportsElfStrip) then
|
|
|
|
debugEx = ".dwarf"
|
|
|
|
debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".dwarf"
|
2022-03-20 08:01:11 +00:00
|
|
|
postbuildcommands("objcopy --only-keep-debug \"" .. compilerDirectOutput .. "\" \"" .. debugSymbolPath .. "\"")
|
2024-06-29 13:37:41 +00:00
|
|
|
|
|
|
|
if (type == "SharedLib" or
|
|
|
|
type == "StaticLib") then
|
|
|
|
|
|
|
|
postbuildcommands("objcopy --strip-debug --strip-unneeded \"" .. compilerDirectOutput .. "\"")
|
|
|
|
|
|
|
|
if (config ~= Aurora.Settings.sNameOfShip) then
|
|
|
|
postbuildcommands("objcopy --add-gnu-debuglink=\"" .. debugSymbolPath .. "\" \"" .. compilerDirectOutput .. "\"")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if (type == "SharedLib" or
|
|
|
|
type == "WindowedApp" or
|
|
|
|
type == "ConsoleApp") then
|
|
|
|
patchPortableElf(name, type, config, platform, platformName, arch)
|
|
|
|
end
|
2021-11-16 11:03:56 +00:00
|
|
|
elseif (isWin) then
|
|
|
|
debugEx = ".pdb"
|
|
|
|
debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".pdb"
|
|
|
|
end
|
2021-11-13 08:31:32 +00:00
|
|
|
|
2024-06-29 13:37:41 +00:00
|
|
|
if (debugSymbolPath and
|
2021-11-16 11:03:56 +00:00
|
|
|
config == Aurora.Settings.sNameOfShip) then
|
|
|
|
archiveShipPdb(debugSymbolPath, debugEx)
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-11-14 21:13:52 +00:00
|
|
|
local function startProject(name, projectType)
|
2021-11-13 08:31:32 +00:00
|
|
|
if (not Aurora.Settings.bUseAuBuildHooks) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2021-11-16 11:03:56 +00:00
|
|
|
if (isUtils(projectType)) then
|
2021-11-16 10:38:53 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
auFilterForConfigPlatforms(function(config, platform, arch)
|
|
|
|
postBuildCommands(name, projectType, config, platform, arch)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
startProject = startProject,
|
|
|
|
addDest = addDest
|
2022-03-20 08:01:11 +00:00
|
|
|
}
|