diff -urN p7zip_9.20.1/CPP/myWindows/config.h p7zip_9.20.1-haiku/CPP/myWindows/config.h
--- p7zip_9.20.1/CPP/myWindows/config.h	2011-01-21 22:24:42.022806528 -0800
+++ p7zip_9.20.1-haiku/CPP/myWindows/config.h	2012-06-13 23:02:29.589824000 -0700
@@ -24,7 +24,7 @@
 
   #endif /* !ENV_MACOSX && !ENV_BEOS */
 
-  #if !defined(ENV_BEOS)
+  #if !defined(ENV_BEOS) && !defined(ENV_HAIKU)
     #define ENV_HAVE_GETPASS
 
     #if !defined(sun)
diff -urN p7zip_9.20.1/CPP/Windows/System.cpp p7zip_9.20.1-haiku/CPP/Windows/System.cpp
--- p7zip_9.20.1/CPP/Windows/System.cpp	2009-02-15 01:19:45.023330816 -0800
+++ p7zip_9.20.1-haiku/CPP/Windows/System.cpp	2012-06-13 23:06:28.000786432 -0700
@@ -15,7 +15,7 @@
 #include <sys/sysinfo.h>
 #endif
 
-#if defined(ENV_BEOS)
+#if defined(ENV_BEOS) || defined(ENV_HAIKU)
 #include <be/kernel/OS.h>
 #endif
 
@@ -79,7 +79,7 @@
 			if (nbcpu < 1) nbcpu = 1;
 			return nbcpu;
 		}
-		#elif defined(ENV_BEOS)
+		#elif defined(ENV_BEOS) || defined(ENV_HAIKU)
 		UInt32 GetNumberOfProcessors() {
 			system_info info;
 			get_system_info(&info);
diff -urN p7zip_9.20.1/makefile.haiku p7zip_9.20.1-haiku/makefile.haiku
--- p7zip_9.20.1/makefile.haiku	1969-12-31 16:00:00.000000000 -0800
+++ p7zip_9.20.1-haiku/makefile.haiku	2012-06-13 23:09:01.245628928 -0700
@@ -0,0 +1,16 @@
+OPTFLAGS=-O
+
+ALLFLAGS=${OPTFLAGS} -s \
+	-DENV_HAIKU \
+	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
+	-DNDEBUG -D_REENTRANT -DENV_UNIX \
+	$(LOCAL_FLAGS)
+	
+CXX=g++ $(ALLFLAGS)
+CC=gcc $(ALLFLAGS)
+LINK_SHARED=-nostart
+
+LOCAL_LIBS=
+LOCAL_LIBS_DLL=$(LOCAL_LIBS)
+
+OBJ_CRC32=$(OBJ_CRC32_C)
