diff options
author | John Regan | 2021-02-25 16:38:14 -0500 |
---|---|---|
committer | John Regan | 2021-02-25 16:38:14 -0500 |
commit | 168a75adc0749d4c0f4be4053dfe382fe690269a (patch) | |
tree | 28b382381523d222c68d31bce7bc86382fa69eca | |
download | aur-168a75adc0749d4c0f4be4053dfe382fe690269a.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 26 | ||||
-rw-r--r-- | CMakeLists.txt | 185 | ||||
-rw-r--r-- | PKGBUILD | 66 | ||||
-rw-r--r-- | libgme-vgmplay-cpp-fixes.patch | 42 | ||||
-rw-r--r-- | libgme-vgmplay-more-cpp-fixes.patch | 81 |
5 files changed, 400 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..8ade5fc07d6c --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,26 @@ +pkgbase = libgme-vgmplay + pkgdesc = libgme fork with VGMPlay integrated + pkgver = r253.5bdc5d1 + pkgrel = 1 + url = https://git.lopez-snowhill.net/chris/game_music_emu + arch = x86_64 + arch = i686 + license = LGPL + makedepends = cmake + provides = libgme + conflicts = libgme + source = libgme-vgmplay::git+https://git.lopez-snowhill.net/chris/game_music_emu.git#branch=vgmplay + source = vgmplay::git+https://git.lopez-snowhill.net/chris/vgmplay.git + source = file_extractor::git+https://git.lopez-snowhill.net/chris/file_extractor.git + source = CMakeLists.txt + source = libgme-vgmplay-cpp-fixes.patch + source = libgme-vgmplay-more-cpp-fixes.patch + md5sums = SKIP + md5sums = SKIP + md5sums = SKIP + md5sums = da9b3b9f37af84222b9ac300ccf61e90 + md5sums = 186ed10b81f12813612d363f1a11da5e + md5sums = e2ffcfe50c1d9369a21d6612ecd8e9d4 + +pkgname = libgme-vgmplay-git + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000000..f46ccce1a479 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,185 @@ +cmake_minimum_required(VERSION 3.9) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +project(gme VERSION 0.7.0 DESCRIPTION "Game Music Emulator Library") + +set(GME_SOURCES + gme/higan/dsp/SPC_DSP.cpp + gme/higan/processor/spc700/spc700.cpp + gme/higan/dsp/dsp.cpp + gme/higan/smp/smp.cpp + gme/Ay_Apu.cpp + gme/Ay_Core.cpp + gme/Ay_Cpu.cpp + gme/Ay_Emu.cpp + gme/Bml_Parser.cpp + gme/blargg_common.cpp + gme/blargg_errors.cpp + gme/Blip_Buffer.cpp + gme/Classic_Emu.cpp + gme/Downsampler.cpp + gme/Dual_Resampler.cpp + gme/Effects_Buffer.cpp + gme/Fir_Resampler.cpp + gme/Gb_Apu.cpp + gme/Gb_Cpu.cpp + gme/Gb_Oscs.cpp + gme/Gbs_Core.cpp + gme/Gbs_Cpu.cpp + gme/Gbs_Emu.cpp + gme/gme.cpp + gme/Gme_File.cpp + gme/Gme_Loader.cpp + gme/Gym_Emu.cpp + gme/Hes_Apu.cpp + gme/Hes_Apu_Adpcm.cpp + gme/Hes_Core.cpp + gme/Hes_Cpu.cpp + gme/Hes_Emu.cpp + gme/Kss_Core.cpp + gme/Kss_Cpu.cpp + gme/Kss_Emu.cpp + gme/Kss_Scc_Apu.cpp + gme/M3u_Playlist.cpp + gme/Multi_Buffer.cpp + gme/Music_Emu.cpp + gme/Nes_Apu.cpp + gme/Nes_Cpu.cpp + gme/Nes_Fds_Apu.cpp + gme/Nes_Fme7_Apu.cpp + gme/Nes_Namco_Apu.cpp + gme/Nes_Oscs.cpp + gme/Nes_Vrc6_Apu.cpp + gme/Nes_Vrc7_Apu.cpp + gme/Nsf_Core.cpp + gme/Nsf_Cpu.cpp + gme/Nsf_Emu.cpp + gme/Nsf_Impl.cpp + gme/Nsfe_Emu.cpp + gme/Opl_Apu.cpp + gme/Resampler.cpp + gme/Rom_Data.cpp + gme/Sap_Apu.cpp + gme/Sap_Core.cpp + gme/Sap_Cpu.cpp + gme/Sap_Emu.cpp + gme/Sgc_Core.cpp + gme/Sgc_Cpu.cpp + gme/Sgc_Emu.cpp + gme/Sgc_Impl.cpp + gme/Sms_Apu.cpp + gme/Sms_Fm_Apu.cpp + gme/Spc_Emu.cpp + gme/Spc_Filter.cpp + gme/Spc_Sfm.cpp + gme/Track_Filter.cpp + gme/Upsampler.cpp + gme/Vgm_Core.cpp + gme/Vgm_Emu.cpp + gme/Ym2413_Emu.cpp + gme/Ym2612_Emu.cpp + gme/Z80_Cpu.cpp + vgmplay/VGMPlay/ChipMapper.c + vgmplay/VGMPlay/chips/2151intf.c + vgmplay/VGMPlay/chips/2203intf.c + vgmplay/VGMPlay/chips/2413intf.c + vgmplay/VGMPlay/chips/2608intf.c + vgmplay/VGMPlay/chips/2610intf.c + vgmplay/VGMPlay/chips/2612intf.c + vgmplay/VGMPlay/chips/262intf.c + vgmplay/VGMPlay/chips/3526intf.c + vgmplay/VGMPlay/chips/3812intf.c + vgmplay/VGMPlay/chips/8950intf.c + vgmplay/VGMPlay/chips/adlibemu_opl2.c + vgmplay/VGMPlay/chips/adlibemu_opl3.c + vgmplay/VGMPlay/chips/ay8910.c + vgmplay/VGMPlay/chips/ay_intf.c + vgmplay/VGMPlay/chips/c140.c + vgmplay/VGMPlay/chips/c352.c + vgmplay/VGMPlay/chips/c6280.c + vgmplay/VGMPlay/chips/c6280intf.c + vgmplay/VGMPlay/chips/dac_control.c + vgmplay/VGMPlay/chips/emu2149.c + vgmplay/VGMPlay/chips/emu2413.c + vgmplay/VGMPlay/chips/es5503.c + vgmplay/VGMPlay/chips/es5506.c + vgmplay/VGMPlay/chips/fm.c + vgmplay/VGMPlay/chips/fm2612.c + vgmplay/VGMPlay/chips/fmopl.c + vgmplay/VGMPlay/chips/gb.c + vgmplay/VGMPlay/chips/iremga20.c + vgmplay/VGMPlay/chips/k051649.c + vgmplay/VGMPlay/chips/k053260.c + vgmplay/VGMPlay/chips/k054539.c + vgmplay/VGMPlay/chips/multipcm.c + vgmplay/VGMPlay/chips/nes_apu.c + vgmplay/VGMPlay/chips/nes_intf.c + vgmplay/VGMPlay/chips/np_nes_apu.c + vgmplay/VGMPlay/chips/np_nes_dmc.c + vgmplay/VGMPlay/chips/np_nes_fds.c + vgmplay/VGMPlay/chips/okim6258.c + vgmplay/VGMPlay/chips/okim6295.c + vgmplay/VGMPlay/chips/Ootake_PSG.c + vgmplay/VGMPlay/chips/panning.c + vgmplay/VGMPlay/chips/pokey.c + vgmplay/VGMPlay/chips/pwm.c + vgmplay/VGMPlay/chips/qsound.c + vgmplay/VGMPlay/chips/rf5c68.c + vgmplay/VGMPlay/chips/saa1099.c + vgmplay/VGMPlay/chips/scd_pcm.c + vgmplay/VGMPlay/chips/scsp.c + vgmplay/VGMPlay/chips/segapcm.c + vgmplay/VGMPlay/chips/sn76489.c + vgmplay/VGMPlay/chips/sn76496.c + vgmplay/VGMPlay/chips/sn764intf.c + vgmplay/VGMPlay/chips/upd7759.c + vgmplay/VGMPlay/chips/vsu.c + vgmplay/VGMPlay/chips/ws_audio.c + vgmplay/VGMPlay/chips/x1_010.c + vgmplay/VGMPlay/chips/yam.c + vgmplay/VGMPlay/chips/ym2151.c + vgmplay/VGMPlay/chips/ym2413.c + vgmplay/VGMPlay/chips/ym2612.c + vgmplay/VGMPlay/chips/ymdeltat.c + vgmplay/VGMPlay/chips/ymf262.c + vgmplay/VGMPlay/chips/ymf271.c + vgmplay/VGMPlay/chips/ymf278b.c + vgmplay/VGMPlay/chips/ymz280b.c + vgmplay/VGMPlay/resampler.c + vgmplay/VGMPlay/VGMPlay.c + file_extractor/fex/Data_Reader.cpp + file_extractor/fex/blargg_errors.cpp +) + +add_library(gmeobj OBJECT ${GME_SOURCES}) +set_property(TARGET gmeobj PROPERTY POSITION_INDEPENDENT_CODE 1) +add_library(gme_shared SHARED $<TARGET_OBJECTS:gmeobj>) +add_library(gme_static STATIC $<TARGET_OBJECTS:gmeobj>) + +target_compile_definitions(gmeobj PRIVATE BLARGG_NAMESPACE=GME) +find_package(ZLIB REQUIRED) +include_directories(${ZLIB_INCLUDE_DIRS}) +target_include_directories(gmeobj PRIVATE gme file_extractor/fex) +set_target_properties(gme_shared PROPERTIES VERSION ${PROJECT_VERSION}) +set_target_properties(gme_static PROPERTIES VERSION ${PROJECT_VERSION}) + +set_target_properties(gme_shared PROPERTIES PUBLIC_HEADER gme/gme.h) +set_target_properties(gme_static PROPERTIES PUBLIC_HEADER gme/gme.h) + +SET_TARGET_PROPERTIES(gme_static PROPERTIES OUTPUT_NAME gme CLEAN_DIRECT_OUTPUT 1) +SET_TARGET_PROPERTIES(gme_shared PROPERTIES OUTPUT_NAME gme CLEAN_DIRECT_OUTPUT 1) +target_link_libraries(gme_shared ${ZLIB_LIBRARIES} ) + +include(GNUInstallDirs) + +install(TARGETS gme_shared + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gme +) + +install(TARGETS gme_static + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gme +) diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..846db8238aae --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,66 @@ +# Maintainer: John Regan <john@jrjrtech.com> +pkgname='libgme-vgmplay-git' +pkgbase='libgme-vgmplay' +pkgver=r253.5bdc5d1 +pkgrel=1 +pkgdesc="libgme fork with VGMPlay integrated" +arch=('x86_64' 'i686') +url="https://git.lopez-snowhill.net/chris/game_music_emu" +license=('LGPL') +makedepends=('cmake') +conflicts=('libgme') +provides=('libgme') + +source=( +'libgme-vgmplay::git+https://git.lopez-snowhill.net/chris/game_music_emu.git#branch=vgmplay' +'vgmplay::git+https://git.lopez-snowhill.net/chris/vgmplay.git' +'file_extractor::git+https://git.lopez-snowhill.net/chris/file_extractor.git' +'CMakeLists.txt' +'libgme-vgmplay-cpp-fixes.patch' +'libgme-vgmplay-more-cpp-fixes.patch' +) + +md5sums=( +'SKIP' +'SKIP' +'SKIP' +'da9b3b9f37af84222b9ac300ccf61e90' +'186ed10b81f12813612d363f1a11da5e' +'e2ffcfe50c1d9369a21d6612ecd8e9d4' +) + +pkgver() { + cd "$srcdir/${pkgbase}" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "$srcdir/${pkgbase}" + git submodule init + git config submodule.vgmplay.url "${srcdir}/vgmplay" + git submodule update + ln -sf "${srcdir}/file_extractor" ./file_extractor + cp "${srcdir}/CMakeLists.txt" . + patch --forward --strip=1 --input="${srcdir}/libgme-vgmplay-cpp-fixes.patch" + patch --forward --strip=1 --input="${srcdir}/libgme-vgmplay-more-cpp-fixes.patch" +} + +build() { + cd "$srcdir/${pkgbase}" + rm -rf build + mkdir build + cd build + cmake \ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic -Wl,-Bsymbolic-functions" \ + -DCMAKE_MODULE_LINKER_FLAGS="-Wl,-Bsymbolic -Wl,-Bsymbolic-functions" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_BUILD_RPATH=TRUE \ + -DCMAKE_INSTALL_PREFIX=/usr \ + .. + make V=1 VERBOSE=1 +} + +package() { + cd "$srcdir/${pkgbase}/build" + make DESTDIR="$pkgdir/" install +} diff --git a/libgme-vgmplay-cpp-fixes.patch b/libgme-vgmplay-cpp-fixes.patch new file mode 100644 index 000000000000..d0413a925b2d --- /dev/null +++ b/libgme-vgmplay-cpp-fixes.patch @@ -0,0 +1,42 @@ +From 03a70ee4093b12ee0085414ccf119d11dd536f59 Mon Sep 17 00:00:00 2001 +From: John Regan <john@jrjrtech.com> +Date: Sun, 23 Feb 2020 11:34:20 -0500 +Subject: [PATCH] use regular template for blargg_min/max + +--- + gme/blargg_source.h | 19 +++---------------- + 1 file changed, 3 insertions(+), 16 deletions(-) + +diff --git a/gme/blargg_source.h b/gme/blargg_source.h +index 0bf02a8..0f0f575 100644 +--- a/gme/blargg_source.h ++++ b/gme/blargg_source.h +@@ -118,22 +118,9 @@ otherwise continues normally. */ + return blargg_err_memory;\ + } while ( 0 ) + +-/* The usual min/max functions for built-in types. +- +-template<typename T> T min( T x, T y ) { return x < y ? x : y; } +-template<typename T> T max( T x, T y ) { return x > y ? x : y; } */ +-#define BLARGG_DEF_MIN_MAX( type ) \ +- static inline type blargg_min( type x, type y ) { if ( y < x ) x = y; return x; }\ +- static inline type blargg_max( type x, type y ) { if ( x < y ) x = y; return x; } +- +-BLARGG_DEF_MIN_MAX( int ) +-BLARGG_DEF_MIN_MAX( unsigned ) +-BLARGG_DEF_MIN_MAX( long ) +-BLARGG_DEF_MIN_MAX( unsigned long ) +-BLARGG_DEF_MIN_MAX( BOOST::int64_t ) +-BLARGG_DEF_MIN_MAX( BOOST::uint64_t ) +-BLARGG_DEF_MIN_MAX( float ) +-BLARGG_DEF_MIN_MAX( double ) ++template<typename T> T blargg_min( T x, T y ) { if ( y < x ) x = y; return x; } ++template<typename T> T blargg_max( T x, T y ) { if ( x < y ) x = y; return x; } ++ + + #undef min + #define min blargg_min +-- +2.10.5 + diff --git a/libgme-vgmplay-more-cpp-fixes.patch b/libgme-vgmplay-more-cpp-fixes.patch new file mode 100644 index 000000000000..f485a1772fc8 --- /dev/null +++ b/libgme-vgmplay-more-cpp-fixes.patch @@ -0,0 +1,81 @@ +diff --git a/gme/Vgm_Emu.cpp b/gme/Vgm_Emu.cpp +index 8616f00..dac6003 100644 +--- a/gme/Vgm_Emu.cpp ++++ b/gme/Vgm_Emu.cpp +@@ -18,6 +18,11 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + + #include "blargg_source.h" + ++#ifdef BLARGG_NAMESPACE ++#define blargg_to_utf8 BLARGG_NAMESPACE::blargg_to_utf8 ++#define blargg_to_wide BLARGG_NAMESPACE::blargg_to_wide ++#endif ++ + // FM emulators are internally quieter to avoid 16-bit overflow + double const fm_gain = 3.0; + double const rolloff = 0.990; +diff --git a/gme/blargg_common.h b/gme/blargg_common.h +index 79fd28b..b2f05f0 100644 +--- a/gme/blargg_common.h ++++ b/gme/blargg_common.h +@@ -105,29 +105,8 @@ we strip it out unless BLARGG_LEGACY is true. */ + #define BLARGG_DEPRECATED( text ) + #endif + +-/* BOOST::int8_t, BOOST::int32_t, etc. +-I used BOOST since I originally was going to allow use of the boost library +-for prividing the definitions. If I'm defining them, they must be scoped or +-else they could conflict with the standard ones at global scope. Even if +-HAVE_STDINT_H isn't defined, I can't assume the typedefs won't exist at +-global scope already. */ +-#if defined (HAVE_STDINT_H) || \ +- UCHAR_MAX != 0xFF || USHRT_MAX != 0xFFFF || UINT_MAX != 0xFFFFFFFF +- #include <stdint.h> +- #define BOOST +-#else +- struct BOOST +- { +- typedef signed char int8_t; +- typedef unsigned char uint8_t; +- typedef short int16_t; +- typedef unsigned short uint16_t; +- typedef int int32_t; +- typedef unsigned int uint32_t; +- typedef __int64 int64_t; +- typedef unsigned __int64 uint64_t; +- }; +-#endif ++#include <stdint.h> ++#define BOOST + + /* My code is not written with exceptions in mind, so either uses new (nothrow) + OR overrides operator new in my classes. The former is best since clients +@@ -221,11 +200,8 @@ BLARGG_DEPRECATED( typedef unsigned int blargg_ulong; ) + + #ifdef _WIN32 + typedef wchar_t blargg_wchar_t; +-#elif defined(HAVE_STDINT_H) +-#include <stdint.h> +-typedef uint16_t blargg_wchar_t; + #else +-typedef unsigned short blargg_wchar_t; ++typedef uint16_t blargg_wchar_t; + #endif + + inline size_t blargg_wcslen( const blargg_wchar_t* str ) +@@ -240,4 +216,14 @@ blargg_wchar_t* blargg_to_wide( const char* ); + + BLARGG_NAMESPACE_END + ++template <typename T, size_t N> ++constexpr size_t blargg_countof(T const (&)[N]) noexcept ++{ ++ return N; ++} ++ ++#ifndef _countof ++#define _countof blargg_countof ++#endif ++ + #endif + |