Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 May 2024 01:45:29 GMT
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: c14f535ae56a - main - devel/sdl20: switch to cmake
Message-ID:  <202405140145.44E1jTE3080184@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by amdmi3:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c14f535ae56adee7545d94077b4e04f2884c2137

commit c14f535ae56adee7545d94077b4e04f2884c2137
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2024-05-07 18:22:18 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2024-05-14 01:44:10 +0000

    devel/sdl20: switch to cmake
    
    PR:             278353
    Submitted by:   diizzy
---
 devel/sdl20/Makefile                   | 194 +++++++++++++--------------------
 devel/sdl20/files/patch-CMakeLists.txt |  49 +++++++++
 devel/sdl20/files/patch-sdl2-config.in |  12 ++
 devel/sdl20/pkg-plist                  |  15 ++-
 4 files changed, 148 insertions(+), 122 deletions(-)

diff --git a/devel/sdl20/Makefile b/devel/sdl20/Makefile
index ab3b429e5ca0..8c3c594503e4 100644
--- a/devel/sdl20/Makefile
+++ b/devel/sdl20/Makefile
@@ -13,52 +13,25 @@ WWW=		https://www.libsdl.org/ \
 LICENSE=	ZLIB
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-GNU_CONFIGURE=	yes
-USES=		gmake iconv libtool localbase:ldflags pathfix pkgconfig
-USE_CSTD=	c99
+USES=		cmake iconv pkgconfig
+CMAKE_OFF=	SDL_ARTS \
+		SDL_CCACHE \
+		SDL_ESD \
+		SDL_LIBICONV \
+		SDL_RPATH
+CMAKE_ON=	CMAKE_DISABLE_FIND_PACKAGE_Git
 USE_LDCONFIG=	yes
 
-CONFIGURE_ARGS=	--disable-arts \
-		--disable-esd \
-		--disable-rpath
-.if defined(MACHINE_CPU) && ${MACHINE_CPU:Mmmx}
-CONFIGURE_ARGS+=	--enable-mmx
-.else
-CONFIGURE_ARGS+=	--disable-mmx
-.endif
-.if defined(MACHINE_CPU) && ${MACHINE_CPU:M3dnow}
-CONFIGURE_ARGS+=	--enable-3dnow
-.else
-CONFIGURE_ARGS+=	--disable-3dnow
-.endif
-.if defined(MACHINE_CPU) && ${MACHINE_CPU:Msse}
-CONFIGURE_ARGS+=	--enable-sse
-.else
-CONFIGURE_ARGS+=	--disable-sse
-.endif
-.if defined(MACHINE_CPU) && ${MACHINE_CPU:Msse2}
-CONFIGURE_ARGS+=	--enable-sse2
-.else
-CONFIGURE_ARGS+=	--disable-sse2
-.endif
-.if defined(MACHINE_CPU) && ${MACHINE_CPU:Msse3}
-CONFIGURE_ARGS+=	--enable-sse3
-.else
-CONFIGURE_ARGS+=	--disable-sse3
-.endif
-
-MAKE_ENV=	V=1
-
 PORTSCOUT=	limitw:1,even
 
-OPTIONS_DEFINE=		ASM CSD DBUS FCITX IBUS JOYSTICK HIDAPI \
+OPTIONS_DEFINE=		CSD DBUS FCITX IBUS JOYSTICK HIDAPI \
 			SAMPLERATE UDEV
 OPTIONS_GROUP=		AUDIO VIDEO
 OPTIONS_GROUP_AUDIO=	ALSA JACK NAS OSS PIPEWIRE PULSEAUDIO SNDIO
-OPTIONS_GROUP_VIDEO=	KMSDRM OPENGL OPENGLES1 OPENGLES2 VULKAN \
+OPTIONS_GROUP_VIDEO=	KMSDRM OPENGL OPENGLES VULKAN \
 			WAYLAND X11
