From 91afb00aa32c3ade14ac016cde0be56c2ca5dab2 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 26 Sep 2014 12:46:46 +0200
Subject: Don't build X11 things on Haiku.


diff --git a/src/cdcontextplus.mak b/src/cdcontextplus.mak
index 469fc28..feeb2dd 100644
--- a/src/cdcontextplus.mak
+++ b/src/cdcontextplus.mak
@@ -13,17 +13,21 @@ ifneq ($(findstring Win, $(TEC_SYSNAME)), )
   LIBS = gdiplus
   CHECK_GDIPLUS = Yes
 else
-  SRC = xrender/cdxrender.c xrender/cdxrplus.c
-
-  LIBS = Xrender Xft
-  USE_X11 = Yes
-  CHECK_XRENDER = Yes
+  ifneq ($(findstring Haiku, $(TEC_SYSNAME)), )
+    INCLUDES = . sim freetype2
+  else
+    SRC = xrender/cdxrender.c xrender/cdxrplus.c
+
+    LIBS = Xrender Xft
+    USE_X11 = Yes
+    CHECK_XRENDER = Yes
   
-  ifdef GTK_DEFAULT
-    CD_SUFFIX := x11
-  endif
+    ifdef GTK_DEFAULT
+      CD_SUFFIX := x11
+    endif
 
-  INCLUDES = . sim freetype2 x11
+    INCLUDES = . sim freetype2 x11
+  endif
 endif
 
 ifneq ($(findstring MacOS, $(TEC_UNAME)), )
diff --git a/src/cdluacontextplus5.mak b/src/cdluacontextplus5.mak
index 9f057a1..6a16096 100644
--- a/src/cdluacontextplus5.mak
+++ b/src/cdluacontextplus5.mak
@@ -12,11 +12,15 @@ ifneq ($(findstring Win, $(TEC_SYSNAME)), )
   CHECK_GDIPLUS = Yes
   LIBS = cdcontextplus
 else
-  ifdef GTK_DEFAULT
-    CHECK_GTK = Yes
-  else
-    CHECK_XRENDER = Yes
+  ifneq ($(findstring Haiku, $(TEC_SYSNAME)), )
     LIBS = cdcontextplus
+  else
+    ifdef GTK_DEFAULT
+      CHECK_GTK = Yes
+    else
+      CHECK_XRENDER = Yes
+      LIBS = cdcontextplus
+    endif
   endif
 endif
 
-- 
1.8.3.4


From cbf7f80553b44d4fb47303d9ac2ab88ed9ad3f90 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 26 Sep 2014 12:46:59 +0200
Subject: Haiku libraries must have a soname.


diff --git a/tecmake.mak b/tecmake.mak
index 14361c1..e9887f9 100644
--- a/tecmake.mak
+++ b/tecmake.mak
@@ -539,6 +539,11 @@ ifneq ($(findstring Linux, $(TEC_UNAME)), )
   endif
 endif
 
+ifneq ($(findstring Haiku, $(TEC_UNAME)), )
+  UNIX_POSIX = Yes
+  STDLDFLAGS := -shared -Wl,-soname=lib$(TARGETNAME).so
+endif
+
 ifneq ($(findstring IRIX, $(TEC_UNAME)), )
   UNIX_POSIX = Yes
   ifndef NO_LOCAL_LD
-- 
1.8.3.4


From 1a1e11538197d839eb964ab0c64a39205461067f Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 26 Sep 2014 12:47:15 +0200
Subject: GCC2 compatibility fix.


diff --git a/src/drv/cdgl.c b/src/drv/cdgl.c
index df2fcc6..65c8d0d 100644
--- a/src/drv/cdgl.c
+++ b/src/drv/cdgl.c
@@ -193,6 +193,9 @@ static void cdglStrConvertToUTF8(cdCtxCanvas *ctxcanvas, const char* str, int le
   }
 #else
   {
+	size_t ulen, utf8len;
+	char* utf8;
+
     if (cdgl_iconv == (iconv_t)-1)
     {
       cdglCheckUtf8Buffer(ctxcanvas, 1);
@@ -200,10 +203,10 @@ static void cdglStrConvertToUTF8(cdCtxCanvas *ctxcanvas, const char* str, int le
       return;
     }
 
-    size_t ulen = (size_t)len;
-    size_t utf8len = ulen*2;
+    ulen = (size_t)len;
+    utf8len = ulen*2;
     cdglCheckUtf8Buffer(ctxcanvas, utf8len);
-    char* utf8 = ctxcanvas->utf8_buffer;
+    utf8 = ctxcanvas->utf8_buffer;
 
     iconv(cdgl_iconv, (char**)&str, &ulen, &utf8, &utf8len);
   }
-- 
1.8.3.4


From 07bc97f916f2beabf6dc11843d36ea5e51d4ceb6 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 26 Sep 2014 13:06:55 +0200
Subject: remove cd_zlib and cd_freetype


diff --git a/src/Makefile b/src/Makefile
index 40c9990..7cc4fdf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -5,7 +5,7 @@ else
 endif
 
 .PHONY: do_all cd_zlib cd_freetype cd_ftgl cd cdx11 cdgdk cd_pdflib cdpdf cdgl cdcontextplus cdcairo cdlua3 cdluapdf3 cdluagl3 cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5 cdluacairo5 cdluaim5
-do_all:        cd_zlib cd_freetype cd_ftgl cd             cd_pdflib cdpdf cdgl cdcontextplus                                   cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5             cdluaim5
+do_all:                            cd_ftgl cd             cd_pdflib cdpdf cdgl cdcontextplus                                   cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5             cdluaim5
 
 cd_zlib:
 	@$(TECMAKE_CMD) MF=cd_zlib
-- 
1.8.3.4

