void-packages/srcpkgs/SDL2/template
2021-08-19 15:53:35 +02:00

136 lines
3.9 KiB
Bash

# Template file for 'SDL2'
pkgname=SDL2
version=2.0.16
revision=1
build_style=gnu-configure
configure_args="--enable-alsa --disable-esd --disable-rpath --enable-libudev
--enable-clock_gettime --disable-nas --disable-arts --disable-x11-shared
--disable-alsa-shared --disable-pulseaudio-shared --enable-dbus"
hostmakedepends="pkg-config nasm"
makedepends="alsa-lib-devel dbus-devel eudev-libudev-devel libusb-compat-devel
libsamplerate-devel"
short_desc="Simple DirectMedia Layer (version 2)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Zlib"
homepage="https://www.libsdl.org/"
changelog="https://raw.githubusercontent.com/libsdl-org/SDL/main/WhatsNew.txt"
distfiles="https://www.libsdl.org/release/${pkgname}-${version}.tar.gz"
checksum=65be9ff6004034b5b2ce9927b5a4db1814930f169c4b2dae0a1e4697075f287b
# Package build options
build_options="gles opengl pulseaudio pipewire sndio vulkan wayland x11"
build_options_default="gles opengl pulseaudio sndio vulkan wayland x11"
case "$XBPS_TARGET_MACHINE" in
arm*)
build_options+=" rpi"
;;
esac
case "$XBPS_TARGET_MACHINE" in
ppcle*) ;;
*) build_options_default+=" pipewire";;
esac
# SDL_cpuinfo includes altivec.h, which breaks C++ programs with vector keyword
case "$XBPS_TARGET_MACHINE" in
ppc*) configure_args+=" --disable-altivec";;
*) ;;
esac
unset depends
if [ "$build_option_gles" ]; then
configure_args+=" --enable-video-opengles"
# libGLESv2.so.2 is dynamically loaded with dlopen.
shlib_requires="libGLESv2.so.2"
depends+=" virtual?libGLES"
else
configure_args+=" --disable-video-opengles"
fi
if [ "$build_option_rpi" ]; then
# RaspberryPi, use Videocore IV
configure_args+=" --enable-video-opengles"
makedepends+=" rpi-userland-devel"
CFLAGS="-I${XBPS_CROSS_BASE}/opt/vc/include -I${XBPS_CROSS_BASE}/opt/vc/include/interface/vcos/pthreads"
LDFLAGS="-L${XBPS_CROSS_BASE}/opt/vc/lib -Wl,-rpath=/opt/vc/lib"
fi
if [ "$build_option_opengl" ]; then
# libGL.so.1 is dynamically loaded with dlopen.
shlib_requires+=" libGL.so.1"
depends+=" virtual?libGL"
configure_args+=" --enable-video-opengl"
else
configure_args+=" --disable-video-opengl"
fi
if [ "$build_option_opengl" -o "$build_option_gles" ]; then
makedepends+=" glu-devel"
fi
if [ "$build_option_pulseaudio" ]; then
configure_args+=" --enable-pulseaudio"
makedepends+=" pulseaudio-devel"
else
configure_args+=" --disable-pulseaudio"
fi
if [ "$build_option_pipewire" ]; then
configure_args+=" --enable-pipewire"
makedepends+=" pipewire-devel"
else
configure_args+=" --disable-pipewire"
fi
if [ "$build_option_sndio" ]; then
configure_args+=" --enable-sndio"
makedepends+=" sndio-devel"
else
configure_args+=" --disable-sndio"
fi
if [ "$build_option_wayland" ]; then
if [ -z "$build_option_gles" ]; then
msg_error "$pkgname: wayland option requires gles.\n"
fi
configure_args+=" --enable-video-wayland --disable-wayland-shared --enable-libdecor"
makedepends+=" libxkbcommon-devel libdecor-devel wayland-devel wayland-protocols"
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" wayland-devel"
fi
else
configure_args+=" --disable-video-wayland"
fi
if [ "$build_option_x11" ]; then
configure_args+=" --enable-video-x11-xcursor --enable-video-x11-xrandr
--enable-video-x11-xinerama --enable-video-x11-vm
--enable-video-x11-xinput --enable-video-x11-scrnsaver
--enable-video-x11-xshape"
makedepends+=" libSM-devel libXcursor-devel libXinerama-devel libXScrnSaver-devel libXrandr-devel"
else
configure_args+=" --without-x"
fi
if [ "$build_option_vulkan" ]; then
configure_args+=" --enable-video-vulkan"
makedepends+=" Vulkan-Headers vulkan-loader"
else
configure_args+=" --disable-video-vulkan"
fi
SDL2-devel_package() {
short_desc+=" - development files"
depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove usr/bin
vmove usr/include
vmove usr/lib/cmake
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
vmove usr/share
}
}