makedepends=(cmake xorg-libx11 libglvnd)
run=(sdl3)

description="An SDL2 compatibility layer that uses SDL3 behind the scenes"
url="https://github.com/libsdl-org/sdl2-compat"

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

name="sdl2-compat"
version="2.32.64"
release=3

source=(https://github.com/libsdl-org/sdl2-compat/releases/download/release-$version/sdl2-compat-$version.tar.gz https://github.com/libsdl-org/sdl2-compat/releases/download/release-$version/sdl2-compat-$version.tar.gz.sig)
build() { 
    CFLAGS+=" -ffat-lto-objects"

    cmake -S sdl2-compat-$version \
          -B build \
          -G Ninja \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DCMAKE_BUILD_TYPE=None
    cmake --build build

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

    #Maybe not a good idea in file conflict...
    ln -s sdl2-compat.pc "${PKG}/usr/lib/pkgconfig/sdl2.pc"

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