From 3f6e0a87f11286a4b7a7bf5f291b8229cf59b758 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sat, 17 Jan 2015 19:32:34 +0100 Subject: [PATCH 1/2] Add RetroArch recipe --- .../patches/retroarch-1.0.0.3_beta.patchset | 35 ++++++++ .../retroarch/retroarch-1.0.0.3_beta.recipe | 81 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 games-emulation/retroarch/patches/retroarch-1.0.0.3_beta.patchset create mode 100644 games-emulation/retroarch/retroarch-1.0.0.3_beta.recipe diff --git a/games-emulation/retroarch/patches/retroarch-1.0.0.3_beta.patchset b/games-emulation/retroarch/patches/retroarch-1.0.0.3_beta.patchset new file mode 100644 index 000000000..33669b03f --- /dev/null +++ b/games-emulation/retroarch/patches/retroarch-1.0.0.3_beta.patchset @@ -0,0 +1,35 @@ +From 4a135acf9cafd827f1a59ecdf268253848ca80b7 Mon Sep 17 00:00:00 2001 +From: Puck Meerburg +Date: Sat, 17 Jan 2015 18:58:21 +0100 +Subject: FFMPEG record driver: Fix Haiku build + + +diff --git a/record/ffmpeg.c b/record/ffmpeg.c +index f0099e0..6f17aa4 100644 +--- a/record/ffmpeg.c ++++ b/record/ffmpeg.c +@@ -27,7 +27,9 @@ extern "C" { + #include + #include + #include ++#ifndef __HAIKU__ + #include ++#endif + #include + #ifdef HAVE_AV_CHANNEL_LAYOUT + #include +@@ -56,7 +58,10 @@ extern "C" { + #include + #endif + +-#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(52, 9, 0) ++#if defined(__HAIKU__) ++#define av_frame_alloc avcodec_alloc_frame ++#define av_frame_free av_free ++#elif LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(52, 9, 0) + #define av_frame_alloc avcodec_alloc_frame + #define av_frame_free avcodec_free_frame + #endif +-- +1.8.3.4 + diff --git a/games-emulation/retroarch/retroarch-1.0.0.3_beta.recipe b/games-emulation/retroarch/retroarch-1.0.0.3_beta.recipe new file mode 100644 index 000000000..6a93f59a2 --- /dev/null +++ b/games-emulation/retroarch/retroarch-1.0.0.3_beta.recipe @@ -0,0 +1,81 @@ +SUMMARY="The reference frontend of libretro" +DESCRIPTION="RetroArch is a frontend for the libretro specification for \ +emulation. Libretro supports easy creation of emulators, but people can also \ +make their own frontends and plug existing emulators. It also supports OpenGL \ +shaders and other cool stuff." +HOMEPAGE="https://libretro.com" +SRC_URI="https://github.com/libretro/RetroArch/archive/1.0.0.3-beta.tar.gz" +CHECKSUM_SHA256="bd5be24d81c214db036b756e222f5a8e5cddd3e1c1a2a98180317673c0ca0cc7" +SOURCE_DIR="RetroArch-1.0.0.3-beta" +REVISION="1" +LICENSE="GNU GPL v3" +COPYRIGHT="2010-2015 The RetroArch Team" +PATCHES="retroarch-1.0.0.3_beta.patchset" + +ARCHITECTURES="?x86 ?x86_64" +if [ $effectiveTargetArchitecture != x86_gcc2 ]; then + # x86_gcc2 is fine as primary target architecture as long as we're building + # for a different secondary architecture. + ARCHITECTURES="$ARCHITECTURES x86_gcc2" +else + ARCHITECTURES="$ARCHITECTURES !x86_gcc2" +fi +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + retroarch$secondaryArchSuffix = $portVersion + app:retroarch$secondaryArchSuffix = $portVersion + cmd:retroarch$secondaryArchSuffix = $portVersion + cmd:retroarch_joyconfig$secondaryArchSuffix = $portVersion + " +PROVIDES_devel=" + retroarch${secondaryArchSuffix}_devel = $portVersion + devel:retroarch$secondaryArchSuffix = $portVersion + " + +REQUIRES=" + haiku$secondaryArchSuffix + lib:libsdl2$secondaryArchSuffix + lib:libGL$secondaryArchSuffix + ffmpeg$secondaryArchSuffix + " +REQUIRES_devel=" + haiku${secondaryArchSuffix}_devel + retroarch$secondaryArchSuffix == $portVersion base + ffmpeg${secondaryArchSuffix}_devel + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libsdl2$secondaryArchSuffix + devel:libgl$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:make + cmd:which + cmd:pkg_config$secondaryArchSuffix + cmd:gcc$secondaryArchSuffix + " + +BUILD() +{ + ./configure + make $jobArgs +} + +INSTALL() +{ + mkdir -p $appsDir/RetroArch + mkdir -p $binDir + mkdir -p $includeDir + + cp retroarch $appsDir/RetroArch + cp tools/retroarch-joyconfig $appsDir/RetroArch + + symlinkRelative -s $appsDir/RetroArch/* $binDir + addAppDeskbarSymlink $appsDir/RetroArch/retroarch RetroArch + + cp libretro.h $includeDir + packageEntries devel \ + $developDir +} From 26082ca34f48a98b5a484a2f3034c3b69408c233 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sat, 17 Jan 2015 20:23:01 +0100 Subject: [PATCH 2/2] Add bsnes_libretro recipe --- .../bsnes_libretro/bsnes_libretro-git.recipe | 50 ++++++++ .../patches/bsnes_libretro_x86-git.patchset | 119 ++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 games-emulation/bsnes_libretro/bsnes_libretro-git.recipe create mode 100644 games-emulation/bsnes_libretro/patches/bsnes_libretro_x86-git.patchset diff --git a/games-emulation/bsnes_libretro/bsnes_libretro-git.recipe b/games-emulation/bsnes_libretro/bsnes_libretro-git.recipe new file mode 100644 index 000000000..959733d67 --- /dev/null +++ b/games-emulation/bsnes_libretro/bsnes_libretro-git.recipe @@ -0,0 +1,50 @@ +SUMMARY="A port of bsnes to the libretro architecture" +DESCRIPTION="bsnes is a SNES, NES, and Game Boy (DMG), Color, and Advance \ +emulator. It has a focus on accuracy, but also on speed and can also emulate \ +the Super Game Boy." +HOMEPAGE="http://wiki.libretro.com/index.php?title=Bsnes" +SRC_URI="https://github.com/libretro/bsnes-libretro/archive/4a98250c9bf814d3b48ae8e7836a72115823c05a.tar.gz" +CHECKSUM_SHA256="ae3742fdffce9581ff92ce56bd407dd53afe60efa6efa044bde79f3d89629c39" +SOURCE_DIR="bsnes-libretro-4a98250c9bf814d3b48ae8e7836a72115823c05a" +REVISION="1" +LICENSE="GNU GPL v3" +COPYRIGHT="2014-2015 byuu, the libretro team" + +ARCHITECTURES="?x86 ?x86_64" +if [ $effectiveTargetArchitecture != x86_gcc2 ]; then + # x86_gcc2 is fine as primary target architecture as long as we're building + # for a different secondary architecture. + ARCHITECTURES="$ARCHITECTURES x86_gcc2" +else + ARCHITECTURES="$ARCHITECTURES !x86_gcc2" +fi +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + bsnes_libretro$secondaryArchSuffix = $portVersion + lib:bsnes_libretro$secondaryArchSuffix = $portVersion + " + +REQUIRES=" + haiku$secondaryArchSuffix + lib:libstdc++$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:make + cmd:gcc$secondaryArchSuffix + " + +BUILD() +{ + make $jobArgs ui=target-libretro +} + +INSTALL() +{ + mkdir -p $libDir + cp -a out/bsnes_libretro.so $libDir +} diff --git a/games-emulation/bsnes_libretro/patches/bsnes_libretro_x86-git.patchset b/games-emulation/bsnes_libretro/patches/bsnes_libretro_x86-git.patchset new file mode 100644 index 000000000..2778ae6cc --- /dev/null +++ b/games-emulation/bsnes_libretro/patches/bsnes_libretro_x86-git.patchset @@ -0,0 +1,119 @@ +From 56a7340a68473a078cc321d4c50bf8a0d1628efd Mon Sep 17 00:00:00 2001 +From: Puck Meerburg +Date: Sat, 17 Jan 2015 19:54:22 +0100 +Subject: Fix Haiku build + + +diff --git a/Makefile b/Makefile +index 70f3e6d..96e38da 100644 +--- a/Makefile ++++ b/Makefile +@@ -47,6 +47,9 @@ ifeq ($(findstring libretro,$(ui)),) + ifeq ($(platform),x) + flags += -march=native + link += -Wl,-export-dynamic -ldl -lX11 -lXext ++ else ifeq ($(platform),haiku) ++ flags += -march=native ++ link += -Wl,-export-dynamic + else ifeq ($(platform),win) + ifeq ($(arch),win32) + flags += -m32 +diff --git a/nall/Makefile b/nall/Makefile +index 4e12a39..051cfe2 100755 +--- a/nall/Makefile ++++ b/nall/Makefile +@@ -25,6 +25,9 @@ ifeq ($(platform),) + else ifneq ($(findstring Darwin,$(uname)),) + platform := osx + delete = rm -f $1 ++ else ifneq ($(findstring Haiku,$(uname)),) ++ platform := haiku ++ delete = rm -f $1 + else + platform := unix + delete = rm -f $1 +diff --git a/nall/directory.hpp b/nall/directory.hpp +index 45a062c..d711554 100644 +--- a/nall/directory.hpp ++++ b/nall/directory.hpp +@@ -190,12 +190,18 @@ private: + while(ep = readdir(dp)) { + if(!strcmp(ep->d_name, ".")) continue; + if(!strcmp(ep->d_name, "..")) continue; ++#if defined(PLATFORM_HAIKU) ++ struct stat sp = {0}; ++ stat(string{pathname, ep->d_name}, &sp); ++ bool is_directory = S_ISDIR(sp.st_mode); ++#else + bool is_directory = ep->d_type & DT_DIR; + if(ep->d_type & DT_UNKNOWN) { + struct stat sp = {0}; + stat(string{pathname, ep->d_name}, &sp); + is_directory = S_ISDIR(sp.st_mode); + } ++#endif + if(is_directory) { + if(strmatch(ep->d_name, pattern)) list.append(ep->d_name); + } +@@ -215,7 +221,13 @@ private: + while(ep = readdir(dp)) { + if(!strcmp(ep->d_name, ".")) continue; + if(!strcmp(ep->d_name, "..")) continue; ++#if defined(PLATFORM_HAIKU) ++ struct stat sp = {0}; ++ stat(string{pathname, ep->d_name}, &sp); ++ if(S_ISDIR(sp.st_mode)) { ++#else + if((ep->d_type & DT_DIR) == 0) { ++#endif + if(strmatch(ep->d_name, pattern)) list.append(ep->d_name); + } + } +diff --git a/nall/intrinsics.hpp b/nall/intrinsics.hpp +index db44996..e3dc078 100755 +--- a/nall/intrinsics.hpp ++++ b/nall/intrinsics.hpp +@@ -3,7 +3,7 @@ + + struct Intrinsics { + enum class Compiler : unsigned { Clang, GCC, VisualCPP, Unknown }; +- enum class Platform : unsigned { Windows, MacOSX, X, Unknown }; //X = Linux, BSD, etc ++ enum class Platform : unsigned { Windows, MacOSX, X, BeAPI, Unknown }; //X = Linux, BSD, etc + enum class Architecture : unsigned { x86, amd64, ARM, Unknown }; + enum class Endian : unsigned { LSB, MSB, Unknown }; + +@@ -38,6 +38,9 @@ struct Intrinsics { + #elif defined(linux) || defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GNU__) + #define PLATFORM_X + Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::X; } ++#elif defined(__HAIKU__) ++ #define PLATFORM_HAIKU ++ Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::BeAPI; } + #else + #warning "unable to detect platform" + #define PLATFORM_UNKNOWN +diff --git a/target-libretro/Makefile b/target-libretro/Makefile +index b923e2b..66bf743 100755 +--- a/target-libretro/Makefile ++++ b/target-libretro/Makefile +@@ -7,6 +7,8 @@ output := libretro + + ifeq ($(platform),unix) + flags += -fPIC ++else ifeq ($(platform),haiku) ++ flags += -fPIC + else ifeq ($(platform),osx) + flags += -fPIC + else ifeq ($(platform),ios) +@@ -35,6 +37,8 @@ obj/libretro.o: $(ui)/libretro.cpp $(ui)/* + build: $(objects) + ifeq ($(platform),unix) + $(compiler) -o out/bsnes_libretro.so -shared $(objects) -ldl -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T ++else ifeq ($(platform),haiku) ++ $(compiler) -o out/bsnes_libretro.so -shared $(objects) -lnetwork -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T + else ifeq ($(platform),ios) + $(compiler) -o out/bsnes_libretro_ios.dylib -dynamiclib $(objects) -isysroot $(IOSSDK) -arch armv7 + else ifeq ($(platform),osx) +-- +1.8.3.4 +