-OPTIONS_DEFAULT=	ASM JOYSTICK OSS KMSDRM OPENGL \
-			OPENGLES1 OPENGLES2 VULKAN WAYLAND X11
+OPTIONS_DEFAULT=	JOYSTICK OSS KMSDRM OPENGL \
+			OPENGLES VULKAN WAYLAND X11
 OPTIONS_DEFINE_powerpc=	ALTIVEC
 OPTIONS_DEFINE_powerpc64=	ALTIVEC
 OPTIONS_DEFAULT_powerpc=	ALTIVEC
@@ -73,102 +46,87 @@ HIDAPI_DESC=		Use HIDAPI for low level joystick drivers
 IBUS_DESC=		IBus support
 JOYSTICK_DESC=		Joystick and haptic support
 KMSDRM_DESC=		KMSDRM display support
-OPENGLES1_DESC=		OpenGL ES 1.x rendering support
-OPENGLES2_DESC=		OpenGL ES 2.x rendering support
+OPENGLES_DESC=		OpenGL ES rendering support
 UDEV_DESC=		Use udev for input device detection
 VULKAN_DESC=		Vulkan rendering support
 
-ALSA_CONFIGURE_ENABLE=		alsa alsa-shared
-ALSA_LIB_DEPENDS=		libasound.so:audio/alsa-lib
-
-ALTIVEC_CONFIGURE_ENABLE=	altivec
-
-ASM_CONFIGURE_ENABLE=		assembly
+ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
+ALSA_CMAKE_BOOL=	SDL_ALSA
+ALSA_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_ALSA
 
-CSD_CONFIGURE_ENABLE=		libdecor libdecor-shared
-CSD_LIB_DEPENDS=		libdecor-0.so:x11-toolkits/libdecor
-CSD_IMPLIES=			WAYLAND
+ALTIVEC_CMAKE_BOOL=	SDL_ALTIVEC
 
-DBUS_LIB_DEPENDS=		libdbus-1.so:devel/dbus
-DBUS_CONFIGURE_ENABLE=		dbus
+CSD_LIB_DEPENDS=	libdecor-0.so:x11-toolkits/libdecor
+CSD_CMAKE_BOOL=		SDL_WAYLAND_LIBDECOR
+CSD_IMPLIES=		WAYLAND
 
-FCITX_LIB_DEPENDS=		libfcitx-config.so:chinese/fcitx
-FCITX_CONFIGURE_ENABLE=		fcitx
-FCITX_IMPLIES=			DBUS
+DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
+DBUS_CMAKE_BOOL=	SDL_DBUS
 
-HIDAPI_CONFIGURE_ENABLE=	hidapi
-HIDAPI_IMPLIES=			JOYSTICK
+FCITX_LIB_DEPENDS=	libfcitx-config.so:chinese/fcitx
+FCITX_IMPLIES=		DBUS
 
-IBUS_LIB_DEPENDS=		libibus-1.0.so:textproc/ibus
-IBUS_CONFIGURE_ENABLE=		ibus
-IBUS_IMPLIES=			DBUS
+HIDAPI_CMAKE_BOOL=	SDL_HIDAPI
+HIDAPI_IMPLIES=		JOYSTICK
 
-JACK_CONFIGURE_ENABLE=		jack jack-shared
-JACK_LIB_DEPENDS=		libjack.so:audio/jack
+IBUS_LIB_DEPENDS=	libibus-1.0.so:textproc/ibus
+IBUS_CMAKE_BOOL=	SDL_IBUS
+IBUS_IMPLIES=		DBUS
 
-JOYSTICK_CONFIGURE_ENABLE=	joystick haptic
-JOYSTICK_BUILD_DEPENDS=		${LOCALBASE}/include/linux/input.h:devel/evdev-proto
-JOYSTICK_LIB_DEPENDS=		libinotify.so:devel/libinotify
+JACK_LIB_DEPENDS=	libjack.so:audio/jack
+JACK_CMAKE_BOOL=	SDL_JACK
 
