Alien-SDL3

 view release on metacpan or  search on metacpan

lib/Alien/SDL3.pm  view on Meta::CPAN


            # install_opts() is only the runtime's dynamic-resolution ambient; the build engine reads the
            # recipe's `defaults`. Folding install_opts() in here is what actually hands -a (and the Windows
            # toolchain below) to `perl Build`, keeping the built profile and dynamic resolution in step.
            my %defaults = ( system => 1, $self->install_opts );

            # ALIEN_SDL3_XMAKE_DEBUG=1 forwards -v/-D to `xrepo install` (Alien::Xrepo's
            # verbose/diagnosis, which needs v1.0.9+) so a package that fails to build prints
            # its whole install.txt instead of only the tail. That is what turns an opaque
            # `=> install libsdl3 .. failed` into the real error. Off by default: the
            # diagnostic detail is large and is only wanted while debugging a build.
            if ( $ENV{ALIEN_SDL3_XMAKE_DEBUG} ) {
                $defaults{verbose}   = 1;
                $defaults{diagnosis} = 1;
            }
            return {
                name     => 'Alien-SDL3',
                packages => [
                    { name => 'libsdl3',       kind => 'shared' },
                    { name => 'libsdl3_image', kind => 'shared', required => 0 },
                    { name => 'libsdl3_ttf',   kind => 'shared', required => 0 },

recipes/packages/l/libsdl3/xmake.lua  view on Meta::CPAN

                if not os.isfile(probe[2]) then
                    table.insert(missing, probe[1])
                end
            end
            if #missing > 0 then
                raise("libsdl3 requires the system X11/Wayland development packages. Missing: %s.\nInstall them with:\n  sudo apt-get update && sudo apt-get install -y %s",
                      table.concat(missing, ", "),
                      "libx11-dev libxcb1-dev libxext-dev libxfixes-dev libxcursor-dev libxrandr-dev libxi-dev libxrender-dev libxss-dev libxkbcommon-dev libwayland-dev")
            end
        end
        local libsuffix = package:is_debug() and "d" or ""
        if not package:config("shared") then
            if package:is_plat("windows", "mingw") then
                package:add("syslinks", "user32", "gdi32", "winmm", "imm32", "ole32", "oleaut32", "version", "uuid", "advapi32", "setupapi", "shell32")
            elseif package:is_plat("linux", "bsd") then
                package:add("syslinks", "pthread", "dl")
                if package:is_plat("bsd") then
                    package:add("syslinks", "usbhid")
                end
            elseif package:is_plat("android") then
                package:add("syslinks", "dl", "log", "android", "GLESv1_CM", "GLESv2", "OpenSLES")

recipes/packages/l/libsdl3/xmake.lua  view on Meta::CPAN

            package:add("bindirs", "bin")
            package:add("links", linkname)
        end

        if package:is_plat("windows") then
            _install_windows_prebuilt(package, "SDL", "SDL3", "SDL3")
            return
        end

        local configs = {}
        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
        table.insert(configs, "-DSDL_TEST_LIBRARY=OFF")
        table.insert(configs, "-DSDL_EXAMPLES=OFF")
        if package:is_plat("linux", "bsd", "cross") then
            table.insert(configs, "-DSDL_X11=" .. (package:config("x11") and "ON" or "OFF"))
            table.insert(configs, "-DSDL_X11_SHARED=" .. (package:config("x11_shared") and "ON" or "OFF"))
            table.insert(configs, "-DSDL_X11_XTEST=OFF")
            table.insert(configs, "-DSDL_WAYLAND=" .. (package:config("wayland") and "ON" or "OFF"))
            table.insert(configs, "-DSDL_WAYLAND_SHARED=" .. (package:config("wayland_shared") and "ON" or "OFF"))
        end

recipes/packages/l/libsdl3_image/xmake.lua  view on Meta::CPAN

            package:add("bindirs", "bin")
            package:add("links", linkname)
        end

        if package:is_plat("windows") then
            _install_windows_prebuilt(package, "SDL_image", "SDL3_image", "SDL3_image")
            return
        end

        local configs = {"-DSDLIMAGE_SAMPLES=OFF", "-DSDLIMAGE_TESTS=OFF", "-DSDLIMAGE_VENDORED=OFF"}
        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package: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("IMG_Version", {includes = "SDL3_image/SDL_image.h"}))
    end)

recipes/packages/l/libsdl3_mixer/xmake.lua  view on Meta::CPAN

            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)

recipes/packages/l/libsdl3_ttf/xmake.lua  view on Meta::CPAN

            package:add("bindirs", "bin")
            package:add("links", linkname)
        end

        if package:is_plat("windows") then
            _install_windows_prebuilt(package, "SDL_ttf", "SDL3_ttf", "SDL3_ttf")
            return
        end

        local configs = {"-DSDLTTF_SAMPLES=OFF", "-DSDLTTF_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"))
        table.insert(configs, "-DSDLTTF_HARFBUZZ=" .. (package:config("harfbuzz") and "ON" or "OFF"))
        table.insert(configs, "-DSDLTTF_PLUTOSVG=" .. (package:config("plutosvg") and "ON" or "OFF"))
        local freetype = package:dep("freetype")
        if freetype then
            local fetchinfo = freetype:fetch()
            if fetchinfo then
                local includedirs = table.wrap(fetchinfo.includedirs or fetchinfo.sysincludedirs)
                if #includedirs > 0 then
                    -- Freetype fix: see the header comment at the top of this file.



( run in 1.538 second using v1.01-cache-2.11-cpan-c32d3c3b8f1 )