git: 9633fdc9c4c4 - main - devel/zmusic: GZDoom's music system as a library [NEW PORT]

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 10 Nov 2021 08:38:16 UTC
The branch main has been updated by kevans:

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

commit 9633fdc9c4c40d1082fc2b1d6634550ba5ef131a
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2021-11-01 04:31:20 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-11-10 08:38:07 +0000

    devel/zmusic: GZDoom's music system as a library [NEW PORT]
    
    This library is currently used in GZDoom, Raze, and may be used in the
    newer PrBoom+.
    
    WWW: https://github.com/coelckers/gzdoom
---
 devel/Makefile                                     |  1 +
 devel/zmusic/Makefile                              | 31 ++++++++++++++++
 devel/zmusic/distinfo                              |  3 ++
 devel/zmusic/files/patch-source_CMakeLists.txt     | 41 ++++++++++++++++++++++
 ...-thirdparty_game-music-emu_gme_blargg__endian.h | 13 +++++++
 devel/zmusic/pkg-descr                             |  5 +++
 devel/zmusic/pkg-plist                             | 13 +++++++
 7 files changed, 107 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 3cbda4b12a71..657539464d16 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -7213,6 +7213,7 @@
     SUBDIR += zeal
     SUBDIR += zfp
     SUBDIR += zls
+    SUBDIR += zmusic
     SUBDIR += zookeeper
     SUBDIR += zpu-binutils
     SUBDIR += zpu-gcc
