Commit 3f31ce8d9526cadc88270dad7effeb304a38d5ea

Vicent Martí 2013-01-10T08:13:02

Merge pull request #1218 from sba1/amiga.2 Libgit2 for AmigaOS4

diff --git a/.gitignore b/.gitignore
index 0289813..949baec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
 .lock-wafbuild
 .waf*
 build/
+build-amiga/
 tests/tmp/
 msvc/Debug/
 msvc/Release/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 87c0b35..47533a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,7 +88,9 @@ INCLUDE_DIRECTORIES(src include)
 IF (WIN32 AND NOT MINGW)
 	ADD_DEFINITIONS(-DGIT_WINHTTP)
 ELSE ()
-	FIND_PACKAGE(OpenSSL)
+	IF (NOT AMIGA)
+		FIND_PACKAGE(OpenSSL)
+	ENDIF ()
 	FILE(GLOB SRC_HTTP deps/http-parser/*.c)
 	INCLUDE_DIRECTORIES(deps/http-parser)
 ENDIF()
@@ -104,7 +106,7 @@ ELSE()
 ENDIF()
 
 # Include POSIX regex when it is required
-IF(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "AmigaOS")
+IF(WIN32 OR AMIGA)
 	INCLUDE_DIRECTORIES(deps/regex)
 	SET(SRC_REGEX deps/regex/regex.c)
 ENDIF()
@@ -144,7 +146,7 @@ ELSE ()
 	SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -Wall -Wextra -Wno-missing-field-initializers -Wstrict-aliasing=2 -Wstrict-prototypes ${CMAKE_C_FLAGS}")
 	IF (MINGW) # MinGW always does PIC and complains if we tell it to
 		STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
-	ELSE ()
+	ELSEIF (BUILD_SHARED_LIBS)
 		SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fPIC")
 	ENDIF ()
 	IF (APPLE) # Apple deprecated OpenSSL
diff --git a/src/amiga/map.c b/src/amiga/map.c
index 513e2f4..0ba7995 100644
--- a/src/amiga/map.c
+++ b/src/amiga/map.c
@@ -27,7 +27,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
 	out->data = malloc(len);
 	GITERR_CHECK_ALLOC(out->data);
 
-	if (p_lseek(fd, offset, SEEK_SET) < 0 || p_read(fd, out->data, len) != len)
+	if ((p_lseek(fd, offset, SEEK_SET) < 0) || ((size_t)p_read(fd, out->data, len) != len)) {
 		giterr_set(GITERR_OS, "mmap emulation failed");
 		return -1;
 	}