Alien-SDL3
view release on metacpan or search on metacpan
recipes/packages/l/libsdl3_mixer/xmake.lua view on Meta::CPAN
raise("package(%s): SDL publishes no mingw arm64 prebuilt; use the MSVC toolchain instead",
package:name())
elseif not is_x64 then
-- only i686/x86_64 mingw builds are published
raise("package(%s): no mingw prebuilt for arch %q; use the MSVC toolchain instead",
package:name(), package:arch() or "?")
end
local triple = "x86_64-w64-mingw32"
incdir = path.join(root, triple, "include")
libdir = path.join(root, triple, "lib")
bindir = path.join(root, triple, "bin")
end
if not os.isdir(libdir) then
raise("package(%s): prebuilt archive has no %s for arch %q", package:name(), libdir, package:arch() or "?")
end
local installdir = package:installdir()
local incdst = path.join(installdir, "include")
local libdst = path.join(installdir, "lib")
local bindst = path.join(installdir, "bin")
os.mkdir(incdst); os.mkdir(libdst); os.mkdir(bindst)
-- Copy the *contents* of include/: a bare-dir cp would nest it one level deeper.
os.cp(path.join(incdir, "*"), incdst)
-- Import libraries for the linker.
for _, pattern in ipairs({"*.lib", "*.dll.a", "*.a"}) do
os.cp(path.join(libdir, pattern), libdst)
end
-- Runtime DLLs. Alien::Xrepo picks libpath -- the file FFI dlopens, which
-- t/affix.t load_library()s -- from the first .dll it finds in the install, so
-- the DLL must sit in lib/ as well as bin/, and bin/ is what xmake puts on the
-- PATH it builds for on_test.
os.cp(path.join(libdir, "*.dll"), libdst)
os.cp(path.join(bindir, "*.dll"), bindst)
os.cp(path.join(bindir, "*.dll"), libdst)
-- The VC layout keeps codec DLLs in a side directory next to the main ones.
local optional = path.join(libdir, "optional")
if os.isdir(optional) then
os.cp(path.join(optional, "*.dll"), libdst)
os.cp(path.join(optional, "*.dll"), bindst)
end
-- CMake normally publishes these; a manual install has to declare them, or
-- _generate_configs() raises "links not found!" for every consumer (including
-- this package's own on_test). The dir entries must be relative: the manifest
-- reader joins them onto the installdir itself
-- (modules/package/manager/xmake/find_package.lua:81,144), so an absolute path
-- would come back as installdir/C:/... and find_library would find nothing.
package:add("includedirs", "include")
package:add("linkdirs", "lib")
package:add("bindirs", "bin")
package:add("links", linkname)
end
if package:is_plat("windows") then
_install_windows_prebuilt(package, "SDL_mixer", "SDL3_mixer", "SDL3_mixer")
return
end
local configs = {"-DSDLMIXER_TESTS=OFF", "-DSDLMIXER_EXAMPLES=OFF", "-DSDLMIXER_VENDORED=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("MIX_Version", {includes = "SDL3_mixer/SDL_mixer.h"}))
end)
( run in 1.480 second using v1.01-cache-2.11-cpan-c32d3c3b8f1 )