summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-06-09 23:06:32 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-06-09 23:06:32 +0100
commitc3fad0ae3543691926434986840f4adddc70e34d (patch)
tree014f1283d832e516df5d341868f0b0831bd444c2
parent41cbbea8fe0aa56dc33027ba24249f69d831fe03 (diff)
parent7d1983ebc2312c526057ecedd4cef628a4c33974 (diff)
downloadlibgit2-c3fad0ae3543691926434986840f4adddc70e34d.tar.gz
Merge branch 'development' of github.com:chris-y/libgit2 into development
-rw-r--r--CMakeLists.txt2
-rwxr-xr-xREADME.amiga4
-rw-r--r--include/git2/common.h6
-rw-r--r--src/netops.c12
-rw-r--r--src/path.c9
-rw-r--r--src/ppc/sha1ppc.S.objbin0 -> 4471 bytes
6 files changed, 25 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2591fccbf..6e52c74b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1"
SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
# Uncomment out the line below to use PowerPC SHA1
-#SET(SHA1_TYPE "ppc")
+SET(SHA1_TYPE "ppc")
# Find required dependencies
INCLUDE_DIRECTORIES(src include deps/http-parser)
diff --git a/README.amiga b/README.amiga
new file mode 100755
index 000000000..97414dda2
--- /dev/null
+++ b/README.amiga
@@ -0,0 +1,4 @@
+Nasty build hack:
+When setting SHA1 to ppc in CMakeLists.txt, after running initial CMake,
+copy src/ppc/sha1ppc.S.obj to build/CMakeFiles/git2.dir/src/ppc/
+Add CMakeFiles/git2.dir/src/ppc/sha1ppc.S.obj to the list in build/CMakeFiles/git2.dir/link.txt
diff --git a/include/git2/common.h b/include/git2/common.h
index 045ba85c4..99018d4f5 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -56,11 +56,7 @@
#endif
#ifdef __amigaos4__
-/* Network byte order is big-endian... so is PPC, so these functions are NOP */
-#define htonl(x) x
-#define ntohl(x) x
-#define htons(x) x
-#define ntohs(x) x
+#include <netinet/in.h>
#endif
/**
diff --git a/src/netops.c b/src/netops.c
index fdbd965b1..6808c8ee7 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -382,7 +382,9 @@ int gitno_connect(git_transport *t, const char *host, const char *port)
#else
int p;
struct hostent *hent;
+ struct servent *sent;
struct sockaddr_in saddr;
+ long port_num = 0;
#endif
int ret;
GIT_SOCKET s = INVALID_SOCKET;
@@ -397,6 +399,12 @@ int gitno_connect(git_transport *t, const char *host, const char *port)
}
#else
hent = gethostbyname(host);
+ sent = getservbyname(port, 0);
+
+ if(sent)
+ port_num = sent->s_port;
+ else
+ port_num = atol(port);
#endif
#ifndef __amigaos4__
@@ -413,9 +421,9 @@ int gitno_connect(git_transport *t, const char *host, const char *port)
#ifndef __amigaos4__
if (connect(s, p->ai_addr, (socklen_t)p->ai_addrlen) == 0)
#else
- saddr.sin_addr.s_addr = *hent->h_addr_list[p];
+ memcpy(&saddr.sin_addr, hent->h_addr_list[p], hent->h_length);
saddr.sin_family = hent->h_addrtype;
- saddr.sin_port = port;
+ saddr.sin_port = port_num;
if (connect(s, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)) == 0)
#endif
break;
diff --git a/src/path.c b/src/path.c
index 056b6b910..eb9bc06f3 100644
--- a/src/path.c
+++ b/src/path.c
@@ -482,9 +482,14 @@ int git_path_cmp(
/* Taken from git.git */
GIT_INLINE(int) is_dot_or_dotdot(const char *name)
{
+#ifdef __amigaos4__
+ /* This is irrelevant on AmigaOS */
+ return 0;
+#else
return (name[0] == '.' &&
(name[1] == '\0' ||
(name[1] == '.' && name[2] == '\0')));
+#endif
}
int git_path_direach(
@@ -512,7 +517,11 @@ int git_path_direach(
de_buf = git__malloc(sizeof(struct dirent));
#endif
+#ifdef __amigaos4__
+ while (de = readdir(dir)) {
+#else
while (p_readdir_r(dir, de_buf, de) == 0 && de != NULL) {
+#endif
int result;
if (is_dot_or_dotdot(de->d_name))
diff --git a/src/ppc/sha1ppc.S.obj b/src/ppc/sha1ppc.S.obj
new file mode 100644
index 000000000..a7dad600f
--- /dev/null
+++ b/src/ppc/sha1ppc.S.obj
Binary files differ