SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

67
devel/sdl2/Makefile Normal file
View file

@ -0,0 +1,67 @@
COMMENT= cross-platform multimedia library
V= 2.28.2
DISTNAME= SDL2-${V}
PKGNAME= sdl2-${V}
CATEGORIES= devel
MASTER_SITES= https://www.libsdl.org/release/
SHARED_LIBS= SDL2 0.14 # 2.28.1
HOMEPAGE= https://www.libsdl.org/
MAINTAINER= Thomas Frohwein <thfr@openbsd.org>
DEBUG_PACKAGES= ${BUILD_PACKAGES}
# zlib
PERMIT_PACKAGE= Yes
WANTLIB+= X11 Xcursor Xext Xfixes Xi Xrandr Xrender Xss m pthread samplerate
WANTLIB+= sndio usbhid xcb
# GL library is dlopen'd
WANTLIB+= GL
LIB_DEPENDS= audio/libsamplerate
USE_GMAKE= Yes
SEPARATE_BUILD= Yes
CONFIGURE_STYLE= gnu
MODGNU_CONFIG_GUESS_DIRS= ${WRKSRC} ${WRKSRC}/build-scripts
CONFIGURE_ARGS+= --disable-alsa \
--disable-arts \
--disable-dbus \
--disable-esd \
--disable-ibus \
--disable-hidapi \
--disable-jack \
--disable-libsamplerate-shared \
--disable-libudev \
--disable-nas \
--disable-pulseaudio \
--disable-sndio-shared \
--disable-video-wayland \
--disable-video-wayland-qt-touch \
--disable-wayland-shared \
--disable-x11-shared
CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
.if ${MACHINE_ARCH} == "hppa"
CONFIGURE_ARGS+= --disable-atomic
.endif
# The assembly code contains AltiVec instructions, whose support is not
# properly detected at runtime. Fix SIGILLs on macppc G3s, while keeping
# it for powerpc64.
.if ${MACHINE_ARCH} == "powerpc"
CONFIGURE_ARGS+= --enable-altivec=no
.endif
# tests in test subdir, but interactive and not hooked up to build
NO_TEST= Yes
pre-configure:
${SUBST_CMD} ${WRKSRC}/sdl2-config.cmake.in
.include <bsd.port.mk>

2
devel/sdl2/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (SDL2-2.28.2.tar.gz) = ZLEQL6Igk1FbAu8z3Yc53uG6V+nbumoJKUK4u+0aHF4=
SIZE (SDL2-2.28.2.tar.gz) = 7341117

View file

@ -0,0 +1,12 @@
Index: Makefile.in
--- Makefile.in.orig
+++ Makefile.in
@@ -137,7 +137,7 @@ LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
-LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+LT_LDFLAGS = -no-undefined -rpath $(libdir) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)

View file

@ -0,0 +1,12 @@
Index: sdl2-config.cmake.in
--- sdl2-config.cmake.in.orig
+++ sdl2-config.cmake.in
@@ -134,7 +134,7 @@ if(WIN32)
unset(_sdl2_implib)
unset(_sdl2_dll)
else()
- set(_sdl2_shared "${SDL2_LIBDIR}/libSDL2${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ set(_sdl2_shared "${SDL2_LIBDIR}/libSDL2${CMAKE_SHARED_LIBRARY_SUFFIX}.${LIBSDL2_VERSION}")
if(EXISTS "${_sdl2_shared}")
if(NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 SHARED IMPORTED)

View file

@ -0,0 +1,16 @@
Index: sdl2-config.in
--- sdl2-config.in.orig
+++ sdl2-config.in
@@ -46,10 +46,10 @@ while test $# -gt 0; do
echo @SDL_VERSION@
;;
--cflags)
- echo -I@includedir@/SDL2 @SDL_CFLAGS@
+ echo -I@includedir@ -I@includedir@/SDL2 @SDL_CFLAGS@ @X_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
+@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ @X_LIBS@
@ENABLE_SHARED_TRUE@ ;;
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)

View file

@ -0,0 +1,11 @@
Index: sdl2.pc.in
--- sdl2.pc.in.orig
+++ sdl2.pc.in
@@ -10,5 +10,5 @@ Description: Simple DirectMedia Layer is a cross-platf
Version: @SDL_VERSION@
Requires.private: @PKGCONFIG_DEPENDS@
Conflicts:
-Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@
-Cflags: -I${includedir} -I${includedir}/SDL2 @SDL_CFLAGS@
+Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @X_LIBS@
+Cflags: -I${includedir}/SDL2 @SDL_CFLAGS@ @X_CFLAGS@

View file

