Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
devel/sdl20: evdev fix attempt?? (ehh)
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed Apr 6, 2020
1 parent b6b3229 commit fb963dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion devel/sdl20/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ CONFIGURE_ARGS+= ac_cv_lib_iconv_iconv_open=yes ac_cv_func_iconv=yes
.endif

post-patch:
@${REINPLACE_CMD} -e '/ CheckInputEvents$$/d' \
@${REINPLACE_CMD} \
-e 's/-liconv/${ICONV_LIB}/g' ${WRKSRC}/configure
# Clang does not provide _m_prefetch
@${REINPLACE_CMD} 's/_m_prefetch/__builtin_prefetch/' \
Expand Down
11 changes: 11 additions & 0 deletions devel/sdl20/files/patch-src_joystick_linux_SDL__sysjoystick.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/joystick/linux/SDL_sysjoystick.c.orig 2020-03-09 22:15:34 UTC
+++ src/joystick/linux/SDL_sysjoystick.c
@@ -26,6 +26,8 @@
#error SDL now requires a Linux 2.4+ kernel with /dev/input/event support.
#endif

+#define DEBUG_INPUT_EVENTS 1
+#define DEBUG_JOYSTICK 1
/* This is the Linux implementation of the SDL joystick API */

#include <sys/stat.h>

7 comments on commit fb963dd

@shkhln
Copy link

@shkhln shkhln commented on fb963dd Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it goes something like this:

diff --git a/devel/sdl20/Makefile b/devel/sdl20/Makefile
index 7dc5bbcab112..b5db575ec41f 100644
--- a/devel/sdl20/Makefile
+++ b/devel/sdl20/Makefile
@@ -52,14 +52,14 @@ CONFIGURE_ARGS+=	--disable-sse3
 
 MAKE_ENV=	V=1
 
-OPTIONS_DEFINE=		ALSA ASM DLOPEN HIDAPI JACK NAS OSS	\
+OPTIONS_DEFINE=		ALSA ASM DLOPEN EVDEV HIDAPI JACK NAS OSS	\
 			PULSEAUDIO SAMPLERATE SNDIO PTHREADS		\
 			SDL_ATOMIC SDL_AUDIO SDL_CPUINFO SDL_EVENTS	\
 			SDL_FILE SDL_HAPTIC SDL_JOYSTICK SDL_LOADSO	\
 			SDL_POWER SDL_RENDER SDL_THREADS SDL_TIMERS	\
 			SDL_VIDEO UDEV VIDEO_KMSDRM VIDEO_OPENGL	\
 			VIDEO_OPENGLES2 VIDEO_WAYLAND VIDEO_X11
-OPTIONS_DEFAULT=	ASM DLOPEN OSS PTHREADS SDL_ATOMIC SDL_AUDIO	\
+OPTIONS_DEFAULT=	ASM DLOPEN EVDEV OSS PTHREADS SDL_ATOMIC SDL_AUDIO	\
 			SDL_CPUINFO SDL_EVENTS SDL_FILE SDL_HAPTIC	\
 			SDL_JOYSTICK SDL_LOADSO SDL_POWER SDL_RENDER	\
 			SDL_THREADS SDL_TIMERS SDL_VIDEO VIDEO_KMSDRM	\
@@ -103,6 +103,7 @@ ALTIVEC_CONFIGURE_ENABLE=	altivec
 ASM_CONFIGURE_ENABLE=		assembly
 DLOPEN_CONFIGURE_ENABLE=	sdl-dlopen
 DLOPEN_CONFIGURE_OFF=		--disable-video-vulkan
+EVDEV_BUILD_DEPENDS=		${LOCALBASE}/include/linux/input.h:devel/evdev-proto
 HIDAPI_CONFIGURE_ENABLE=	hidapi
 HIDAPI_IMPLIES=			SDL_JOYSTICK
 PTHREADS_CONFIGURE_ENABLE=	pthreads pthread-sem
@@ -277,8 +278,12 @@ CONFIGURE_ARGS+=	ac_cv_lib_iconv_iconv_open=yes ac_cv_func_iconv=yes
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e '/ CheckInputEvents$$/d' \
-		-e 's/-liconv/${ICONV_LIB}/g' ${WRKSRC}/configure
+.if ${PORT_OPTIONS:MEVDEV}
+	@${REINPLACE_CMD} -e '/ CheckUSBHID$$/d' ${WRKSRC}/configure
+.else
+	@${REINPLACE_CMD} -e '/ CheckInputEvents$$/d' ${WRKSRC}/configure
+.endif
+	@${REINPLACE_CMD} -e 's/-liconv/${ICONV_LIB}/g' ${WRKSRC}/configure
 # Clang does not provide _m_prefetch
 	@${REINPLACE_CMD} 's/_m_prefetch/__builtin_prefetch/' \
 		${WRKSRC}/configure ${WRKSRC}/src/video/SDL_blit_A.c
diff --git a/devel/sdl20/files/patch-configure.patch b/devel/sdl20/files/patch-configure.patch
new file mode 100644
index 000000000000..8c07ef7d1792
--- /dev/null
+++ b/devel/sdl20/files/patch-configure.patch
@@ -0,0 +1,20 @@
+--- configure.orig	2020-03-20 05:38:47.438439000 +0300
++++ configure	2020-03-20 05:39:48.991686000 +0300
+@@ -24526,7 +24526,7 @@
+         # Set up files for the joystick library
+         if test x$enable_joystick = xyes; then
+           case $ARCH in
+-            linux)
++            linux|freebsd)
+ 
+ $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h
+ 
+@@ -24547,7 +24547,7 @@
+         # Set up files for the haptic library
+         if test x$enable_haptic = xyes; then
+           case $ARCH in
+-            linux)
++            linux|freebsd)
+                 if test x$use_input_events = xyes; then
+ 
+ $as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h

@valpackett
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@${REINPLACE_CMD} -e '/ CheckUSBHID$$/d' ${WRKSRC}/configure

@shkhln oh, it always prefers directly using USB and I have to disable USB HID to make it use evdev? hmm

@shkhln
Copy link

@shkhln shkhln commented on fb963dd Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it simply doesn't build. I didn't pay much attention to it, to be honest. There might or might not be some way to enable both backends.

@shkhln
Copy link

@shkhln shkhln commented on fb963dd Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is a case of name collision, both backends are named SDL_sysjoystick.c.

@valpackett
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file names are not meaningful in C, that's fine

@shkhln
Copy link

@shkhln shkhln commented on fb963dd Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…except when they are being compiled to objs with the same path.

@valpackett
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, a good build system (i.e. meson) would not put them in the same directory

.. but this uses autoconf stuff

Please sign in to comment.