2022-02-05 14:23:32 +00:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present 5schatten (https://github.com/5schatten)
2023-10-24 16:00:57 +00:00
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
2022-02-05 14:23:32 +00:00
PKG_NAME = "SDL2"
2023-11-13 22:18:49 +00:00
PKG_VERSION = "2.28.5"
2022-02-05 14:23:32 +00:00
PKG_LICENSE = "GPL"
PKG_SITE = "https://www.libsdl.org/"
2022-07-11 12:08:11 +00:00
PKG_URL = " https://www.libsdl.org/release/SDL2- ${ PKG_VERSION } .tar.gz "
2023-09-21 10:51:36 +00:00
PKG_DEPENDS_HOST = "toolchain"
PKG_DEPENDS_TARGET = "toolchain alsa-lib systemd dbus pulseaudio libdrm SDL2:host"
2022-02-05 14:23:32 +00:00
PKG_LONGDESC = "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware."
PKG_DEPENDS_HOST = "toolchain:host distutilscross:host"
2022-07-11 12:08:11 +00:00
i f [ ! "${OPENGL}" = "no" ] ; t h e n
2022-08-30 00:32:44 +00:00
PKG_DEPENDS_TARGET += " ${ OPENGL } glu "
2022-09-02 21:46:22 +00:00
PKG_CMAKE_OPTS_TARGET += " -DSDL_OPENGL=ON \
-DVIDEO_OPENGL= ON \
-DVIDEO_KMSDRM= OFF"
e l s e
PKG_CMAKE_OPTS_TARGET += " -DSDL_OPENGL=OFF \
-DVIDEO_OPENGL= OFF \
-DVIDEO_KMSDRM= OFF"
2022-07-11 12:08:11 +00:00
f i
2022-08-30 00:32:44 +00:00
i f [ "${OPENGLES_SUPPORT}" = "yes" ] ; t h e n
2022-07-11 12:08:11 +00:00
PKG_DEPENDS_TARGET += " ${ OPENGLES } "
2022-09-02 21:46:22 +00:00
PKG_CMAKE_OPTS_TARGET += " -DSDL_OPENGLES=ON \
-DVIDEO_OPENGLES= ON \
-DVIDEO_KMSDRM= ON"
e l s e
PKG_CMAKE_OPTS_TARGET += " -DSDL_OPENGLES=OFF \
-DVIDEO_OPENGLES= OFF \
-DVIDEO_KMSDRM= OFF"
2022-07-11 22:30:36 +00:00
f i
2022-08-30 00:32:44 +00:00
i f [ "${VULKAN_SUPPORT}" = "yes" ] ; t h e n
PKG_DEPENDS_TARGET += " vulkan-loader vulkan-headers"
2022-09-02 21:46:22 +00:00
PKG_CMAKE_OPTS_TARGET += " -DSDL_VULKAN=ON \
-DVIDEO_OPENGL= OFF \
-DVIDEO_VULKAN= ON"
e l s e
PKG_CMAKE_OPTS_TARGET += " -DSDL_VULKAN=OFF \
-DVIDEO_VULKAN= OFF"
2022-08-30 00:32:44 +00:00
f i
2022-08-28 11:19:32 +00:00
i f [ "${DISPLAYSERVER}" = "wl" ]
2022-07-11 22:30:36 +00:00
t h e n
2022-09-01 06:27:58 +00:00
PKG_DEPENDS_TARGET += " wayland ${ WINDOWMANAGER } "
2022-09-02 21:46:22 +00:00
PKG_CMAKE_OPTS_TARGET += " -DSDL_WAYLAND=ON \
-DVIDEO_WAYLAND= ON \
2023-07-26 10:49:07 +00:00
-DVIDEO_WAYLAND_QT_TOUCH= ON \
2022-09-02 21:46:22 +00:00
-DWAYLAND_SHARED= ON \
-DVIDEO_X11= OFF \
2023-06-12 16:15:36 +00:00
-DSDL_X11= OFF"
2022-08-28 11:19:32 +00:00
e l s e
PKG_CMAKE_OPTS_TARGET += " -DVIDEO_WAYLAND=OFF \
-DVIDEO_WAYLAND_QT_TOUCH= ON \
2022-09-02 21:46:22 +00:00
-DWAYLAND_SHARED= OFF \
-DVIDEO_X11= OFF \
2023-06-12 16:15:36 +00:00
-DSDL_X11= OFF"
2022-07-11 12:08:11 +00:00
f i
2022-02-05 14:23:32 +00:00
2023-09-16 18:58:03 +00:00
c a s e $ { P R O J E C T } i n
Rockchip)
PKG_DEPENDS_TARGET += " librga"
2023-09-21 10:51:36 +00:00
PKG_PATCH_DIRS_TARGET += " ${ DEVICE } "
2023-09-16 18:58:03 +00:00
; ;
e s a c
2022-02-05 14:23:32 +00:00
p r e _ c o n f i g u r e _ t a r g e t ( ) {
2023-09-21 10:51:36 +00:00
2023-09-21 10:57:01 +00:00
if [ -n " ${ PKG_PATCH_DIRS_TARGET } " ]
then
###
### Patching here is necessary to allow SDL2 to be built for
### use by host builds without requiring additional unnecessary
### packages to also be built (and break) during the build.
###
### It may be better served as a hook in scripts/build.
###
2023-09-21 10:51:36 +00:00
2023-09-21 11:15:54 +00:00
if [ -d " ${ PKG_DIR } /patches/ ${ PKG_PATCH_DIRS_TARGET } " ]
then
cd $( get_build_dir SDL2)
for PATCH in ${ PKG_DIR } /patches/${ PKG_PATCH_DIRS_TARGET } /*
do
patch -p1 <${ PATCH }
done
cd -
fi
2023-09-21 10:51:36 +00:00
2023-09-21 10:57:01 +00:00
### End
fi
2023-09-21 10:51:36 +00:00
2022-11-02 21:01:08 +00:00
export LDFLAGS = " ${ LDFLAGS } -ludev "
2022-12-04 12:38:18 +00:00
PKG_CMAKE_OPTS_TARGET += " -DSDL_STATIC=OFF \
2022-02-05 14:23:32 +00:00
-DLIBC= ON \
-DGCC_ATOMICS= ON \
-DALTIVEC= OFF \
-DOSS= OFF \
-DALSA= ON \
-DALSA_SHARED= ON \
-DJACK= OFF \
-DJACK_SHARED= OFF \
-DESD= OFF \
-DESD_SHARED= OFF \
-DARTS= OFF \
-DARTS_SHARED= OFF \
-DNAS= OFF \
-DNAS_SHARED= OFF \
-DLIBSAMPLERATE= OFF \
-DLIBSAMPLERATE_SHARED= OFF \
-DSNDIO= OFF \
-DDISKAUDIO= OFF \
-DDUMMYAUDIO= OFF \
2022-08-28 11:19:32 +00:00
-DVIDEO_X11= OFF \
2022-02-05 14:23:32 +00:00
-DVIDEO_MIR= OFF \
-DMIR_SHARED= OFF \
-DVIDEO_COCOA= OFF \
-DVIDEO_DIRECTFB= OFF \
-DVIDEO_VIVANTE= OFF \
-DDIRECTFB_SHARED= OFF \
-DFUSIONSOUND= OFF \
-DFUSIONSOUND_SHARED= OFF \
-DVIDEO_DUMMY= OFF \
2023-06-12 16:15:36 +00:00
-DINPUT_TSLIB= ON \
-DSDL_HIDAPI_JOYSTICK= ON \
2022-02-05 14:23:32 +00:00
-DPTHREADS= ON \
-DPTHREADS_SEM= ON \
-DDIRECTX= OFF \
-DSDL_DLOPEN= ON \
-DCLOCK_GETTIME= OFF \
-DRPATH= OFF \
-DRENDER_D3D= OFF \
2023-08-07 02:22:19 +00:00
-DPIPEWIRE= ON \
2022-02-05 14:23:32 +00:00
-DPULSEAUDIO= ON"
}
p o s t _ m a k e i n s t a l l _ t a r g e t ( ) {
2022-12-04 12:38:18 +00:00
sed -e " s:\(['=LI]\)/usr:\\1 ${ SYSROOT_PREFIX } /usr:g " -i ${ SYSROOT_PREFIX } /usr/bin/sdl2-config
rm -rf ${ INSTALL } /usr/bin
2022-02-05 14:23:32 +00:00
}