-KMSDRM_CONFIGURE_ENABLE=	video-kmsdrm kmsdrm-shared
-KMSDRM_USES=			gl
-KMSDRM_USE=	 		GL=gbm
+JOYSTICK_BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+JOYSTICK_LIB_DEPENDS=	libinotify.so:devel/libinotify
+JOYSTICK_CMAKE_BOOL=	SDL_HIDAPI_JOYSTICK SDL_HIDAPI_LIBUSB SDL_VIRTUAL_JOYSTICK
 
-NAS_CONFIGURE_ENABLE=		nas nas-shared
-NAS_LIB_DEPENDS=		libaudio.so:audio/nas
+KMSDRM_USES=		gl
+KMSDRM_USE=		GL=gbm
+KMSDRM_CMAKE_BOOL=	SDL_KMSDRM
 
-OPENGL_CONFIGURE_ENABLE=	video-opengl
-OPENGL_USES=			gl
-OPENGL_USE=			GL=opengl
+NAS_LIB_DEPENDS=	libaudio.so:audio/nas
+NAS_CMAKE_BOOL=		SDL_NAS
 
-OPENGLES1_CONFIGURE_ENABLE=	video-opengles1
-OPENGLES1_USES=			gl
-OPENGLES1_USE=			GL=egl,glesv1
-OPENGLES1_IMPLIES=		OPENGLES
+OPENGL_USES=		gl
+OPENGL_USE=		GL=opengl
+OPENGL_CMAKE_BOOL=	SDL_OPENGL
 
-OPENGLES2_CONFIGURE_ENABLE=	video-opengles2
-OPENGLES2_USES=			gl
-OPENGLES2_USE=			GL=egl,glesv2
-OPENGLES2_IMPLIES=		OPENGLES
+OPENGLES_USES=		gl
+OPENGLES_USE=		GL=egl,glesv1,glesv2
+OPENGLES_CMAKE_BOOL=	SDL_OPENGLES
 
-OSS_CONFIGURE_ENABLE=		oss
+OSS_CMAKE_BOOL=		SDL_OSS
 
-PIPEWIRE_CONFIGURE_ENABLE=	pipewire pipewire-shared
-PIPEWIRE_LIB_DEPENDS=		libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_LIB_DEPENDS=	libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_CMAKE_BOOL=	SDL_PIPEWIRE
 
-PULSEAUDIO_CONFIGURE_ENABLE=	pulseaudio pulseaudio-shared
-PULSEAUDIO_LIB_DEPENDS=		libpulse.so:audio/pulseaudio
+PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
+PULSEAUDIO_CMAKE_BOOL=	SDL_PULSEAUDIO
 
-SAMPLERATE_CONFIGURE_ENABLE=	libsamplerate libsamplerate-shared
-SAMPLERATE_LIB_DEPENDS=		libsamplerate.so:audio/libsamplerate
+SAMPLERATE_LIB_DEPENDS=	libsamplerate.so:audio/libsamplerate
+SAMPLERATE_CMAKE_BOOL=	SDL_LIBSAMPLERATE
+SAMPLERATE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_SampleRate
 
-SNDIO_CONFIGURE_ENABLE=		sndio sndio-shared
-SNDIO_LIB_DEPENDS=		libsndio.so:audio/sndio
+SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio
+SNDIO_CMAKE_BOOL=	SDL_SNDIO
 
