From abb858ae43374dc13a5fcef19b9e0ba9442013bb Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <mail@waldemar-brodkorb.de>
Date: Sat, 11 Jan 2014 12:16:39 +0100
Subject: fix libssh compile on Darwin

---
 package/libssh/Makefile                            |  2 +-
 .../patches/patch-cmake_Modules_FindZLIB_cmake     | 29 ++++++++++++++++++++++
 .../libssh/patches/patch-include_libssh_libssh_h   | 10 ++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 package/libssh/patches/patch-cmake_Modules_FindZLIB_cmake
 create mode 100644 package/libssh/patches/patch-include_libssh_libssh_h

diff --git a/package/libssh/Makefile b/package/libssh/Makefile
index 8d7b455fb..997e78895 100644
--- a/package/libssh/Makefile
+++ b/package/libssh/Makefile
@@ -23,7 +23,7 @@ WRKBUILD=               ${WRKDIR}/${PKG_NAME}-obj
 CONFIG_STYLE:=          manual
 
 do-configure:
-	(cd $(WRKBUILD) && PATH='${TARGET_PATH}' \
+	(cd $(WRKBUILD) && PATH='${HOST_PATH}' \
 		cmake -DCMAKE_SYSTEM_NAME=Linux \
 		-DCMAKE_INSTALL_PREFIX=/usr \
 		-DOPENSSL_ROOT_DIR='$(STAGING_TARGET_DIR)/usr' \
diff --git a/package/libssh/patches/patch-cmake_Modules_FindZLIB_cmake b/package/libssh/patches/patch-cmake_Modules_FindZLIB_cmake
new file mode 100644
index 000000000..9a140e652
--- /dev/null
+++ b/package/libssh/patches/patch-cmake_Modules_FindZLIB_cmake
@@ -0,0 +1,29 @@
+--- libssh-0.5.3.orig/cmake/Modules/FindZLIB.cmake	2012-11-20 12:41:49.000000000 +0100
++++ libssh-0.5.3/cmake/Modules/FindZLIB.cmake	2014-01-11 12:11:52.000000000 +0100
+@@ -61,11 +61,11 @@ else (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DI
+         NAMES
+             zlib.h
+         PATHS
++            ${ZLIB_ROOT_DIR}/include
+             /usr/local/include
+             /opt/local/include
+             /sw/include
+             /usr/lib/sfw/include
+-            ${ZLIB_ROOT_DIR}/include
+     )
+     mark_as_advanced(ZLIB_INCLUDE_DIR)
+ 
+@@ -98,12 +98,12 @@ else (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DI
+             zlib
+             zlib1
+         PATHS
++            ${ZLIB_ROOT_DIR}/lib
+             /usr/local/lib
+             /opt/local/lib
+             /sw/lib
+             /usr/sfw/lib/64
+             /usr/sfw/lib
+-            ${ZLIB_ROOT_DIR}/lib
+     )
+     mark_as_advanced(ZLIB_LIBRARY)
+ 
diff --git a/package/libssh/patches/patch-include_libssh_libssh_h b/package/libssh/patches/patch-include_libssh_libssh_h
new file mode 100644
index 000000000..8811f79fb
--- /dev/null
+++ b/package/libssh/patches/patch-include_libssh_libssh_h
@@ -0,0 +1,10 @@
+--- libssh-0.5.3.orig/include/libssh/libssh.h	2012-11-20 12:41:49.000000000 +0100
++++ libssh-0.5.3/include/libssh/libssh.h	2014-01-11 12:04:00.000000000 +0100
+@@ -57,6 +57,7 @@
+   typedef unsigned long long uint64_t;
+   typedef int mode_t;
+ #else /* _MSC_VER */
++  #include <sys/types.h>
+   #include <unistd.h>
+   #include <inttypes.h>
+ #endif /* _MSC_VER */
-- 
cgit v1.2.3