From fb47040266da2f0e74cc36cdf407afe2d8fa6ee8 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Thu, 18 Dec 2014 23:45:35 +0000
Subject: [PATCH 1/3] Fix network detection

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

diff --git a/configure.ac b/configure.ac
index 641dd17..e06cb74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -491,8 +491,12 @@ fi
 
 # Build cacaserver?
 ac_cv_my_have_network="no"
-AC_CHECK_HEADERS(sys/socket.h,
- [ac_cv_my_have_network="yes"])
+AC_CHECK_HEADERS(sys/socket.h, [
+  # On Haiku the socket() function and friends are in libnetwork
+  AC_SEARCH_LIBS([socket], [network], [
+    ac_cv_my_have_network="yes"
+  ])
+])
 AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
 
 # Use Imlib2?
-- 
1.8.3.4


From b4a3afb4b37257e6f18aa31511df9615ea39418e Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Fri, 19 Dec 2014 02:19:19 +0000
Subject: [PATCH 2/3] doc: use standard PDF and HTML installation directories

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 5598ce3..77720e7 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -7,11 +7,9 @@ doxygen_DOX = libcaca.dox user.dox migrating.dox tutorial.dox canvas.dox font.do
 man_MANS = caca-config.1 cacafire.1 cacaview.1 cacaserver.1 img2txt.1 cacaplay.1
 
 if BUILD_DOCUMENTATION
-htmldoc_DATA = html/doxygen.css
-htmldocdir = $(datadir)/doc/libcaca-dev/html
+html_DATA = html/doxygen.css
 if USE_LATEX
-pdfdoc_DATA = latex/libcaca.pdf
-pdfdocdir = $(datadir)/doc/libcaca-dev/pdf
+pdf_DATA = latex/libcaca.pdf
 endif
 endif
 
@@ -42,10 +40,10 @@ clean-local:
 
 install-data-local:
 if BUILD_DOCUMENTATION
-	mkdir -p $(DESTDIR)$(datadir)/doc
-	$(mkinstalldirs) $(DESTDIR)$(datadir)/doc/libcaca-dev/html
+	mkdir -p $(DESTDIR)$(htmldir)
+	$(mkinstalldirs) $(DESTDIR)$(htmldir)
 	cp `find html -name '*.html' -o -name '*.gif' -o -name '*.png'` \
-	  $(DESTDIR)$(datadir)/doc/libcaca-dev/html
+	  $(DESTDIR)$(htmldir)
 	$(mkinstalldirs) $(DESTDIR)$(mandir)/man3
 	for man in $$(find man -name '*.3caca'); do \
 	  sed -e 's/man3caca/man3/g' -e "s/fC'\([a-zA-Z0-9]*\)'/fC\"\1\"/g" \
-- 
1.8.3.4


From 28016da0b3e6c2d001455bb49b0b24fde3e9edc5 Mon Sep 17 00:00:00 2001
From: Scott McCreary <scottmc2@gmail.com>
Date: Thu, 18 Dec 2014 22:46:50 -0800
Subject: [PATCH 3/3] Fix gcc2 issues in 3 files

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

diff --git a/caca/file.c b/caca/file.c
index 27e4e83..51e127b 100644
--- a/caca/file.c
+++ b/caca/file.c
@@ -63,6 +63,10 @@ struct caca_file
  */
 caca_file_t *caca_file_open(char const *path, const char *mode)
 {
+#   if defined HAVE_ZLIB_H
+    uint8_t buf[4];
+    unsigned int skip_size = 0;
+#endif
 #if defined __KERNEL__
     seterrno(ENOSYS);
     return NULL;
@@ -72,8 +76,6 @@ caca_file_t *caca_file_open(char const *path, const char *mode)
     fp->readonly = !!strchr(mode, 'r');
 
 #   if defined HAVE_ZLIB_H
-    uint8_t buf[4];
-    unsigned int skip_size = 0;
 
     fp->gz = gzopen(path, fp->readonly ? "rb" : "wb");
     if(!fp->gz)
diff --git a/examples/trifiller.c b/examples/trifiller.c
index 5a06f23..fab3cd7 100644
--- a/examples/trifiller.c
+++ b/examples/trifiller.c
@@ -45,6 +45,7 @@ int main(int argc, char *argv[])
     int quit = 0;
     int update = 1;
     int px, py;
+    int p;
     float angle = 0;
 
 
@@ -198,7 +199,6 @@ int main(int argc, char *argv[])
 
 
         /* 2D Rotation around screen center */
-        int p;
         for (p = 0; p < 4; p++)
         {
             rotated[p][0] =
diff --git a/src/cacaclock.c b/src/cacaclock.c
index 3a405ea..63b35af 100644
--- a/src/cacaclock.c
+++ b/src/cacaclock.c
@@ -67,6 +67,10 @@ int main(int argc, char *argv[]) {
     caca_canvas_t *figcv;
     caca_display_t *dp;
     uint32_t w, h, fw, fh;
+    char *d;
+    uint32_t o;
+    uint32_t x;
+    uint32_t y;
 
     char *format = "%R:%S";
     char *font   = "/usr/share/figlet/mono12.tlf";
@@ -143,8 +147,8 @@ int main(int argc, char *argv[]) {
             if(caca_get_event_type(&ev))
                 goto end;
         }
-        char *d = get_date(format);
-        uint32_t o = 0;
+        d = get_date(format);
+        o = 0;
 
         // figfont API is not complete, and does not allow us to put a string
         // at another position than 0,0
@@ -164,8 +168,8 @@ int main(int argc, char *argv[]) {
         fw = caca_get_canvas_width (figcv);
         fh = caca_get_canvas_height(figcv);
 
-        uint32_t x = (w/2) - (fw/2);
-        uint32_t y = (h/2) - (fh/2);
+        x = (w/2) - (fw/2);
+        y = (h/2) - (fh/2);
 
         caca_blit(cv, x, y, figcv, NULL);
         caca_refresh_display(dp);
-- 
1.8.3.4

