Skip to content

Commit

Permalink
libsdl2-powerpc: minor fix, revbump
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Dec 1, 2024
1 parent f63743d commit 33c0520
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 15 deletions.
14 changes: 7 additions & 7 deletions devel/libsdl2-powerpc/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PortGroup github 1.0
name libsdl2-powerpc
conflicts libsdl2-snowleopard
github.setup libsdl-org SDL 2.30.9 release-
revision 0
revision 1
categories devel multimedia
platforms {darwin < 11}
supported_archs ppc ppc64
Expand Down Expand Up @@ -48,6 +48,7 @@ configure.args-append \
--disable-video-cocoa \
--disable-video-opengl \
--disable-x11-shared \
--disable-video-wayland \
--enable-video-x11 \
--x-includes=${prefix}/include \
--x-libraries=${prefix}/lib
Expand Down Expand Up @@ -92,7 +93,8 @@ patchfiles-append 0003-hidapi-revert-a-commit-that-triggers-ICE-with-GCC.patch
post-patch {
reinplace "s|@PREFIX@|${prefix}|g" \
${worksrcpath}/include/SDL_config_macosx.h \
${worksrcpath}/src/video/x11/SDL_x11opengl.c
${worksrcpath}/src/video/x11/SDL_x11opengl.c \
${worksrcpath}/configure
}

variant dbus description "Enable DBus support" {
Expand All @@ -102,10 +104,11 @@ variant dbus description "Enable DBus support" {
--disable-dbus --enable-dbus
}

# Not clear why, but enabling OpenGL may lead to system freezes.
# OpenGL via Mesa may lead to system freezes.
# For now, do not enable by default.
variant opengl description "Enable OpenGL support" {
# Mesa dependency needed: https://trac.macports.org/ticket/61943
# Mesa dependency due to: https://trac.macports.org/ticket/61943
# We cannot depend on XQuartz.
depends_lib-append \
port:mesa
configure.args-replace \
Expand All @@ -126,9 +129,6 @@ variant samplerate description "Build with libsamplerate support" {
--disable-libsamplerate --enable-libsamplerate
}

default_variants-append \
+opengl

post-destroot {
set docdir ${prefix}/share/doc/${name}
xinstall -d ${destroot}${docdir}
Expand Down
93 changes: 85 additions & 8 deletions devel/libsdl2-powerpc/files/0002-fix-x11.diff
Original file line number Diff line number Diff line change
@@ -1,10 +1,76 @@
--- include/SDL_config_macosx.h 2023-07-02 01:04:05.000000000 +0800
+++ include/SDL_config_macosx.h 2023-07-23 05:28:30.000000000 +0800
From 93d4278f572935eaacd4bd0b0176afc6c9178b14 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Fri, 29 Nov 2024 07:09:49 +0800
Subject: [PATCH] Sort out X11/OpenGL

---
configure | 28 +++++++++++++++-------------
include/SDL_config_macosx.h | 14 ++++++++------
src/video/x11/SDL_x11opengl.c | 9 ++++++++-
3 files changed, 31 insertions(+), 20 deletions(-)

diff --git configure configure
index cbae11e23..60605c44d 100755
--- configure
+++ configure
@@ -23776,10 +23776,10 @@ fi
# This isn't necessary for X11, but fixes GLX detection
if test "x$x_includes" = xNONE && \
test "x$x_libraries" = xNONE && \
- test -d /opt/X11/include && \
- test -d /opt/X11/lib; then
- x_includes="/opt/X11/include"
- x_libraries="/opt/X11/lib"
+ test -d @PREFIX@/include && \
+ test -d @PREFIX@/lib; then
+ x_includes="@PREFIX@/include"
+ x_libraries="@PREFIX@/lib"
fi
;;
esac
@@ -23876,6 +23876,8 @@ fi
# Standard set of common directories for X headers.
# Check X11 before X11Rn because it is often a symlink to the current release.
ac_x_header_dirs='
+@PREFIX@/include
+
/usr/X11/include
/usr/X11R7/include
/usr/X11R6/include
@@ -24518,15 +24520,15 @@ fi

case "$host" in
*-*-darwin*)
- # Apple now puts this in /opt/X11
- x11_lib='/opt/X11/lib/libX11.6.dylib'
- x11ext_lib='/opt/X11/lib/libXext.6.dylib'
- xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
- xinput_lib='/opt/X11/lib/libXi.6.dylib'
- xfixes_lib='/opt/X11/lib/libXfixes.3.dylib'
- xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
- xrender_lib='/opt/X11/lib/libXrender.1.dylib'
- xss_lib='/opt/X11/lib/libXss.1.dylib'
+ # MacPorts puts this in @PREFIX@
+ x11_lib='@PREFIX@/lib/libX11.6.dylib'
+ x11ext_lib='@PREFIX@/lib/libXext.6.dylib'
+ xcursor_lib='@PREFIX@/lib/libXcursor.1.dylib'
+ xinput_lib='@PREFIX@/lib/libXi.6.dylib'
+ xfixes_lib='@PREFIX@/lib/libXfixes.3.dylib'
+ xrandr_lib='@PREFIX@/lib/libXrandr.2.dylib'
+ xrender_lib='@PREFIX@/lib/libXrender.1.dylib'
+ xss_lib='@PREFIX@/lib/libXss.1.dylib'
;;
*-*-openbsd*)
x11_lib='libX11.so'
diff --git include/SDL_config_macosx.h include/SDL_config_macosx.h
index 2db760a9f..aea6a0c99 100644
--- include/SDL_config_macosx.h
+++ include/SDL_config_macosx.h
@@ -182,14 +182,16 @@
#define SDL_TIMER_UNIX 1

/* Enable various video drivers */
+#if !defined(__POWERPC__)
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#define SDL_VIDEO_DRIVER_COCOA 1
+#endif
#define SDL_VIDEO_DRIVER_DUMMY 1
Expand All @@ -23,15 +89,26 @@
#define SDL_VIDEO_DRIVER_X11_XDBE 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1

--- src/video/x11/SDL_x11opengl.c 2023-07-02 01:04:05.000000000 +0800
+++ src/video/x11/SDL_x11opengl.c 2023-07-23 07:49:24.000000000 +0800
@@ -40,7 +40,8 @@
diff --git src/video/x11/SDL_x11opengl.c src/video/x11/SDL_x11opengl.c
index da252615f..2255c479f 100644
--- src/video/x11/SDL_x11opengl.c
+++ src/video/x11/SDL_x11opengl.c
@@ -21,6 +21,10 @@
*/
#include "../../SDL_internal.h"

+#if defined(__MACOSX__)
+#include <AvailabilityMacros.h>
+#endif
+
#ifdef SDL_VIDEO_DRIVER_X11

#include "SDL_x11video.h"
@@ -40,7 +44,7 @@
*/
#define DEFAULT_OPENGL "libGL.so"
#elif defined(__MACOSX__)
-#define DEFAULT_OPENGL "/opt/X11/lib/libGL.1.dylib"
+#include <AvailabilityMacros.h>
+#define DEFAULT_OPENGL "@PREFIX@/lib/libGL.1.dylib"
#elif defined(__QNXNTO__)
#define DEFAULT_OPENGL "libGL.so.3"
Expand Down

0 comments on commit 33c0520

Please sign in to comment.