From 36d51bab16cb2b30092aadf0721fe334bdda8021 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 12 Oct 2019 14:16:38 +0200
Subject: Fix build, install paths


diff --git a/external/glaserl/glaserl_gl.h b/external/glaserl/glaserl_gl.h
index 36546e0..0b3d70c 100644
--- a/external/glaserl/glaserl_gl.h
+++ b/external/glaserl/glaserl_gl.h
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 
-#if defined(USE_OPENGL_ES)
+#if defined(USE_OPENGL_ES) && !defined(__HAIKU__)
 #    include <GLES2/gl2.h>
 #    define GLASERL_GLSL_PRECISION_INFO "precision mediump float;\n"
 #elif defined(__APPLE__)
diff --git a/mk/install.mk b/mk/install.mk
index f713ea8..dac9046 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -3,7 +3,7 @@ PREFIX ?= /usr
 
 install: $(APP) $(ADDITIONAL_INSTALL_TARGETS)
 	install -D -m 755 $(APP) $(DESTDIR)/$(PREFIX)/bin/$(APP)
-	mkdir -p $(DESTDIR)/$(PREFIX)/share/$(APP)
-	cp -rpv data $(DESTDIR)/$(PREFIX)/share/$(APP)/
+	mkdir -p $(DESTDIR)/$(PREFIX)/data/$(APP)
+	cp -rpv data/* $(DESTDIR)/$(PREFIX)/data/$(APP)/
 
 .PHONY: install
diff --git a/platform/sdl1/platform.in b/platform/sdl1/platform.in
index 4bf22dc..e7f0eea 100644
--- a/platform/sdl1/platform.in
+++ b/platform/sdl1/platform.in
@@ -1,6 +1,8 @@
 # Platform build definition for SDL1
 # Will be processed by makefile
 
+LIBS += -lGL -lSDL -lSDL_image -lSDL_ttf
+
 add_platform(gl)
 add_platform(sdlstb)
 
diff --git a/platform/sdlstb/OsSDLSTB.h b/platform/sdlstb/OsSDLSTB.h
index f701e26..92878a1 100644
--- a/platform/sdlstb/OsSDLSTB.h
+++ b/platform/sdlstb/OsSDLSTB.h
@@ -19,7 +19,7 @@
 
 #include "SDLSTBRenderer.h"
 
-#include "SDL.h"
+#include "SDL/SDL.h"
 
 
 static int mapSDLKeyToNumptyKey(int key)
diff --git a/platform/sdlstb/SDLSTBRenderer.h b/platform/sdlstb/SDLSTBRenderer.h
index 830126b..cd197ac 100644
--- a/platform/sdlstb/SDLSTBRenderer.h
+++ b/platform/sdlstb/SDLSTBRenderer.h
@@ -22,7 +22,7 @@
 #include "Renderer.h"
 #include "GLRenderer.h"
 
-#include <SDL.h>
+#include <SDL/SDL.h>
 
 class SDLSTBRenderer : public GLRenderer {
 public:
-- 
2.26.0


From 3d2e7426a4e09b4e970e7659120b1e1a79b24a2e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 7 Jun 2020 16:47:33 +1000
Subject: Use realpath for argv[0]


diff --git a/platform/sdl1/OsSDL1.cpp b/platform/sdl1/OsSDL1.cpp
index 654e74b..1c5928d 100644
--- a/platform/sdl1/OsSDL1.cpp
+++ b/platform/sdl1/OsSDL1.cpp
@@ -40,6 +40,11 @@ public:
 
 int main(int argc, char** argv)
 {
+#ifdef __HAIKU__
+	char *binpath = realpath(argv[0], NULL);
+	if (binpath != NULL)
+		argv[0] = binpath;
+#endif
     std::shared_ptr<Os> os(new OsSDL1());
 
     std::shared_ptr<MainLoop> mainloop(npmain(argc, argv));
-- 
2.26.0


From 4b440f10516524be4f7967d11440dd5fe98d2921 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 7 Jun 2020 17:01:30 +1000
Subject: Fix settings dir


diff --git a/platform/sdl1/OsSDL1.cpp b/platform/sdl1/OsSDL1.cpp
index 1c5928d..3fb7864 100644
--- a/platform/sdl1/OsSDL1.cpp
+++ b/platform/sdl1/OsSDL1.cpp
@@ -34,7 +34,11 @@ public:
 
     virtual std::string userDataDir()
     {
+#ifdef __HAIKU__
+        return "config/settings/numptyphysics";
+#else
         return ".numptyphysics-data-sdl1";
+#endif
     }
 };
 
-- 
2.26.0