-UDEV_CONFIGURE_ENABLE=		libudev
-UDEV_LIB_DEPENDS=		libudev.so:devel/libudev-devd
-UDEV_BUILD_DEPENDS=		${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+UDEV_BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+UDEV_LIB_DEPENDS=	libudev.so:devel/libudev-devd
+UDEV_CMAKE_BOOL=	SDL_LIBUDEV
 
-VULKAN_CONFIGURE_ENABLE=	video-vulkan
-VULKAN_LIB_DEPENDS=		libvulkan.so:graphics/vulkan-loader
+VULKAN_LIB_DEPENDS=	libvulkan.so:graphics/vulkan-loader
+VULKAN_CMAKE_BOOL=	SDL_VULKAN
 
-WAYLAND_CONFIGURE_ENABLE=	video-wayland wayland-shared video-wayland-qt-touch
-WAYLAND_BUILD_DEPENDS=		wayland-protocols>0:graphics/wayland-protocols \
-				${LOCALBASE}/include/linux/input.h:devel/evdev-proto
-WAYLAND_LIB_DEPENDS=		libwayland-egl.so:graphics/wayland \
-				libxkbcommon.so:x11/libxkbcommon
-WAYLAND_IMPLIES=		OPENGLES2
+WAYLAND_BUILD_DEPENDS=	wayland-protocols>0:graphics/wayland-protocols \
+			${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+WAYLAND_LIB_DEPENDS=	libwayland-egl.so:graphics/wayland \
+			libxkbcommon.so:x11/libxkbcommon
+WAYLAND_CMAKE_BOOL=	SDL_WAYLAND
+WAYLAND_IMPLIES=	OPENGLES
 
-X11_CONFIGURE_ENABLE=		video-x11 x11-shared \
-				video-x11-xcursor \
-				video-x11-xdbe \
-				video-x11-xinput \
-				video-x11-xfixes \
-				video-x11-xrandr \
-				video-x11-scrnsaver \
-				video-x11-xshape
-X11_USES=			xorg
-X11_USE=			XORG=xcursor,xext,xi,xfixes,xrandr,xscrnsaver
+X11_USES=		xorg
+X11_USE=		XORG=x11,xcursor,xext,xi,xfixes,xrandr,xscrnsaver
+X11_CMAKE_BOOL=		SDL_X11
 
 .include <bsd.port.options.mk>
 
@@ -178,16 +136,12 @@ BUILD_DEPENDS+=	${LOCALBASE}/bin/as:devel/binutils
 CFLAGS+=	-B${LOCALBASE}/bin -no-integrated-as
 .endif
 
-.include <bsd.port.pre.mk>
-
-.if !empty(ICONV_LIB)
-CONFIGURE_ARGS+=	ac_cv_lib_iconv_iconv_open=yes ac_cv_func_iconv=yes
-.endif
-
 post-patch:
-	@${REINPLACE_CMD} -e 's/-liconv/${ICONV_LIB}/g' ${WRKSRC}/configure
+	@${REINPLACE_CMD} -e '/dep_option.*Dynamically load/ s|ON|OFF|' \
+		${WRKSRC}/CMakeLists.txt
 
-post-install:
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libSDL2.so
+post-patch-FCITX-off:
+	@${REINPLACE_CMD} -e 's|HAVE_FCITX TRUE|HAVE_FCITX FALSE|g' \
+		${WRKSRC}/CMakeLists.txt
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/devel/sdl20/files/patch-CMakeLists.txt b/devel/sdl20/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..10acb6ef7a95
--- /dev/null
+++ b/devel/sdl20/files/patch-CMakeLists.txt
@@ -0,0 +1,49 @@
+--- CMakeLists.txt.orig	2024-05-01 16:16:27 UTC
++++ CMakeLists.txt
+@@ -404,12 +404,12 @@ set_option(SDL_ASSEMBLY            "Enable assembly ro
+ option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
+ #set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
+ set_option(SDL_ASSEMBLY            "Enable assembly routines" ${OPT_DEF_ASM})
+-dep_option(SDL_SSEMATH             "Allow GCC to use SSE floating point math" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
++#[[ dep_option(SDL_SSEMATH             "Allow GCC to use SSE floating point math" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_SSE                 "Use SSE assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_SSE2                "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_SSE3                "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_MMX                 "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+-dep_option(SDL_3DNOW               "Use 3Dnow! MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
++dep_option(SDL_3DNOW               "Use 3Dnow! MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF) ]]
+ dep_option(SDL_ALTIVEC             "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF)
+ dep_option(SDL_ARMSIMD             "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
+ dep_option(SDL_ARMNEON             "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
+@@ -758,7 +758,7 @@ if(SDL_ASSEMBLY)
+     # TODO: Those all seem to be quite GCC specific - needs to be
+     # reworked for better compiler support
+     set(HAVE_ASSEMBLY TRUE)
+-    if(SDL_MMX)
++#[[ if(SDL_MMX)
+       set(CMAKE_REQUIRED_FLAGS "-mmmx")
+       check_c_source_compiles("
+           #ifdef __MINGW32__
+@@ -881,7 +881,7 @@ if(SDL_ASSEMBLY)
+       endif()
+     else()
+       set(HAVE_SSEMATH TRUE)
+-    endif()
++    endif() ]]
+ 
+     check_include_file("immintrin.h" HAVE_IMMINTRIN_H)
+ 
+@@ -1613,9 +1613,11 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU
+       endif()
+ 
+       if(FREEBSD AND NOT HAVE_INOTIFY)
+-        pkg_search_module(INOTIFY libinotify)
+-        if(INOTIFY_FOUND)
++        pkg_search_module(PC_INOTIFY libinotify)
++        if(PC_INOTIFY_FOUND)
+           set(HAVE_INOTIFY 1)
++          find_path(INOTIFY_INCLUDE_DIRS NAMES sys/inotify.h REQUIRED HINTS ${PC_INOTIFY_INCLUDE_DIRS})
++          find_library(INOTIFY_LIBRARIES NAMES inotify REQUIRED HINTS ${PC_INOTIFY_LIBRARY_DIRS})
+           target_include_directories(sdl-build-options INTERFACE "${INOTIFY_INCLUDE_DIRS}")
+           list(APPEND EXTRA_LIBS ${INOTIFY_LIBRARIES})
+         endif()
diff --git a/devel/sdl20/files/patch-sdl2-config.in b/devel/sdl20/files/patch-sdl2-config.in
new file mode 100644
index 000000000000..fdadb030965a
--- /dev/null
+++ b/devel/sdl20/files/patch-sdl2-config.in
@@ -0,0 +1,12 @@
+TODO: fix all ports which require this and remove this patch
+--- sdl2-config.in.orig	2024-04-14 09:17:31 UTC
++++ sdl2-config.in
+@@ -46,7 +46,7 @@ while test $# -gt 0; do
+       echo @SDL_VERSION@
+       ;;
+     --cflags)
+-      echo -I@includedir@/SDL2 @SDL_CFLAGS@
++      echo -I@includedir@ -I@includedir@/SDL2 @SDL_CFLAGS@
+       ;;
+ @ENABLE_SHARED_TRUE@    --libs)
+ @ENABLE_SHARED_TRUE@      echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
diff --git a/devel/sdl20/pkg-plist b/devel/sdl20/pkg-plist
index c3bb57301925..a43cfa386ca9 100644
--- a/devel/sdl20/pkg-plist
+++ b/devel/sdl20/pkg-plist
@@ -7,6 +7,7 @@ include/SDL2/SDL_bits.h
 include/SDL2/SDL_blendmode.h
 include/SDL2/SDL_clipboard.h
 include/SDL2/SDL_config.h
+include/SDL2/SDL_copying.h
 include/SDL2/SDL_cpuinfo.h
 include/SDL2/SDL_egl.h
 include/SDL2/SDL_endian.h
@@ -77,8 +78,18 @@ include/SDL2/SDL_video.h
 include/SDL2/SDL_vulkan.h
 include/SDL2/begin_code.h
 include/SDL2/close_code.h
-lib/cmake/SDL2/sdl2-config-version.cmake
-lib/cmake/SDL2/sdl2-config.cmake
+lib/cmake/SDL2/SDL2Config.cmake
+lib/cmake/SDL2/SDL2ConfigVersion.cmake
+lib/cmake/SDL2/SDL2Targets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL2/SDL2Targets.cmake
+lib/cmake/SDL2/SDL2mainTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL2/SDL2mainTargets.cmake
+lib/cmake/SDL2/SDL2staticTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL2/SDL2staticTargets.cmake
+lib/cmake/SDL2/SDL2testTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL2/SDL2testTargets.cmake
+lib/cmake/SDL2/sdlfind.cmake
+lib/libSDL2-2.0.so
 lib/libSDL2-2.0.so.0
 lib/libSDL2-2.0.so.0.3000.3
 lib/libSDL2.a



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405140145.44E1jTE3080184>