From 5e9e47e0aa86949c07c14a0012180614695ba74b Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 20 Jan 2014 20:59:52 +0100
Subject: Remove hardcoded -lm


diff --git a/src/Makefile b/src/Makefile
index 6ab93a5..6944437 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -113,7 +113,7 @@ OPTIONS = -O3 -Wall
 endif
 
 CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(CONFIG)
-LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
+LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS)
 
 
 SRCS =	main.c		\
-- 
1.8.3.4


From 587046f039a7a29ed96383d9d73b1d605a398701 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 20 Jan 2014 21:07:38 +0100
Subject: Have MirrorMagic looks for files in its own dir.


diff --git a/src/main.c b/src/main.c
index 0e3f90e..7a2cfaa 100644
--- a/src/main.c
+++ b/src/main.c
@@ -620,6 +620,8 @@ int num_element_info = sizeof(element_info)/sizeof(char *);
 
 int main(int argc, char *argv[])
 {
+  chdir(dirname(argv[0]));
+
   InitCommandName(argv[0]);
   InitExitFunction(CloseAllAndExit);
   InitPlatformDependantStuff();
-- 
1.8.3.4


From 78ab3228259485da50b6a78fa66d47ea08ae6f4f Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 20 Jan 2014 21:29:11 +0100
Subject: Fix settings dir.


diff --git a/src/init.c b/src/init.c
index 923da8c..e287635 100644
--- a/src/init.c
+++ b/src/init.c
@@ -23,6 +23,10 @@
 #include "tools.h"
 #include "files.h"
 
+#if __HAIKU__
+#include <storage/FindDirectory.h>
+#endif
+
 static void InitPlayerInfo(void);
 static void InitLevelInfo(void);
 static void InitSound(void);
@@ -33,10 +37,20 @@ static void InitElementProperties(void);
 
 void OpenAll(void)
 {
+#if __HAIKU__
+  char dir[256];
+  find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, dir, sizeof(dir));
+  strcat(dir, "/mirrormagic");
+  InitProgramInfo(dir,
+                  PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
+                  ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
+                  MSDOS_POINTER_FILENAME);
+#else
   InitProgramInfo(UNIX_USERDATA_DIRECTORY,
                   PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
                   ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
                   MSDOS_POINTER_FILENAME);
+#endif
 
   InitPlayerInfo();
 
diff --git a/src/libgame/misc.c b/src/libgame/misc.c
index 7a55d94..a46a298 100644
--- a/src/libgame/misc.c
+++ b/src/libgame/misc.c
@@ -348,7 +348,9 @@ char *getRealName()
 
 char *getHomeDir()
 {
-#if defined(PLATFORM_UNIX)
+#if __HAIKU__
+  return "";
+#elif defined(PLATFORM_UNIX)
   static char *home_dir = NULL;
 
   if (!home_dir)
-- 
1.8.3.4

