# Alien::SDL3::Native [![Native build](https://github.com/haxmeister/perl-Alien-SDL3-Native/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/haxmeister/perl-Alien-SDL3-Native/actions/workflows/test.yml) [![CPAN version](https://img.shields.io/cpan/v/Alien-SDL3-Native)](https://metacpan.org/dist/Alien-SDL3-Native) [![CPAN Testers](https://img.shields.io/badge/CPAN%20Testers-reports-blue)](https://matrix.cpantesters.org/?dist=Alien-SDL3-Native) [![Perl 5.16+](https://img.shields.io/badge/perl-5.16%2B-blue)](https://metacpan.org/dist/Alien-SDL3-Native) [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE) Native SDL3 development libraries for Perl C and C++ extensions. Uses Alien::Build and Alien::Base, not Xmake or Xrepo. Requires SDL >= 3.2 for system discovery. Source builds use the official SDL 3.4.20 release and its published SHA-256 digest. ## Build cpanm 'ExtUtils::MakeMaker~7.12' 'Alien::Build::MM~2.84' cpanm --installdeps . perl Makefile.PL make make test Set ALIEN_INSTALL_TYPE=share to force the bundled source build or ALIEN_INSTALL_TYPE=system to require a system pkg-config installation. Linux source builds need a compiler, CMake, and native development packages for the desired graphical drivers. For example on Debian: sudo apt install build-essential cmake pkg-config libx11-dev \ libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxfixes-dev \ libxss-dev libwayland-dev libxkbcommon-dev libegl-dev libgl-dev Only a suitable X11 or Wayland development stack is essential for a normal Unix desktop source build. Missing optional X11 extensions (such as XScreenSaver) are disabled automatically by SDL's native CMake checks. Other SDL subsystems and graphics APIs may require additional OS packages. No display server is needed for the smoke tests. For a minimal X11-oriented build on Debian/Ubuntu: sudo apt install build-essential cmake pkg-config libx11-dev libxext-dev libgl-dev On Fedora: sudo dnf install gcc gcc-c++ make cmake pkgconf-pkg-config libX11-devel libXext-devel mesa-libGL-devel If no desktop development stack is present, CMake stops with an actionable diagnostic before compilation. For a deliberately headless installation, explicitly opt in: ALIEN_INSTALL_TYPE=share ALIEN_SDL3_NATIVE_HEADLESS=1 cpanm . This permits (but does not force) a non-desktop build. The same flag permits testing an intentionally headless system SDL. It does not install OS packages or change the capabilities of a system SDL. Do not use a headless-only SDL for applications that require windows. See https://wiki.libsdl.org/SDL3/README-linux#build-dependencies for the full upstream dependency list. ## Testing system discovery Use an independent native prefix when testing the system installation path. Do not point PKG_CONFIG_PATH at this distribution's own installed share directory: Alien::Base can relocate those flags into the current build's empty blib share directory, and reinstalling in system mode can overwrite the metadata for the bundled installation. For example, after installing the bundled build (on Linux): SDL3_PREFIX=$(perl -MAlien::SDL3::Native -e 'print Alien::SDL3::Native->dist_dir') SDL3_TEST_PREFIX=$(mktemp -d) cp -a "$SDL3_PREFIX/include" "$SDL3_PREFIX/lib" "$SDL3_TEST_PREFIX/" make realclean export PKG_CONFIG_PATH="$SDL3_TEST_PREFIX/lib/pkgconfig" export ALIEN_INSTALL_TYPE=system perl Makefile.PL make make test Do not run make install for this temporary system-mode test. Keep the native copy until testing is complete. ## Consumer interface use Alien::SDL3::Native; print Alien::SDL3::Native->cflags, "\n"; print Alien::SDL3::Native->libs, "\n"; The bundled library is static and PIC. Native link flags include its dependencies. This distribution is not a Perl SDL binding and does not bundle SDL_image, SDL_ttf, or SDL_mixer. Initial development targets Linux. Other platforms need native build and link verification. CMake-only system discovery is not implemented yet; source builds use CMake and system detection uses pkg-config. MIT license; SDL retains its upstream zlib license.