makedepends=(cmake jack wayland-protocols alsa-lib pulseaudio xorg-libxrandr xorg-libxinerama libxkbcommon
             xorg-libxscrnsaver libdecor vulkan-headers xorg-libxext xorg-libxrender xorg-libx11
             ibus xorg-libxcursor hidapi libusb mesa libglvnd)

description="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 3)"
url="https://www.libsdl.org"

packager="Great-OS Team"
maintainer="Great-OS Team"

name="sdl3"
version="3.4.0"
release=2

source=(https://github.com/libsdl-org/SDL/releases/download/release-$version/SDL3-$version.tar.gz https://github.com/libsdl-org/SDL/releases/download/release-$version/SDL3-$version.tar.gz.sig)

build() { 
    CFLAGS+=" -ffat-lto-objects";

    cmake -S SDL3-${version} \
          -B build \
          -G Ninja \
          -D CMAKE_BUILD_TYPE=None \
          -D CMAKE_INSTALL_PREFIX=/usr \
          -D SDL_STATIC=OFF \
          -D SDL_RPATH=OFF
    cmake --build build

    DESTDIR="${PKG}" cmake --install build

    install -Dm644 SDL3-${version}/LICENSE.txt "$PKG/usr/share/licenses/$name-$version/LICENSE"
}
