Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions switch/libprojectM/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Maintainer: Rhys Koedijk <rhys@koedijk.co.nz>

pkgbasename=libprojectm
pkgname=switch-$pkgbasename
pkgver=r1871.0e46a1fb7
pkgrel=1
pkgdesc='Cross-platform music visualization. Open-source and Milkdrop-compatible'
arch=('any')
url='https://github.com/projectM-visualizer/projectm'
license=('(L)GPL')
options=(!strip libtool staticlibs)
source=(${pkgname}::"git+${url}.git#commit=0e46a1fb785851870f030cec8368faba13882f13")
sha256sums=('SKIP')
depends=('switch-ftgl' 'switch-mesa')
makedepends=('git' 'switch-pkg-config' 'devkitpro-pkgbuild-helpers')
groups=('switch-portlibs')

pkgver() {
cd "$srcdir/${pkgname}"
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
cd ${pkgname}
patch -Np1 -i "${startdir}/${pkgbasename}-4befa4516-platform_definitions.patch"
patch -Np1 -i "${startdir}/${pkgbasename}-4befa4516-disable_navtive_preset_factory.patch"
}

build() {
cd ${pkgname}

source /opt/devkitpro/switchvars.sh

libtoolize
aclocal
autoheader
automake --add-missing
autoconf

./configure --prefix="${PORTLIBS_PREFIX}" --host=aarch64-none-elf \
--disable-shared --enable-static --disable-threading --disable-sdl

make
}