@ -0,0 +1,16 @@
- Allow custom SDL GetPlatform name with env var SDL_PLATFORM
Index: src/SDL.c
--- src/SDL.c.orig
+++ src/SDL.c
@@ -544,6 +544,10 @@ int SDL_GetRevisionNumber(void)
/* Get the name of the platform */
const char *SDL_GetPlatform(void)
{
+ const char *platform;
+ if (platform = SDL_getenv("SDL_PLATFORM")) {
+ return platform;
+ }
#if __AIX__
return "AIX";
#elif __ANDROID__

View file

@ -0,0 +1,108 @@
restore Y/RY axis inversion for XInput controllers for now, pending
a more permanent upstream solution to this
https://github.com/libsdl-org/SDL/issues/7609#issuecomment-1522831640
backport D-pad calculation by bitwise operation
https://github.com/libsdl-org/SDL/pull/7996
Index: src/joystick/bsd/SDL_bsdjoystick.c
--- src/joystick/bsd/SDL_bsdjoystick.c.orig
+++ src/joystick/bsd/SDL_bsdjoystick.c
@@ -93,40 +93,11 @@
#define HUG_DPAD_RIGHT 0x92
#define HUG_DPAD_LEFT 0x93
-#define HAT_CENTERED 0x00
#define HAT_UP 0x01
#define HAT_RIGHT 0x02
#define HAT_DOWN 0x04
#define HAT_LEFT 0x08
-#define HAT_RIGHTUP (HAT_RIGHT | HAT_UP)
-#define HAT_RIGHTDOWN (HAT_RIGHT | HAT_DOWN)
-#define HAT_LEFTUP (HAT_LEFT | HAT_UP)
-#define HAT_LEFTDOWN (HAT_LEFT | HAT_DOWN)
-/* calculate the value from the state of the dpad */
-int dpad_to_sdl(Sint32 *dpad)
-{
- if (dpad[2]) {
- if (dpad[0])
- return HAT_RIGHTUP;
- else if (dpad[1])
- return HAT_RIGHTDOWN;
- else
- return HAT_RIGHT;
- } else if (dpad[3]) {
- if (dpad[0])
- return HAT_LEFTUP;
- else if (dpad[1])
- return HAT_LEFTDOWN;
- else
- return HAT_LEFT;
- } else if (dpad[0]) {
- return HAT_UP;
- } else if (dpad[1]) {
- return HAT_DOWN;
- }
- return HAT_CENTERED;
-}
#endif
struct report
@@ -711,6 +682,18 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy)
/* scaleaxe */
v = (Sint32)hid_get_data(REP_BUF_DATA(rep), &hitem);
v = (((SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) * (v - hitem.logical_minimum)) / (hitem.logical_maximum - hitem.logical_minimum)) + SDL_JOYSTICK_AXIS_MIN;
+#ifdef __OpenBSD__
+ /* XInput controllermapping relies on inverted Y axes.
+ * These devices have a 16bit signed space, as opposed
+ * to older DInput devices (8bit unsigned), so
+ * hitem.logical_maximum can be used to differentiate them.
+ */
+ if ((joyaxe == JOYAXE_Y || joyaxe == JOYAXE_RY)
+ && hitem.logical_maximum > 255) {
+ if (v != 0)
+ v = ~v;
+ }
+#endif
SDL_PrivateJoystickAxis(joy, naxe, v);
} else if (usage == HUG_HAT_SWITCH) {
v = (Sint32)hid_get_data(REP_BUF_DATA(rep), &hitem);
@@ -719,19 +702,29 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy)
hitem.logical_minimum);
}
#ifdef __OpenBSD__
- else if (usage == HUG_DPAD_UP) {
+ /* here D-pad directions are reported like separate buttons.
+ * calculate the SDL hat value from the 4 separate values.
+ */
+ switch (usage) {
+ case HUG_DPAD_UP:
dpad[0] = (Sint32)hid_get_data(REP_BUF_DATA(rep), &hitem);
- SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
- } else if (usage == HUG_DPAD_DOWN) {
+ break;
+ case HUG_DPAD_DOWN:
dpad[1] = (Sint32)hid_get_data(REP_BUF_DATA(rep), &hitem);
- SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
- } else if (usage == HUG_DPAD_RIGHT) {
+ break;
+ case HUG_DPAD_RIGHT:
dpad[2] = (Sint32)hid_get_data(REP_BUF_DATA(rep), &hitem);
- SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
- } else if (usage == HUG_DPAD_LEFT) {
+ break;
+ case HUG_DPAD_LEFT:
dpad[3] = (Sint32)hid_get_data(REP_BUF_DATA(rep), &hitem);
- SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
+ break;
+ //default:
+ // no-op
}
+ SDL_PrivateJoystickHat(joy, 0, (dpad[0] * HAT_UP) |
+ (dpad[1] * HAT_DOWN) |
+ (dpad[2] * HAT_RIGHT) |
+ (dpad[3] * HAT_LEFT) );
#endif
break;
}

4
devel/sdl2/pkg/DESCR Normal file
View file

@ -0,0 +1,4 @@
Simple DirectMedia Layer is a cross-platform multimedia
library designed to provide fast access to the graphics
framebuffer and audio device. It is used by MPEG playback
software, emulators, and many popular games.

