From b7c18dfa30aba3da4bd2aa7793f1a099a83b914a Mon Sep 17 00:00:00 2001 From: fgsch Date: Sun, 9 Sep 2007 15:17:06 +0000 Subject: [PATCH] replace the linux and i386 specific binary with a proper native version. tested on i386, macppc and sparc64. with input and ok merdely@ more testing appreciated. --- emulators/snes9x/Makefile | 48 +++++---- emulators/snes9x/distinfo | 10 +- emulators/snes9x/patches/patch-configure_in | 60 +++++++++++ emulators/snes9x/patches/patch-soundux_h | 12 +++ emulators/snes9x/patches/patch-unix_unix_cpp | 101 +++++++++++++++++++ emulators/snes9x/pkg/PLIST | 14 ++- 6 files changed, 219 insertions(+), 26 deletions(-) create mode 100644 emulators/snes9x/patches/patch-configure_in create mode 100644 emulators/snes9x/patches/patch-soundux_h create mode 100644 emulators/snes9x/patches/patch-unix_unix_cpp diff --git a/emulators/snes9x/Makefile b/emulators/snes9x/Makefile index 28217c3a476..3475fb54ed5 100644 --- a/emulators/snes9x/Makefile +++ b/emulators/snes9x/Makefile @@ -1,34 +1,48 @@ -# $OpenBSD: Makefile,v 1.8 2006/10/19 00:15:36 sturm Exp $ +# $OpenBSD: Makefile,v 1.9 2007/09/09 15:17:06 fgsch Exp $ -ONLY_FOR_ARCHS= i386 - -COMMENT= "emulates the Super Nintendo Entertainment System" - -PKGNAME= snes9x-1.37cp0 -DISTNAME= s9x.linuxc6.137.i386 +COMMENT= emulates the Super Nintendo Entertainment System +DISTNAME= snes9x-1.51-src +PKGNAME= ${DISTNAME:S/-src//} CATEGORIES= emulators games -HOMEPAGE= http://www.snes9x.com -PERMIT_PACKAGE_CDROM= Yes +HOMEPAGE= http://www.snes9x.com/ + +# non-commercial +PERMIT_PACKAGE_CDROM= No PERMIT_PACKAGE_FTP= Yes -PERMIT_DISTFILES_CDROM= Yes +PERMIT_DISTFILES_CDROM= No PERMIT_DISTFILES_FTP= Yes -MASTER_SITES= ${HOMEPAGE}/zips/ +WANTLIB+= X11 Xext Xxf86dga Xxf86vm c m pthread stdc++ z -RUN_DEPENDS= ::emulators/fedora/base +MASTER_SITES= http://vincent.grigorieff.free.fr/snes9x/ \ + http://files.ipherswipsite.com/snes9x/ +EXTRACT_SUFX= .tar.bz2 + +LIB_DEPENDS= png::graphics/png + +.if ${MACHINE_ARCH} == "i386" +BUILD_DEPENDS= ::devel/nasm +.endif + +AUTOCONF_VERSION= 2.59 USE_X11= Yes -NO_BUILD= Yes +USE_GMAKE= Yes +CONFIGURE_STYLE=autoconf no-autoheader +CONFIGURE_ENV= OPTFLAGS="${CXXFLAGS} -I${LOCALBASE}/include/libpng" \ + LIBS="-L${LOCALBASE}/lib" + NO_REGRESS= Yes -WRKDIST= ${WRKDIR} + +post-configure: + @perl -pi -e 's|\b_C\b|__C|g' ${WRKSRC}/cheats.cpp do-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/snes9x ${INSTALL_PROGRAM} ${WRKSRC}/snes9x ${PREFIX}/bin - ${INSTALL_DATA} ${WRKSRC}/CHANGES.TXT ${PREFIX}/share/doc/snes9x - ${INSTALL_DATA} ${WRKSRC}/HARDWARE.TXT ${PREFIX}/share/doc/snes9x - ${INSTALL_DATA} ${WRKSRC}/README.TXT ${PREFIX}/share/doc/snes9x + ${INSTALL_DATA} ${WRKSRC}/doc/*.txt ${WRKSRC}/unix/docs/*.txt \ + ${PREFIX}/share/doc/snes9x .include diff --git a/emulators/snes9x/distinfo b/emulators/snes9x/distinfo index 3f8739b0239..79a74d31f8d 100644 --- a/emulators/snes9x/distinfo +++ b/emulators/snes9x/distinfo @@ -1,5 +1,5 @@ -MD5 (s9x.linuxc6.137.i386.tar.gz) = EK8ZEIhf5LCavFrfvquQvg== -RMD160 (s9x.linuxc6.137.i386.tar.gz) = il3yeOc1haDw+mKYWN7fXI3lRDo= -SHA1 (s9x.linuxc6.137.i386.tar.gz) = V/XflU+f9Pl9qCDudv3KV9Z9v54= -SHA256 (s9x.linuxc6.137.i386.tar.gz) = ZTLuG+AnvRrCeXD5MjLwTJ0arGeANiovDfmU7pKSKIs= -SIZE (s9x.linuxc6.137.i386.tar.gz) = 740965 +MD5 (snes9x-1.51-src.tar.bz2) = oQOMx2H0ADGM3O2WCXL4pw== +RMD160 (snes9x-1.51-src.tar.bz2) = WBNAWwXxgSJGFPlei6PDCfeeGzY= +SHA1 (snes9x-1.51-src.tar.bz2) = oN4j+zdkY9J/To/H8RQkvTxZhYU= +SHA256 (snes9x-1.51-src.tar.bz2) = cMj0H8fx4ABgUSfg9CYePrUscgGbPL+byAYbC4zN9oc= +SIZE (snes9x-1.51-src.tar.bz2) = 1707256 diff --git a/emulators/snes9x/patches/patch-configure_in b/emulators/snes9x/patches/patch-configure_in new file mode 100644 index 00000000000..474c7539af8 --- /dev/null +++ b/emulators/snes9x/patches/patch-configure_in @@ -0,0 +1,60 @@ +$OpenBSD: patch-configure_in,v 1.1 2007/09/09 15:17:06 fgsch Exp $ +--- configure.in.orig Wed Aug 2 16:04:02 2006 ++++ configure.in Thu Sep 6 12:48:19 2007 +@@ -230,30 +230,30 @@ else + unset snes9x_cv_option_custom_march + fi + +-if test no = "$with_march" ; then +- AC_SYS_COMPILER_FLAG(-O2, o2, OPTIMIZE, [ +- AC_SYS_COMPILER_FLAG(-O1, o1, OPTIMIZE) +- ]) +-else +- AC_SYS_COMPILER_FLAG(-O6, o6, OPTIMIZE, [ +- AC_SYS_COMPILER_FLAG(-O4, o4, OPTIMIZE, [ +- AC_SYS_COMPILER_FLAG(-O3, o3, OPTIMIZE, [ +- AC_SYS_COMPILER_FLAG(-O2, o2, OPTIMIZE, [ +- AC_SYS_COMPILER_FLAG(-O1, o1, OPTIMIZE) +- ]) +- ]) +- ]) +- ]) +-fi ++dnl if test no = "$with_march" ; then ++dnl AC_SYS_COMPILER_FLAG(-O2, o2, OPTIMIZE, [ ++dnl AC_SYS_COMPILER_FLAG(-O1, o1, OPTIMIZE) ++dnl ]) ++dnl else ++dnl AC_SYS_COMPILER_FLAG(-O6, o6, OPTIMIZE, [ ++dnl AC_SYS_COMPILER_FLAG(-O4, o4, OPTIMIZE, [ ++dnl AC_SYS_COMPILER_FLAG(-O3, o3, OPTIMIZE, [ ++dnl AC_SYS_COMPILER_FLAG(-O2, o2, OPTIMIZE, [ ++dnl AC_SYS_COMPILER_FLAG(-O1, o1, OPTIMIZE) ++dnl ]) ++dnl ]) ++dnl ]) ++dnl ]) ++dnl fi + + AC_SYS_COMPILER_FLAG(-fomit-frame-pointer, omit_frame_pointer, OPTIMIZE) + AC_SYS_COMPILER_FLAG(-fno-exceptions, no_exceptions, OPTIMIZE) + AC_SYS_COMPILER_FLAG(-Wall, Wall, OPTIMIZE) + AC_SYS_COMPILER_FLAG(-W, W, OPTIMIZE) +-AC_SYS_COMPILER_FLAG(-pedantic, pedantic, OPTIMIZE) ++dnl AC_SYS_COMPILER_FLAG(-pedantic, pedantic, OPTIMIZE) + dnl FIXME: Most of these should be fixed, but several are part of the API. + AC_SYS_COMPILER_FLAG(-Wno-unused-parameter, Wno_unused_parameter, OPTIMIZE) +-AC_SYS_COMPILER_FLAG(-pipe, pipe, OPTIMIZE) ++dnl AC_SYS_COMPILER_FLAG(-pipe, pipe, OPTIMIZE) + AC_SYS_COMPILER_FLAG(-fno-rtti, no_rtti, RTTIFLAG) + + dnl AC_ARG_WITH(extra_opt,[ --with(out)-extra-opt Use extra optimization flags (default: none)],[],[with_extra_opt=no]) +@@ -859,7 +859,7 @@ if test yes = "$with_sound" ; then + AC_MSG_CHECKING(if sound is supported on this platform) + AC_CACHE_VAL(snes9x_cv_sound, [ + AC_TRY_COMPILE([ +-#if defined(__linux) || defined(__sun) || defined(__sgi) ++#if defined(__linux) || defined(__sun) || defined(__sgi) || defined(__OpenBSD__) + /* */ + #else + #error No sound for this platform diff --git a/emulators/snes9x/patches/patch-soundux_h b/emulators/snes9x/patches/patch-soundux_h new file mode 100644 index 00000000000..9b669549f56 --- /dev/null +++ b/emulators/snes9x/patches/patch-soundux_h @@ -0,0 +1,12 @@ +$OpenBSD: patch-soundux_h,v 1.1 2007/09/09 15:17:06 fgsch Exp $ +--- soundux.h.orig Thu Sep 6 13:10:15 2007 ++++ soundux.h Thu Sep 6 13:10:30 2007 +@@ -220,7 +220,7 @@ typedef struct { + int stereo; // stereo or mono + bool8 sixteen_bit; // 16bit or 8bit sample + bool8 encoded; // ** port specific +-#ifdef __sun ++#if defined(__sun) || defined(__OpenBSD__) + int last_eof; // ** port specific + #endif + #ifdef __sgi diff --git a/emulators/snes9x/patches/patch-unix_unix_cpp b/emulators/snes9x/patches/patch-unix_unix_cpp new file mode 100644 index 00000000000..4438c21cc67 --- /dev/null +++ b/emulators/snes9x/patches/patch-unix_unix_cpp @@ -0,0 +1,101 @@ +$OpenBSD: patch-unix_unix_cpp,v 1.1 2007/09/09 15:17:06 fgsch Exp $ +--- unix/unix.cpp.orig Sun Apr 29 01:51:08 2007 ++++ unix/unix.cpp Thu Sep 6 14:59:46 2007 +@@ -210,6 +210,10 @@ pthread_mutex_t mutex; + #endif + #endif + ++#if !defined(NOSOUND) && defined(__OpenBSD__) ++#include ++#endif ++ + //Breaks sol9 and probably others. + //#if defined(__sun) && defined(__GNUC__) + //typedef void (*SIG_PF)(); +@@ -264,7 +268,7 @@ void ReadJoysticks (); + #define CONFIGURABLE_SOUND_DEVICE + char *sound_device = "/dev/dsp"; + #endif +-#if !defined(NOSOUND) && defined (__sun) ++#if !defined(NOSOUND) && (defined(__sun) || defined(__OpenBSD__)) + #define CONFIGURABLE_SOUND_DEVICE + char *sound_device = "/dev/audio"; + #endif +@@ -285,7 +289,7 @@ const char *rom_dir="." SLASH_STR "roms"; + const char *inc_format="%03d"; + + //FIXME: I see no reason not to configureenable this for all Unixen +-#if defined(DEBUGGER) && (defined(__linux) || defined(__sun)) ++#if defined(DEBUGGER) && (defined(__linux) || defined(__sun) || defined(__OpenBSD__)) + static void sigbrkhandler(int) + { + CPU.Flags |= DEBUG_MODE_FLAG; +@@ -1653,10 +1657,14 @@ void S9xUnixProcessSound (void) + } + #endif + +-#if !defined(NOSOUND) && defined(__sun) ++#if !defined(NOSOUND) && (defined(__sun) || defined(__OpenBSD__)) + static int Rates[8] = + { ++#if defined(__sun) + 0, 8000, 11025, 16000, 22050, 32000, 37800, 44100 ++#else ++ 0, 8000, 11025, 16000, 22050, 32000, 44100, 48000 ++#endif + }; + + static int BufferSizes [8] = +@@ -1712,6 +1720,7 @@ bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int + so.playback_rate, so.buffer_size, so.sixteen_bit ? "yes" : "no", + so.stereo ? "yes" : "no", so.encoded ? "yes" : "no"); + ++ S9xSetPlaybackRate (so.playback_rate); + return (TRUE); + } + #endif +@@ -1847,7 +1856,7 @@ bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int + #endif + + +-#if !defined(NOSOUND) && (defined (__linux) || defined (__sun)) ++#if !defined(NOSOUND) && (defined (__linux) || defined (__sun) || defined(__OpenBSD__)) + void S9xUnixProcessSound (void) + { + } +@@ -1890,7 +1899,7 @@ void *S9xProcessSound (void *) + } + #endif + +-#if !defined(NOSOUND) && (defined (__linux) || defined (__sun)) ++#if !defined(NOSOUND) && (defined (__linux) || defined (__sun) || defined(__OpenBSD__)) + void S9xGenerateSound () + { + /* Linux and Sun versions */ +@@ -2009,7 +2018,7 @@ void *S9xProcessSound (void *) + #endif + + #endif +-#ifdef __sun ++#if defined(__sun) || defined(__OpenBSD__) + audio_info_t audio; + if (!Settings.ThreadSound) + { +@@ -2121,7 +2130,7 @@ void *S9xProcessSound (void *) + } while (Settings.ThreadSound); + #endif + +-#ifdef __sun ++#if defined(__sun) || defined(__OpenBSD__) + if (!Settings.ThreadSound) + write (so.sound_fd, NULL, 0); + #endif +@@ -2130,7 +2139,7 @@ void *S9xProcessSound (void *) + } + #endif + +-#if !defined(NOSOUND) && defined(__sun) ++#if !defined(NOSOUND) && (defined(__sun) || defined(__OpenBSD__)) + uint8 int2ulaw(int ch) + { + int mask; diff --git a/emulators/snes9x/pkg/PLIST b/emulators/snes9x/pkg/PLIST index 39cd444fc95..ce176608a89 100644 --- a/emulators/snes9x/pkg/PLIST +++ b/emulators/snes9x/pkg/PLIST @@ -1,6 +1,12 @@ -@comment $OpenBSD: PLIST,v 1.2 2004/09/15 00:42:04 espie Exp $ +@comment $OpenBSD: PLIST,v 1.3 2007/09/09 15:17:06 fgsch Exp $ bin/snes9x share/doc/snes9x/ -share/doc/snes9x/CHANGES.TXT -share/doc/snes9x/HARDWARE.TXT -share/doc/snes9x/README.TXT +share/doc/snes9x/changes.txt +share/doc/snes9x/control-inputs.txt +share/doc/snes9x/controls.txt +share/doc/snes9x/faqs.txt +share/doc/snes9x/hardware.txt +@comment share/doc/snes9x/readme.txt +share/doc/snes9x/readme_unix.txt +share/doc/snes9x/snapshots.txt +share/doc/snes9x/snes9x-license.txt