package() {
cd ${pkgname}

make DESTDIR="$pkgdir" install

install -Dm644 LICENSE.txt "$pkgdir"/opt/devkitpro/portlibs/switch/licenses/$pkgname/LICENSE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/configure.ac b/configure.ac
index 79a42bd7..581596fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,6 @@ AC_CONFIG_FILES([
src/Makefile
src/libprojectM/Makefile
src/libprojectM/Renderer/Makefile
- src/libprojectM/NativePresetFactory/Makefile
src/libprojectM/MilkdropPresetFactory/Makefile
src/libprojectM/libprojectM.pc
src/NativePresets/Makefile
diff --git a/src/libprojectM/Makefile.am b/src/libprojectM/Makefile.am
index a7799c8f..4887383c 100644
--- a/src/libprojectM/Makefile.am
+++ b/src/libprojectM/Makefile.am
@@ -1,7 +1,7 @@
EXTRA_DIST=
CLEANFILES=

-SUBDIRS=Renderer NativePresetFactory MilkdropPresetFactory
+SUBDIRS=Renderer MilkdropPresetFactory

AM_CPPFLAGS = \
${my_CFLAGS} \
@@ -16,10 +16,9 @@ lib_LTLIBRARIES = libprojectM.la # public, possibly-shared library
# link flags
libprojectM_la_LDFLAGS = $(CG_LDFLAGS) -no-undefined -version-info 4:1:1

-# link libRenderer, MilkdropPresetFactory, NativePresetFactory, and libprojectM sources
+# link libRenderer, MilkdropPresetFactory, and libprojectM sources
libprojectM_la_LIBADD = \
../libprojectM/MilkdropPresetFactory/libMilkdropPresetFactory.la \
-../libprojectM/NativePresetFactory/libNativePresetFactory.la \
../libprojectM/Renderer/libRenderer.la
libprojectM_la_SOURCES = ConfigFile.cpp Preset.cpp PresetLoader.cpp timer.cpp \
KeyHandler.cpp PresetChooser.cpp TimeKeeper.cpp PCM.cpp PresetFactory.cpp \
171 changes: 171 additions & 0 deletions switch/libprojectM/libprojectm-4befa4516-platform_definitions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
diff --git a/src/libprojectM/Common.hpp b/src/libprojectM/Common.hpp
index 45e248a1..b8841dee 100755
--- a/src/libprojectM/Common.hpp
+++ b/src/libprojectM/Common.hpp
@@ -61,6 +61,10 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
#define STRING_BUFFER_SIZE 1024*150
#define STRING_LINE_SIZE 1024

+#ifdef __SWITCH__
+#include <cstdlib>
+#define projectM_isnan std::isnan
+#endif

#ifdef __unix__
#include <cstdlib>
@@ -80,6 +84,10 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
#define projectM_isnan(x) ((x) != (x))
#endif

+#ifdef __SWITCH__
+#define projectM_fmax fmax
+#endif
+
#ifdef __unix__
#define projectM_fmax fmax
#endif
@@ -92,6 +100,10 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
#define projectM_fmax(x,y) ((x) >= (y) ? (x): (y))
#endif

+#ifdef __SWITCH__
+#define projectM_fmin fmin
+#endif
+
#ifdef __unix__
#define projectM_fmin fmin
#endif
diff --git a/src/libprojectM/PresetLoader.cpp b/src/libprojectM/PresetLoader.cpp
index a685d22c..15b5b694 100644
--- a/src/libprojectM/PresetLoader.cpp
+++ b/src/libprojectM/PresetLoader.cpp
@@ -16,6 +16,13 @@
#include <sstream>
#include <set>

+#ifdef __SWITCH__
+extern "C"
+{
+#include <errno.h>
+}
+#endif
+
#ifdef __unix__
extern "C"
{
diff --git a/src/libprojectM/PresetLoader.hpp b/src/libprojectM/PresetLoader.hpp
index b6ca2782..2eca5346 100644
--- a/src/libprojectM/PresetLoader.hpp
+++ b/src/libprojectM/PresetLoader.hpp
@@ -9,6 +9,10 @@
#include "dirent.h"
#endif

+#ifdef __SWITCH__
+#include <dirent.h>
+#endif
+
#ifdef __unix__
#include <dirent.h>
#endif
diff --git a/src/libprojectM/Renderer/TextureManager.cpp b/src/libprojectM/Renderer/TextureManager.cpp
index 9f4ab41f..4fde0e8e 100644
--- a/src/libprojectM/Renderer/TextureManager.cpp
+++ b/src/libprojectM/Renderer/TextureManager.cpp
@@ -10,6 +10,10 @@
#include "dirent.h"
#endif

+#ifdef __SWITCH__
+#include <dirent.h>
+#endif
+
#ifdef __unix__
#include <dirent.h>
#endif
diff --git a/src/libprojectM/Renderer/hlslparser/src/Engine.cpp b/src/libprojectM/Renderer/hlslparser/src/Engine.cpp
index a7e4f0ed..efe730ed 100755
--- a/src/libprojectM/Renderer/hlslparser/src/Engine.cpp
+++ b/src/libprojectM/Renderer/hlslparser/src/Engine.cpp
@@ -5,6 +5,27 @@
#include <string.h> // strcmp, strcasecmp
#include <stdlib.h> // strtod, strtol

+#ifdef __SWITCH__
+#include <strings.h> // strcasecmp
+#include <stdlib.h>
+
+char *strdup(const char *src)
+{
+ char *str;
+ char *p;
+ int len = 0;
+
+ while (src[len])
+ len++;
+ str = (char *)malloc(len + 1);
+ p = str;
+ while (*src)
+ *p++ = *src++;
+ *p = '\0';
+ return str;
+}
+
+#endif

namespace M4 {

diff --git a/src/libprojectM/Renderer/hlslparser/src/HLSLParser.cpp b/src/libprojectM/Renderer/hlslparser/src/HLSLParser.cpp
index 99bcb313..caf63851 100755
--- a/src/libprojectM/Renderer/hlslparser/src/HLSLParser.cpp
+++ b/src/libprojectM/Renderer/hlslparser/src/HLSLParser.cpp
@@ -24,6 +24,9 @@
#include <malloc.h>
#endif /** WIN32 */

+#ifdef __SWITCH__
+#include <alloca.h>
+#endif

namespace M4
{
diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp
index fcda10c7..0768035f 100755
--- a/src/libprojectM/projectM.cpp
+++ b/src/libprojectM/projectM.cpp
@@ -30,6 +30,10 @@

#include "timer.h"
#include <iostream>
+#ifdef __SWITCH__
+#include "time.h"
+#endif
+
#ifdef __unix__
#include "time.h"
#endif
@@ -179,6 +183,10 @@ void projectM::readConfig (const std::string & configFile )
( "Smooth Preset Duration", config.read<int>("Smooth Transition Duration", 10));
_settings.presetDuration = config.read<int> ( "Preset Duration", 15 );

+#ifdef __SWITCH__
+ _settings.presetURL = config.read<string> ( "Preset Path", "/projectM/presets" );
+#endif
+
#ifdef __unix__
_settings.presetURL = config.read<string> ( "Preset Path", "/usr/local/share/projectM/presets" );
#endif
@@ -199,6 +207,13 @@ void projectM::readConfig (const std::string & configFile )
( "Menu Font", "../Resources/fonts/VeraMono.ttf");
#endif

+#ifdef __SWITCH__
+ _settings.titleFontURL = config.read<string>
+ ( "Title Font", "/projectM/fonts/Vera.tff" );
+ _settings.menuFontURL = config.read<string>
+ ( "Menu Font", "/projectM/fonts/VeraMono.tff" );
+#endif
+
#ifdef __unix__
_settings.titleFontURL = config.read<string>
( "Title Font", "/usr/local/share/projectM/fonts/Vera.tff" );