95
devel/sdl2/pkg/PLIST Normal file
View file

@ -0,0 +1,95 @@
bin/sdl2-config
include/SDL2/
include/SDL2/SDL.h
include/SDL2/SDL_assert.h
include/SDL2/SDL_atomic.h
include/SDL2/SDL_audio.h
include/SDL2/SDL_bits.h
include/SDL2/SDL_blendmode.h
include/SDL2/SDL_clipboard.h
include/SDL2/SDL_config.h
include/SDL2/SDL_cpuinfo.h
include/SDL2/SDL_egl.h
include/SDL2/SDL_endian.h
include/SDL2/SDL_error.h
include/SDL2/SDL_events.h
include/SDL2/SDL_filesystem.h
include/SDL2/SDL_gamecontroller.h
include/SDL2/SDL_gesture.h
include/SDL2/SDL_guid.h
include/SDL2/SDL_haptic.h
include/SDL2/SDL_hidapi.h
include/SDL2/SDL_hints.h
include/SDL2/SDL_joystick.h
include/SDL2/SDL_keyboard.h
include/SDL2/SDL_keycode.h
include/SDL2/SDL_loadso.h
include/SDL2/SDL_locale.h
include/SDL2/SDL_log.h
include/SDL2/SDL_main.h
include/SDL2/SDL_messagebox.h
include/SDL2/SDL_metal.h
include/SDL2/SDL_misc.h
include/SDL2/SDL_mouse.h
include/SDL2/SDL_mutex.h
include/SDL2/SDL_name.h
include/SDL2/SDL_opengl.h
include/SDL2/SDL_opengl_glext.h
include/SDL2/SDL_opengles.h
include/SDL2/SDL_opengles2.h
include/SDL2/SDL_opengles2_gl2.h
include/SDL2/SDL_opengles2_gl2ext.h
include/SDL2/SDL_opengles2_gl2platform.h
include/SDL2/SDL_opengles2_khrplatform.h
include/SDL2/SDL_pixels.h
include/SDL2/SDL_platform.h
include/SDL2/SDL_power.h
include/SDL2/SDL_quit.h
include/SDL2/SDL_rect.h
include/SDL2/SDL_render.h
include/SDL2/SDL_revision.h
include/SDL2/SDL_rwops.h
include/SDL2/SDL_scancode.h
include/SDL2/SDL_sensor.h
include/SDL2/SDL_shape.h
include/SDL2/SDL_stdinc.h
include/SDL2/SDL_surface.h
include/SDL2/SDL_system.h
include/SDL2/SDL_syswm.h
include/SDL2/SDL_test.h
include/SDL2/SDL_test_assert.h
include/SDL2/SDL_test_common.h
include/SDL2/SDL_test_compare.h
include/SDL2/SDL_test_crc32.h
include/SDL2/SDL_test_font.h
include/SDL2/SDL_test_fuzzer.h
include/SDL2/SDL_test_harness.h
include/SDL2/SDL_test_images.h
include/SDL2/SDL_test_log.h
include/SDL2/SDL_test_md5.h
include/SDL2/SDL_test_memory.h
include/SDL2/SDL_test_random.h
include/SDL2/SDL_thread.h
include/SDL2/SDL_timer.h
include/SDL2/SDL_touch.h
include/SDL2/SDL_types.h
include/SDL2/SDL_version.h
include/SDL2/SDL_video.h
include/SDL2/SDL_vulkan.h
include/SDL2/begin_code.h
include/SDL2/close_code.h
lib/cmake/
lib/cmake/SDL2/
lib/cmake/SDL2/sdl2-config-version.cmake
lib/cmake/SDL2/sdl2-config.cmake
@static-lib lib/libSDL2.a
lib/libSDL2.la
@lib lib/libSDL2.so.${LIBSDL2_VERSION}
@static-lib lib/libSDL2_test.a
lib/libSDL2_test.la
@static-lib lib/libSDL2main.a
lib/libSDL2main.la
lib/pkgconfig/sdl2.pc
share/aclocal/
share/aclocal/sdl2.m4
share/doc/pkg-readmes/${PKGSTEM}

22
devel/sdl2/pkg/README Normal file
View file

@ -0,0 +1,22 @@
+-----------------------------------------------------------------------
| Customizing ${PKGSTEM} gamecontroller layout on OpenBSD
+-----------------------------------------------------------------------
The mapping for SDL2's gamecontroller API is currently based on a workaround.
It defaults to:
"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,\
dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,\
leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,\
righty:a4,start:b7,x:b2,y:b3,"
A custom mapping can be used via the SDL_GAMECONTROLLERCONFIG env var. Note
that the first value (for guid) should be 'none' and the second one can be any
name under which SDL2 will list the gamecontroller device.
Example mapping (for Logitech Dual Action gamepad):
$ export SDL_GAMECONTROLLERCONFIG="none,X360WirelessController,a:b1,b:b2,\
back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,\
leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,\
righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,"