From 9f375ee32a8c453386ee463f26604d445fe68dfc Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Tue, 14 Oct 2014 20:22:25 +0200
Subject: Make it build on Haiku again

* Fix installation dir for binaries and docs
* Define UNICODE_SUPPORT
* Fix source dir for docs and manpages

diff --git a/beos/Makefile b/beos/Makefile
index 9e86a3d..7f674ac 100644
--- a/beos/Makefile
+++ b/beos/Makefile
@@ -91,18 +91,18 @@ UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
 INSTALL = install
 # on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
 manext = 1
-prefix = /boot/home/config
-BINDIR = $(prefix)/bin#			where to install executables
-MANDIR = $(prefix)/man/man$(manext)#	where to install man pages
+prefix ?= /boot/home/config
+BINDIR ?= $(prefix)/bin#			where to install executables
+MANDIR ?= $(prefix)/man/	#	where to install man pages
 INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
 	$(BINDIR)/unzip$E
-INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
-	$(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
+INSTALLEDMAN = $(MANDIR)/man1/unzip.$(manext) $(MANDIR)/man1/funzip.$(manext) \
+	$(MANDIR)/man1/unzipsfx.$(manext) $(MANDIR)/man1/zipinfo.$(manext)
 #
 UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
 # this is a little ugly...well, no, it's a lot ugly:
-MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1 man/zipgrep.1
-DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt zipgrep.txt
+MANS = man/man1/unzip.1 man/man1/unzipsfx.1 man/man1/zipinfo.1 man/man1/funzip.1 man/man1/zipgrep.1
+DOCS = docs/unzip.txt docs/unzipsfx.txt docs/zipinfo.txt docs/funzip.txt docs/zipgrep.txt
 
 ######################################################################
 # Things that change:
@@ -371,11 +371,11 @@ install:	all
 	$(LN) unzip$E $(BINDIR)/zipinfo$E
 	$(RM) $(BINDIR)/zipgrep$E
 	$(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
-	$(INSTALL) -m 644 man/unzip.1 $(MANDIR)/unzip.$(manext)
-	$(INSTALL) -m 644 man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
-	$(INSTALL) -m 644 man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
-	$(INSTALL) -m 644 man/funzip.1 $(MANDIR)/funzip.$(manext)
-	$(INSTALL) -m 644 man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
+	$(INSTALL) -m 644 man/man1/unzip.1 $(MANDIR)/man1/unzip.$(manext)
+	$(INSTALL) -m 644 man/man1/unzipsfx.1 $(MANDIR)/man1/unzipsfx.$(manext)
+	$(INSTALL) -m 644 man/man1/zipinfo.1 $(MANDIR)/man1/zipinfo.$(manext)
+	$(INSTALL) -m 644 man/man1/funzip.1 $(MANDIR)/man1/funzip.$(manext)
+	$(INSTALL) -m 644 man/man1/zipgrep.1 $(MANDIR)/man1/zipgrep.$(manext)
 	$(INSTALL) -m 644 $(DOCS) $(MANDIR)
 
 # alternatively, could use zip method:  -cd $(BINDIR); rm -f $(UNZIPS)  [etc.]
diff --git a/beos/beocfg.h b/beos/beocfg.h
index 68584ed..02744c4 100644
--- a/beos/beocfg.h
+++ b/beos/beocfg.h
@@ -68,6 +68,7 @@
 
 /* ISO/OEM (iconv) character conversion. */
 
+#define UNICODE_SUPPORT
 #define ICONV_MAPPING /* part of vanilla Haiku distribution */
 
 #ifdef ICONV_MAPPING
diff --git a/fileio.c b/fileio.c
index 3884ee2..0e17e54 100644
--- a/fileio.c
+++ b/fileio.c
@@ -62,6 +62,7 @@
 #define __FILEIO_C      /* identifies this source module */
 #define UNZIP_INTERNAL
 #include "unzip.h"
+
 #ifdef DLL
 # include "api.h"
 #endif /* def DLL */
-- 
1.8.3.4

