commit d406a858b1769882ed43d616f48bae20746b85a1675b6e508ac51a1b01255253 Author: Dave Plater Date: Tue Dec 14 12:35:22 2010 +0000 Accepting request 55911 from home:RedDwarf You should remove the % from your comments on your next commit. OBS-URL: https://build.opensuse.org/request/show/55911 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/libgme?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_service b/_service new file mode 100644 index 0000000..631a48a --- /dev/null +++ b/_service @@ -0,0 +1,16 @@ + + + + http + game-music-emu.googlecode.com + /files/game-music-emu-0.5.5.tbz2 + + + _service:download_url:game-music-emu-0.5.5.tbz2 + sha256 + ecb3586aac9feff2b3141167835f73da0c997efbdd32e559f99477ad01e19089 + + + 0.5.5 + + diff --git a/_service:download_url:game-music-emu-0.5.5.tbz2 b/_service:download_url:game-music-emu-0.5.5.tbz2 new file mode 100644 index 0000000..c1a911c --- /dev/null +++ b/_service:download_url:game-music-emu-0.5.5.tbz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecb3586aac9feff2b3141167835f73da0c997efbdd32e559f99477ad01e19089 +size 161954 diff --git a/_service:set_version:libgme.spec b/_service:set_version:libgme.spec new file mode 100644 index 0000000..a13ddf7 --- /dev/null +++ b/_service:set_version:libgme.spec @@ -0,0 +1,116 @@ +# +# spec file for package libgme +# +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +%define soname 0 + +Name: libgme +Version: 0.5.5 +Release: 0 +License: LGPLv2.1+ +Summary: Collection of video game music file emulators +Url: http://code.google.com/p/game-music-emu/ +Group: System/Libraries +Source0: game-music-emu-%{version}.tbz2 +# PATCH-FIX-UPSTREAM %{name}-0.5.5-LIB_SUFFIX.patch http://code.google.com/p/game-music-emu/issues/detail?id=8 reddwarf@opensuse.org -- Add LIB_SUFFIX support +Patch0: %{name}-0.5.5-LIB_SUFFIX.patch +# PATCH-FIX-UPSTREAM %{name}-0.5.5-pkg_config.patch reddwarf@opensuse.org -- Add pkg-config file. From upstream SVN. +Patch1: %{name}-0.5.5-pkg_config.patch +# PATCH-FIX-UPSTREAM %{name}-0.5.5-symbol_visibility.patch reddwarf@opensuse.org -- Don't export internal symbols. From upstream SVN. +Patch2: %{name}-0.5.5-symbol_visibility.patch +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: pkg-config + +%description +Game_Music_Emu is a collection of video game music file emulators that support +the following formats and systems: +- AY: ZX Spectrum/Amstrad CPC +- GBS: Nintendo Game Boy +- GYM: Sega Genesis/Mega Drive +- HES: NEC TurboGrafx-16/PC Engine +- KSS: MSX Home Computer/other Z80 systems (doesn't support FM sound) +- NSF/NSFE: Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound) +- SAP: Atari systems using POKEY sound chip +- SPC: Super Nintendo/Super Famicom +- VGM/VGZ: Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro + +%package -n %{name}%{soname} +Summary: Collection of video game music file emulators +Group: System/Libraries + +%description -n %{name}%{soname} +Game_Music_Emu is a collection of video game music file emulators that support +the following formats and systems: +- AY: ZX Spectrum/Amstrad CPC +- GBS: Nintendo Game Boy +- GYM: Sega Genesis/Mega Drive +- HES: NEC TurboGrafx-16/PC Engine +- KSS: MSX Home Computer/other Z80 systems (doesn't support FM sound) +- NSF/NSFE: Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound) +- SAP: Atari systems using POKEY sound chip +- SPC: Super Nintendo/Super Famicom +- VGM/VGZ: Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro + +%package devel +Summary: Development libraries and headers for %{name} +Group: Development/Libraries/C and C++ +Requires: %{name}%{soname} = %{version} + +%description devel +The developmental files that must be installed in order to compile applications +which use %{name}. + +%prep +%setup -q -n game-music-emu-%{version} +%patch0 +%patch1 +%patch2 +sed -i 's/\r$//' changes.txt design.txt gme.txt license.txt readme.txt + +%build +export CFLAGS='%{optflags}' +export CXXFLAGS='%{optflags}' +%{__mkdir} build +cd build +cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \ + -DCMAKE_BUILD_TYPE=Release .. +%{__make} %{?_smp_mflags} VERBOSE=1 + +%install +cd build +%make_install + +%post -n %{name}%{soname} -p /sbin/ldconfig + +%postun -n %{name}%{soname} -p /sbin/ldconfig + +%files -n %{name}%{soname} +%defattr(0644, root, root, 0755) +%doc changes.txt gme.txt license.txt readme.txt +%{_libdir}/%{name}.so.%{soname}* + +%files devel +%defattr(0644, root, root, 0755) +%doc design.txt +%{_includedir}/gme +%{_libdir}/%{name}.so +%{_libdir}/pkgconfig/%{name}.pc + +%changelog diff --git a/libgme-0.5.5-LIB_SUFFIX.patch b/libgme-0.5.5-LIB_SUFFIX.patch new file mode 100644 index 0000000..6505d10 --- /dev/null +++ b/libgme-0.5.5-LIB_SUFFIX.patch @@ -0,0 +1,12 @@ +Index: gme/CMakeLists.txt +=================================================================== +--- gme/CMakeLists.txt.orig ++++ gme/CMakeLists.txt +@@ -158,6 +158,6 @@ set_target_properties(gme + SOVERSION 0) + + # TODO: Libsuffix for 64-bit? +-install(TARGETS gme LIBRARY DESTINATION lib) ++install(TARGETS gme LIBRARY DESTINATION lib${LIB_SUFFIX}) + + install(FILES ${EXPORTED_HEADERS} DESTINATION include/gme) diff --git a/libgme-0.5.5-pkg_config.patch b/libgme-0.5.5-pkg_config.patch new file mode 100644 index 0000000..0c8fa25 --- /dev/null +++ b/libgme-0.5.5-pkg_config.patch @@ -0,0 +1,60 @@ +Index: gme/libgme.pc.in +=================================================================== +--- /dev/null ++++ gme/libgme.pc.in +@@ -0,0 +1,15 @@ ++# entries grouped with CMake are expanded by CMake ++# ${foo} entries are left alone by CMake and much ++# later are used by pkg-config. ++prefix=@CMAKE_INSTALL_PREFIX@ ++exec_prefix=${prefix} ++lib_suffix=@LIB_SUFFIX@ ++libdir=${exec_prefix}/lib${lib_suffix} ++includedir=${prefix}/include ++ ++Name: Game_Music_Emu ++Description: A video game emulation library for music. ++URL: http://code.google.com/p/game-music-emu/ ++Version: @GME_VERSION@ ++Cflags: -I${includedir} ++Libs: -L${libdir} -lgme +Index: gme/CMakeLists.txt +=================================================================== +--- gme/CMakeLists.txt.orig ++++ gme/CMakeLists.txt +@@ -144,6 +144,9 @@ set (EXPORTED_HEADERS gme.h + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gme_types.h.in + ${CMAKE_CURRENT_BINARY_DIR}/gme_types.h) + ++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgme.pc.in ++ ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc @ONLY) ++ + # For the gme_types.h + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +@@ -154,10 +157,11 @@ add_library(gme SHARED ${libgme_SRCS}) + # as only build fixes are performed (i.e. no changes/additions to API) the + # SOVERSION should be the same even when bumping up VERSION. + set_target_properties(gme +- PROPERTIES VERSION 0.5.3 ++ PROPERTIES VERSION ${GME_VERSION} + SOVERSION 0) + + # TODO: Libsuffix for 64-bit? + install(TARGETS gme LIBRARY DESTINATION lib${LIB_SUFFIX}) + + install(FILES ${EXPORTED_HEADERS} DESTINATION include/gme) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig) +Index: CMakeLists.txt +=================================================================== +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -1,6 +1,8 @@ + # CMake project definition file. + project(libgme) + ++set(GME_VERSION 0.5.5 CACHE INTERNAL "libgme Version") ++ + # 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't. + # Of course, 2.4 might work, in which case you're welcome to drop + # down the requirement, but I can't test that. diff --git a/libgme-0.5.5-symbol_visibility.patch b/libgme-0.5.5-symbol_visibility.patch new file mode 100644 index 0000000..62cbb0d --- /dev/null +++ b/libgme-0.5.5-symbol_visibility.patch @@ -0,0 +1,482 @@ +Index: gme/gme.cpp +=================================================================== +--- gme/gme.cpp.orig ++++ gme/gme.cpp +@@ -22,7 +22,7 @@ Inc., 51 Franklin Street, Fifth Floor, B + + #include "blargg_source.h" + +-gme_type_t const* gme_type_list() ++BLARGG_EXPORT gme_type_t const* gme_type_list() + { + static gme_type_t const gme_type_list_ [] = { + #ifdef USE_GME_AY +@@ -61,7 +61,7 @@ gme_type_t const* gme_type_list() + return gme_type_list_; + } + +-const char* gme_identify_header( void const* header ) ++BLARGG_EXPORT const char* gme_identify_header( void const* header ) + { + switch ( get_be32( header ) ) + { +@@ -90,7 +90,7 @@ static void to_uppercase( const char* in + *out = 0; // extension too long + } + +-gme_type_t gme_identify_extension( const char* extension_ ) ++BLARGG_EXPORT gme_type_t gme_identify_extension( const char* extension_ ) + { + char const* end = strrchr( extension_, '.' ); + if ( end ) +@@ -105,7 +105,7 @@ gme_type_t gme_identify_extension( const + return 0; + } + +-gme_err_t gme_identify_file( const char* path, gme_type_t* type_out ) ++BLARGG_EXPORT gme_err_t gme_identify_file( const char* path, gme_type_t* type_out ) + { + *type_out = gme_identify_extension( path ); + // TODO: don't examine header if file has extension? +@@ -120,7 +120,7 @@ gme_err_t gme_identify_file( const char* + return 0; + } + +-gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, int sample_rate ) ++BLARGG_EXPORT gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, int sample_rate ) + { + require( (data || !size) && out ); + *out = 0; +@@ -144,7 +144,7 @@ gme_err_t gme_open_data( void const* dat + return err; + } + +-gme_err_t gme_open_file( const char* path, Music_Emu** out, int sample_rate ) ++BLARGG_EXPORT gme_err_t gme_open_file( const char* path, Music_Emu** out, int sample_rate ) + { + require( path && out ); + *out = 0; +@@ -181,7 +181,7 @@ gme_err_t gme_open_file( const char* pat + return err; + } + +-Music_Emu* gme_new_emu( gme_type_t type, int rate ) ++BLARGG_EXPORT Music_Emu* gme_new_emu( gme_type_t type, int rate ) + { + if ( type ) + { +@@ -214,27 +214,27 @@ Music_Emu* gme_new_emu( gme_type_t type, + return 0; + } + +-gme_err_t gme_load_file( Music_Emu* me, const char* path ) { return me->load_file( path ); } ++BLARGG_EXPORT gme_err_t gme_load_file( Music_Emu* me, const char* path ) { return me->load_file( path ); } + +-gme_err_t gme_load_data( Music_Emu* me, void const* data, long size ) ++BLARGG_EXPORT gme_err_t gme_load_data( Music_Emu* me, void const* data, long size ) + { + Mem_File_Reader in( data, size ); + return me->load( in ); + } + +-gme_err_t gme_load_custom( Music_Emu* me, gme_reader_t func, long size, void* data ) ++BLARGG_EXPORT gme_err_t gme_load_custom( Music_Emu* me, gme_reader_t func, long size, void* data ) + { + Callback_Reader in( func, size, data ); + return me->load( in ); + } + +-void gme_delete( Music_Emu* me ) { delete me; } ++BLARGG_EXPORT void gme_delete( Music_Emu* me ) { delete me; } + +-gme_type_t gme_type( Music_Emu const* me ) { return me->type(); } ++BLARGG_EXPORT gme_type_t gme_type( Music_Emu const* me ) { return me->type(); } + +-const char* gme_warning( Music_Emu* me ) { return me->warning(); } ++BLARGG_EXPORT const char* gme_warning( Music_Emu* me ) { return me->warning(); } + +-int gme_track_count( Music_Emu const* me ) { return me->track_count(); } ++BLARGG_EXPORT int gme_track_count( Music_Emu const* me ) { return me->track_count(); } + + struct gme_info_t_ : gme_info_t + { +@@ -243,7 +243,7 @@ struct gme_info_t_ : gme_info_t + BLARGG_DISABLE_NOTHROW + }; + +-gme_err_t gme_track_info( Music_Emu const* me, gme_info_t** out, int track ) ++BLARGG_EXPORT gme_err_t gme_track_info( Music_Emu const* me, gme_info_t** out, int track ) + { + *out = NULL; + +@@ -309,12 +309,12 @@ gme_err_t gme_track_info( Music_Emu cons + return 0; + } + +-void gme_free_info( gme_info_t* info ) ++BLARGG_EXPORT void gme_free_info( gme_info_t* info ) + { + delete STATIC_CAST(gme_info_t_*,info); + } + +-void gme_set_stereo_depth( Music_Emu* me, double depth ) ++BLARGG_EXPORT void gme_set_stereo_depth( Music_Emu* me, double depth ) + { + #if !GME_DISABLE_STEREO_DEPTH + if ( me->effects_buffer ) +@@ -322,23 +322,25 @@ void gme_set_stereo_depth( Music_Emu* me + #endif + } + +-void* gme_user_data ( Music_Emu const* me ) { return me->user_data(); } +-void gme_set_user_data ( Music_Emu* me, void* new_user_data ) { me->set_user_data( new_user_data ); } +-void gme_set_user_cleanup(Music_Emu* me, gme_user_cleanup_t func ) { me->set_user_cleanup( func ); } +- +-gme_err_t gme_start_track ( Music_Emu* me, int index ) { return me->start_track( index ); } +-gme_err_t gme_play ( Music_Emu* me, int n, short* p ) { return me->play( n, p ); } +-void gme_set_fade ( Music_Emu* me, int start_msec ) { me->set_fade( start_msec ); } +-int gme_track_ended ( Music_Emu const* me ) { return me->track_ended(); } +-int gme_tell ( Music_Emu const* me ) { return me->tell(); } +-gme_err_t gme_seek ( Music_Emu* me, int msec ) { return me->seek( msec ); } +-int gme_voice_count ( Music_Emu const* me ) { return me->voice_count(); } +-void gme_ignore_silence ( Music_Emu* me, int disable ) { me->ignore_silence( disable != 0 ); } +-void gme_set_tempo ( Music_Emu* me, double t ) { me->set_tempo( t ); } +-void gme_mute_voice ( Music_Emu* me, int index, int mute ) { me->mute_voice( index, mute != 0 ); } +-void gme_mute_voices ( Music_Emu* me, int mask ) { me->mute_voices( mask ); } ++BLARGG_EXPORT void* gme_user_data ( Music_Emu const* me ) { return me->user_data(); } ++BLARGG_EXPORT void gme_set_user_data ( Music_Emu* me, void* new_user_data ) { me->set_user_data( new_user_data ); } ++BLARGG_EXPORT void gme_set_user_cleanup(Music_Emu* me, gme_user_cleanup_t func ) { me->set_user_cleanup( func ); } ++ ++BLARGG_EXPORT gme_err_t gme_start_track ( Music_Emu* me, int index ) { return me->start_track( index ); } ++BLARGG_EXPORT gme_err_t gme_play ( Music_Emu* me, int n, short* p ) { return me->play( n, p ); } ++BLARGG_EXPORT void gme_set_fade ( Music_Emu* me, int start_msec ) { me->set_fade( start_msec ); } ++BLARGG_EXPORT int gme_track_ended ( Music_Emu const* me ) { return me->track_ended(); } ++BLARGG_EXPORT int gme_tell ( Music_Emu const* me ) { return me->tell(); } ++BLARGG_EXPORT gme_err_t gme_seek ( Music_Emu* me, int msec ) { return me->seek( msec ); } ++BLARGG_EXPORT int gme_voice_count ( Music_Emu const* me ) { return me->voice_count(); } ++BLARGG_EXPORT void gme_ignore_silence ( Music_Emu* me, int disable ) { me->ignore_silence( disable != 0 ); } ++BLARGG_EXPORT void gme_set_tempo ( Music_Emu* me, double t ) { me->set_tempo( t ); } ++BLARGG_EXPORT void gme_mute_voice ( Music_Emu* me, int index, int mute ) { me->mute_voice( index, mute != 0 ); } ++BLARGG_EXPORT void gme_mute_voices ( Music_Emu* me, int mask ) { me->mute_voices( mask ); } ++BLARGG_EXPORT void gme_clear_playlist ( Music_Emu* me ) { me->clear_playlist(); } ++BLARGG_EXPORT int gme_type_multitrack( gme_type_t t ) { return t->track_count != 1; } + +-void gme_set_equalizer ( Music_Emu* me, gme_equalizer_t const* eq ) ++BLARGG_EXPORT void gme_set_equalizer ( Music_Emu* me, gme_equalizer_t const* eq ) + { + Music_Emu::equalizer_t e = me->equalizer(); + e.treble = eq->treble; +@@ -346,7 +348,7 @@ void gme_set_equalizer ( Music_Emu + me->set_equalizer( e ); + } + +-void gme_equalizer( Music_Emu const* me, gme_equalizer_t* out ) ++BLARGG_EXPORT void gme_equalizer( Music_Emu const* me, gme_equalizer_t* out ) + { + gme_equalizer_t e = { }; + e.treble = me->equalizer().treble; +@@ -354,13 +356,13 @@ void gme_equalizer( Music_Emu const* me, + *out = e; + } + +-const char* gme_voice_name( Music_Emu const* me, int i ) ++BLARGG_EXPORT const char* gme_voice_name( Music_Emu const* me, int i ) + { + assert( (unsigned) i < (unsigned) me->voice_count() ); + return me->voice_names() [i]; + } + +-const char* gme_type_system( gme_type_t type ) ++BLARGG_EXPORT const char* gme_type_system( gme_type_t type ) + { + assert( type ); + return type->system; +Index: gme/M3u_Playlist.cpp +=================================================================== +--- gme/M3u_Playlist.cpp.orig ++++ gme/M3u_Playlist.cpp +@@ -52,9 +52,9 @@ blargg_err_t Gme_File::load_m3u( const c + + blargg_err_t Gme_File::load_m3u( Data_Reader& in ) { return load_m3u_( playlist.load( in ) ); } + +-gme_err_t gme_load_m3u( Music_Emu* me, const char* path ) { return me->load_m3u( path ); } ++BLARGG_EXPORT gme_err_t gme_load_m3u( Music_Emu* me, const char* path ) { return me->load_m3u( path ); } + +-gme_err_t gme_load_m3u_data( Music_Emu* me, const void* data, long size ) ++BLARGG_EXPORT gme_err_t gme_load_m3u_data( Music_Emu* me, const void* data, long size ) + { + Mem_File_Reader in( data, size ); + return me->load_m3u( in ); +Index: gme/blargg_source.h +=================================================================== +--- gme/blargg_source.h.orig ++++ gme/blargg_source.h +@@ -66,6 +66,17 @@ inline T max( T x, T y ) + #define byte byte_ + typedef unsigned char byte; + ++// Setup compiler defines useful for exporting required public API symbols in gme.cpp ++#ifndef BLARGG_EXPORT ++ #if defined (_WIN32) && defined(BLARGG_BUILD_DLL) ++ #define BLARGG_EXPORT __declspec(dllexport) ++ #elif defined (LIBGME_VISIBILITY) ++ #define BLARGG_EXPORT __attribute__((visibility ("default"))) ++ #else ++ #define BLARGG_EXPORT ++ #endif ++#endif ++ + // deprecated + #define BLARGG_CHECK_ALLOC CHECK_ALLOC + #define BLARGG_RETURN_ERR RETURN_ERR +Index: player/Music_Player.h +=================================================================== +--- player/Music_Player.h.orig ++++ player/Music_Player.h +@@ -4,18 +4,18 @@ + #ifndef MUSIC_PLAYER_H + #define MUSIC_PLAYER_H + +-#include "gme/Music_Emu.h" ++#include "gme.h" + + class Music_Player { + public: + // Initialize player and set sample rate +- blargg_err_t init( long sample_rate = 44100 ); ++ gme_err_t init( long sample_rate = 44100 ); + + // Load game music file. NULL on success, otherwise error string. +- blargg_err_t load_file( const char* path ); ++ gme_err_t load_file( const char* path ); + + // (Re)start playing track. Tracks are numbered from 0 to track_count() - 1. +- blargg_err_t start_track( int track ); ++ gme_err_t start_track( int track ); + + // Stop playing current file + void stop(); +@@ -26,7 +26,7 @@ public: + int track_count() const; + + // Info for current track +- track_info_t const& track_info() const { return track_info_; } ++ gme_info_t const& track_info() const { return *track_info_; } + + // Pause/resume playing current track. + void pause( int ); +@@ -59,7 +59,7 @@ private: + long sample_rate; + int scope_buf_size; + bool paused; +- track_info_t track_info_; ++ gme_info_t* track_info_; + + void suspend(); + void resume(); +Index: player/Music_Player.cpp +=================================================================== +--- player/Music_Player.cpp.orig ++++ player/Music_Player.cpp +@@ -2,12 +2,10 @@ + + #include "Music_Player.h" + +-#include "gme/Music_Emu.h" +- + #include + #include + +-/* Copyright (C) 2005-2006 by Shay Green. Permission is hereby granted, free of ++/* Copyright (C) 2005-2010 by Shay Green. Permission is hereby granted, free of + charge, to any person obtaining a copy of this software module and associated + documentation files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, modify, +@@ -22,7 +20,12 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAI + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +-#include "blargg_source.h" ++#define RETURN_ERR( expr ) \ ++ do {\ ++ gme_err_t err_ = (expr);\ ++ if ( err_ )\ ++ return err_;\ ++ } while ( 0 ) + + // Number of audio buffers per second. Adjust if you encounter audio skipping. + const int fill_rate = 45; +@@ -36,12 +39,13 @@ static void sound_cleanup(); + + Music_Player::Music_Player() + { +- emu_ = 0; +- scope_buf = 0; +- paused = false; ++ emu_ = 0; ++ scope_buf = 0; ++ paused = false; ++ track_info_ = NULL; + } + +-blargg_err_t Music_Player::init( long rate ) ++gme_err_t Music_Player::init( long rate ) + { + sample_rate = rate; + +@@ -56,17 +60,18 @@ blargg_err_t Music_Player::init( long ra + void Music_Player::stop() + { + sound_stop(); +- delete emu_; +- emu_ = 0; ++ gme_delete( emu_ ); ++ emu_ = NULL; + } + + Music_Player::~Music_Player() + { + stop(); + sound_cleanup(); ++ gme_free_info( track_info_ ); + } + +-blargg_err_t Music_Player::load_file( const char* path ) ++gme_err_t Music_Player::load_file( const char* path ) + { + stop(); + +@@ -79,34 +84,36 @@ blargg_err_t Music_Player::load_file( co + if ( !p ) + p = m3u_path + strlen( m3u_path ); + strcpy( p, ".m3u" ); +- if ( emu_->load_m3u( m3u_path ) ) { } // ignore error ++ if ( gme_load_m3u( emu_, m3u_path ) ) { } // ignore error + + return 0; + } + + int Music_Player::track_count() const + { +- return emu_ ? emu_->track_count() : false; ++ return emu_ ? gme_track_count( emu_ ) : false; + } + +-blargg_err_t Music_Player::start_track( int track ) ++gme_err_t Music_Player::start_track( int track ) + { + if ( emu_ ) + { ++ gme_free_info( track_info_ ); ++ track_info_ = NULL; ++ RETURN_ERR( gme_track_info( emu_, &track_info_, track ) ); ++ + // Sound must not be running when operating on emulator + sound_stop(); +- RETURN_ERR( emu_->start_track( track ) ); ++ RETURN_ERR( gme_start_track( emu_, track ) ); + + // Calculate track length +- if ( !emu_->track_info( &track_info_ ) ) +- { +- if ( track_info_.length <= 0 ) +- track_info_.length = track_info_.intro_length + +- track_info_.loop_length * 2; +- } +- if ( track_info_.length <= 0 ) +- track_info_.length = (long) (2.5 * 60 * 1000); +- emu_->set_fade( track_info_.length ); ++ if ( track_info_->length <= 0 ) ++ track_info_->length = track_info_->intro_length + ++ track_info_->loop_length * 2; ++ ++ if ( track_info_->length <= 0 ) ++ track_info_->length = (long) (2.5 * 60 * 1000); ++ gme_set_fade( emu_, track_info_->length ); + + paused = false; + sound_start(); +@@ -137,7 +144,7 @@ void Music_Player::resume() + + bool Music_Player::track_ended() const + { +- return emu_ ? emu_->track_ended() : false; ++ return emu_ ? gme_track_ended( emu_ ) : false; + } + + void Music_Player::set_stereo_depth( double tempo ) +@@ -150,15 +157,15 @@ void Music_Player::set_stereo_depth( dou + void Music_Player::set_tempo( double tempo ) + { + suspend(); +- emu_->set_tempo( tempo ); ++ gme_set_tempo( emu_, tempo ); + resume(); + } + + void Music_Player::mute_voices( int mask ) + { + suspend(); +- emu_->mute_voices( mask ); +- emu_->ignore_silence( mask != 0 ); ++ gme_mute_voices( emu_, mask ); ++ gme_ignore_silence( emu_, mask != 0 ); + resume(); + } + +@@ -167,7 +174,7 @@ void Music_Player::fill_buffer( void* da + Music_Player* self = (Music_Player*) data; + if ( self->emu_ ) + { +- if ( self->emu_->play( count, out ) ) { } // ignore error ++ if ( gme_play( self->emu_, count, out ) ) { } // ignore error + + if ( self->scope_buf ) + memcpy( self->scope_buf, out, self->scope_buf_size * sizeof *self->scope_buf ); +Index: CMakeLists.txt +=================================================================== +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -1,6 +1,8 @@ + # CMake project definition file. + project(libgme) + ++include (CheckCXXCompilerFlag) ++ + set(GME_VERSION 0.5.5 CACHE INTERNAL "libgme Version") + + # 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't. +@@ -54,6 +56,33 @@ if (USE_GME_NSFE AND NOT USE_GME_NSF) + SET(USE_GME_NSF 1 CACHE BOOL "Enable NES NSF music emulation" FORCE) + endif() + ++# Check for GCC "visibility" support. ++if (CMAKE_COMPILER_IS_GNUCXX) ++ check_cxx_compiler_flag (-fvisibility=hidden __LIBGME_TEST_VISIBILITY) ++ set (ENABLE_VISIBILITY OFF) ++ if (__LIBGME_TEST_VISIBILITY) ++ # get the gcc version ++ exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info) ++ string (REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}") ++ ++ # gcc <4.1 had poor support for symbol visibility ++ if ((${_gcc_version} VERSION_GREATER "4.1") OR (${_gcc_version} VERSION_EQUAL "4.1")) ++ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") ++ set (ENABLE_VISIBILITY ON) ++ add_definitions (-DLIBGME_VISIBILITY) ++ ++ # GCC >= 4.2 also correctly supports making inline members have hidden ++ # visibility by default. ++ if ((${_gcc_version} VERSION_GREATER "4.2") OR (${_gcc_version} VERSION_EQUAL "4.2")) ++ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") ++ endif() ++ endif() ++ endif() # test visibility ++endif (CMAKE_COMPILER_IS_GNUCXX) ++ ++# Cache this result ++set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility") ++ + # Shared library defined here + add_subdirectory(gme) + diff --git a/libgme.changes b/libgme.changes new file mode 100644 index 0000000..4e03163 --- /dev/null +++ b/libgme.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Tue Dec 14 07:54:59 UTC 2010 - reddwarf@opensuse.org + +- Initial package + diff --git a/libgme.spec b/libgme.spec new file mode 100644 index 0000000..f47ab91 --- /dev/null +++ b/libgme.spec @@ -0,0 +1,116 @@ +# +# spec file for package libgme +# +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +%define soname 0 + +Name: libgme +Version: to_be_filled_by_service +Release: 0 +License: LGPLv2.1+ +Summary: Collection of video game music file emulators +Url: http://code.google.com/p/game-music-emu/ +Group: System/Libraries +Source0: game-music-emu-%{version}.tbz2 +# PATCH-FIX-UPSTREAM %{name}-0.5.5-LIB_SUFFIX.patch http://code.google.com/p/game-music-emu/issues/detail?id=8 reddwarf@opensuse.org -- Add LIB_SUFFIX support +Patch0: %{name}-0.5.5-LIB_SUFFIX.patch +# PATCH-FIX-UPSTREAM %{name}-0.5.5-pkg_config.patch reddwarf@opensuse.org -- Add pkg-config file. From upstream SVN. +Patch1: %{name}-0.5.5-pkg_config.patch +# PATCH-FIX-UPSTREAM %{name}-0.5.5-symbol_visibility.patch reddwarf@opensuse.org -- Don't export internal symbols. From upstream SVN. +Patch2: %{name}-0.5.5-symbol_visibility.patch +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: pkg-config + +%description +Game_Music_Emu is a collection of video game music file emulators that support +the following formats and systems: +- AY: ZX Spectrum/Amstrad CPC +- GBS: Nintendo Game Boy +- GYM: Sega Genesis/Mega Drive +- HES: NEC TurboGrafx-16/PC Engine +- KSS: MSX Home Computer/other Z80 systems (doesn't support FM sound) +- NSF/NSFE: Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound) +- SAP: Atari systems using POKEY sound chip +- SPC: Super Nintendo/Super Famicom +- VGM/VGZ: Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro + +%package -n %{name}%{soname} +Summary: Collection of video game music file emulators +Group: System/Libraries + +%description -n %{name}%{soname} +Game_Music_Emu is a collection of video game music file emulators that support +the following formats and systems: +- AY: ZX Spectrum/Amstrad CPC +- GBS: Nintendo Game Boy +- GYM: Sega Genesis/Mega Drive +- HES: NEC TurboGrafx-16/PC Engine +- KSS: MSX Home Computer/other Z80 systems (doesn't support FM sound) +- NSF/NSFE: Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound) +- SAP: Atari systems using POKEY sound chip +- SPC: Super Nintendo/Super Famicom +- VGM/VGZ: Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro + +%package devel +Summary: Development libraries and headers for %{name} +Group: Development/Libraries/C and C++ +Requires: %{name}%{soname} = %{version} + +%description devel +The developmental files that must be installed in order to compile applications +which use %{name}. + +%prep +%setup -q -n game-music-emu-%{version} +%patch0 +%patch1 +%patch2 +sed -i 's/\r$//' changes.txt design.txt gme.txt license.txt readme.txt + +%build +export CFLAGS='%{optflags}' +export CXXFLAGS='%{optflags}' +%{__mkdir} build +cd build +cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \ + -DCMAKE_BUILD_TYPE=Release .. +%{__make} %{?_smp_mflags} VERBOSE=1 + +%install +cd build +%make_install + +%post -n %{name}%{soname} -p /sbin/ldconfig + +%postun -n %{name}%{soname} -p /sbin/ldconfig + +%files -n %{name}%{soname} +%defattr(0644, root, root, 0755) +%doc changes.txt gme.txt license.txt readme.txt +%{_libdir}/%{name}.so.%{soname}* + +%files devel +%defattr(0644, root, root, 0755) +%doc design.txt +%{_includedir}/gme +%{_libdir}/%{name}.so +%{_libdir}/pkgconfig/%{name}.pc + +%changelog