Merge pull request #1218 from sba1/amiga.2 Libgit2 for AmigaOS4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
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;
}