diff --git a/devel/zmusic/Makefile b/devel/zmusic/Makefile
new file mode 100644
index 000000000000..1fada53de0c5
--- /dev/null
+++ b/devel/zmusic/Makefile
@@ -0,0 +1,31 @@
+PORTNAME=	zmusic
+PORTVERSION=	1.1.8
+CATEGORIES=	devel
+
+MAINTAINER=	kevans@FreeBSD.org
+COMMENT=	GZDoom's music system as a standalone library
+
+LICENSE=	BSD3CLAUSE GPLv3 LGPL3
+LICENSE_COMB=	multi
+LICENSE_FILE_BSD3CLAUSE=${WRKSRC}/licenses/bsd.txt
+LICENSE_FILE_GPLv3=	${WRKSRC}/licenses/gplv3.txt
+LICENSE_FILE_LGPL3=	${WRKSRC}/licenses/lgplv3.txt
+
+LIB_DEPENDS=	libsndfile.so:audio/libsndfile \
+		libfluidsynth.so:audio/fluidsynth
+
+USES=		cmake
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	coelckers
+GH_PROJECT=	ZMusic
+
+USE_LDCONFIG=	yes
+CMAKE_OFF=	DYN_SNDFILE DYN_FLUIDSYNTH
+
+OPTIONS_DEFINE=	ALSA
+OPTIONS_DEFAULT=	ALSA
+ALSA_CMAKE_BOOL=	SYSTEM_MIDI
+ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
+
+.include <bsd.port.mk>
diff --git a/devel/zmusic/distinfo b/devel/zmusic/distinfo
new file mode 100644
index 000000000000..ba6ec3c0e344
--- /dev/null
+++ b/devel/zmusic/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1635738651
+SHA256 (coelckers-ZMusic-1.1.8_GH0.tar.gz) = 73082f661b7b0bb33348d1d186c132deec9132a1613480348a00172b49c9fd68
+SIZE (coelckers-ZMusic-1.1.8_GH0.tar.gz) = 1811039
diff --git a/devel/zmusic/files/patch-source_CMakeLists.txt b/devel/zmusic/files/patch-source_CMakeLists.txt
new file mode 100644
index 000000000000..620ef0c37afc
--- /dev/null
+++ b/devel/zmusic/files/patch-source_CMakeLists.txt
@@ -0,0 +1,41 @@
+--- source/CMakeLists.txt.orig	2021-11-01 04:27:52 UTC
++++ source/CMakeLists.txt
+@@ -105,21 +105,24 @@ else()
+ endif()
+ 
+ # System MIDI support
+-if(WIN32)
+-	target_compile_definitions(zmusic-obj INTERFACE HAVE_SYSTEM_MIDI)
+-	target_link_libraries(zmusic-obj INTERFACE winmm)
+-	target_sources(zmusic-obj INTERFACE mididevices/music_win_mididevice.cpp)
+-elseif(NOT APPLE)
+-	find_package(ALSA)
+-    if(ALSA_FOUND)
++option(SYSTEM_MIDI "Use system MIDI support" ON)
++if(SYSTEM_MIDI)
++	if(WIN32)
+ 		target_compile_definitions(zmusic-obj INTERFACE HAVE_SYSTEM_MIDI)
+-		target_sources(zmusic-obj
+-		INTERFACE
+-			mididevices/music_alsa_mididevice.cpp
+-			mididevices/music_alsa_state.cpp
+-		)
+-		target_link_libraries(zmusic-obj INTERFACE ALSA::ALSA)
+-		determine_package_config_dependency(ZMUSIC_PACKAGE_DEPENDENCIES TARGET ALSA::ALSA MODULE ALSA)
++		target_link_libraries(zmusic-obj INTERFACE winmm)
++		target_sources(zmusic-obj INTERFACE mididevices/music_win_mididevice.cpp)
++	elseif(NOT APPLE)
++		find_package(ALSA)
++		if(ALSA_FOUND)
++			target_compile_definitions(zmusic-obj INTERFACE HAVE_SYSTEM_MIDI)
++			target_sources(zmusic-obj
++			INTERFACE
++				mididevices/music_alsa_mididevice.cpp
++				mididevices/music_alsa_state.cpp
++			)
++			target_link_libraries(zmusic-obj INTERFACE ALSA::ALSA)
++			determine_package_config_dependency(ZMUSIC_PACKAGE_DEPENDENCIES TARGET ALSA::ALSA MODULE ALSA)
++		endif()
+ 	endif()
+ endif()
+ 
diff --git a/devel/zmusic/files/patch-thirdparty_game-music-emu_gme_blargg__endian.h b/devel/zmusic/files/patch-thirdparty_game-music-emu_gme_blargg__endian.h
new file mode 100644
index 000000000000..890758e04a89
--- /dev/null
+++ b/devel/zmusic/files/patch-thirdparty_game-music-emu_gme_blargg__endian.h
@@ -0,0 +1,13 @@
+--- thirdparty/game-music-emu/gme/blargg_endian.h.orig	2021-05-19 06:13:53 UTC
++++ thirdparty/game-music-emu/gme/blargg_endian.h
+@@ -33,9 +33,7 @@
+ #if defined (LSB_FIRST) || defined (__LITTLE_ENDIAN__) || BLARGG_CPU_X86 || \
+ 		(defined (LITTLE_ENDIAN) && LITTLE_ENDIAN+0 != 1234)
+ 	#define BLARGG_LITTLE_ENDIAN 1
+-#endif
+-
+-#if defined (MSB_FIRST)     || defined (__BIG_ENDIAN__) || defined (WORDS_BIGENDIAN) || \
++#elif defined (MSB_FIRST)     || defined (__BIG_ENDIAN__) || defined (WORDS_BIGENDIAN) || \
+ 	defined (__sparc__)     ||  BLARGG_CPU_POWERPC || \
+ 	(defined (BIG_ENDIAN) && BIG_ENDIAN+0 != 4321)
+ 	#define BLARGG_BIG_ENDIAN 1
diff --git a/devel/zmusic/pkg-descr b/devel/zmusic/pkg-descr
new file mode 100644
index 000000000000..822387a9da11
--- /dev/null
+++ b/devel/zmusic/pkg-descr
@@ -0,0 +1,5 @@
+ZMusic is a library that's used in GZDoom, Raze, and may be used in the newer
+PrBoom+.  This is GZDoom's music library pulled out into standalone form for
+reuse.
+
+WWW: https://github.com/coelckers/ZMusic
diff --git a/devel/zmusic/pkg-plist b/devel/zmusic/pkg-plist
new file mode 100644
index 000000000000..e7ce2336a287
--- /dev/null
+++ b/devel/zmusic/pkg-plist
@@ -0,0 +1,13 @@
+include/zmusic.h
+lib/cmake/ZMusic/ZMusicConfig.cmake
+lib/cmake/ZMusic/ZMusicConfigVersion.cmake
+lib/cmake/ZMusic/ZMusicFullTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/ZMusic/ZMusicFullTargets.cmake
+lib/cmake/ZMusic/ZMusicLiteTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/ZMusic/ZMusicLiteTargets.cmake
+lib/libzmusic.so
+lib/libzmusic.so.1
+lib/libzmusic.so.1.1.8
+lib/libzmusiclite.so
+lib/libzmusiclite.so.1
+lib/libzmusiclite.so.1.1.8