summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-02-09 10:49:55 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-02-09 10:49:55 +0000
commit4a8c6c7a6286b3daeb84df76172d131101b0d830 (patch)
treeabb8c17dc7091cdd549501fc82529de8706a3fcd
parent0b7ee8e3e58895d4c2853e2b3fa1860e1c80277f (diff)
parent8a04eef353354fe738b087ad94221655c3e7bd49 (diff)
downloadtoolchains-4a8c6c7a6286b3daeb84df76172d131101b0d830.tar.gz
toolchains-4a8c6c7a6286b3daeb84df76172d131101b0d830.tar.bz2
Merge branch 'chris/amiga-curl-threaded'
Enable libcurl's threaded DNS resolver for ppc-amigaos target.
-rw-r--r--ppc-amigaos/Makefile3
-rw-r--r--sdk/Makefile2
-rw-r--r--sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p61
-rw-r--r--sdk/recipes/patches/spidermonkey/ppc-amigaos-1.7.0/Makefile.ref.p8
4 files changed, 69 insertions, 5 deletions
diff --git a/ppc-amigaos/Makefile b/ppc-amigaos/Makefile
index fc63730..e7ab849 100644
--- a/ppc-amigaos/Makefile
+++ b/ppc-amigaos/Makefile
@@ -82,10 +82,13 @@ $(BUILDSTEPS)/ndk.d: $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL) $(SOURCESDIR)/$(UPSTR
lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/base.lha
lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/newlib-53.28.lha
lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/clib2-1.205.lha
+ lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/pthread.lha
mkdir -p $(PREFIX)/$(TARGET_NAME)/SDK
cp -r $(BUILDDIR)/ndk/tmp/Include $(PREFIX)/$(TARGET_NAME)/SDK/include
cp -r $(BUILDDIR)/ndk/tmp/newlib $(PREFIX)/$(TARGET_NAME)/SDK/newlib
cp -r $(BUILDDIR)/ndk/tmp/clib2 $(PREFIX)/$(TARGET_NAME)/SDK/clib2
+ cp -r $(BUILDDIR)/ndk/tmp/Local/common/include/* $(PREFIX)/$(TARGET_NAME)/SDK/newlib/include/
+ cp -r $(BUILDDIR)/ndk/tmp/Local/newlib/lib/* $(PREFIX)/$(TARGET_NAME)/SDK/newlib/lib/
cp -r $(SOURCESDIR)/$(UPSTREAM_OPENURL_TARBALL)/include/* $(PREFIX)/$(TARGET_NAME)/SDK/include/include_h/
touch $@
diff --git a/sdk/Makefile b/sdk/Makefile
index 2b1ba8f..cff1247 100644
--- a/sdk/Makefile
+++ b/sdk/Makefile
@@ -114,7 +114,7 @@ endif
ifeq ($(TARGET),ppc-amigaos)
SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d libtre.d libpbl.d spidermonkey.d $(COMMON_SDK_ITEMS))
EXTRAARGS_LIBCARES := --disable-shared
- EXTRAARGS_LIBCURL := --disable-ntlm-wb --without-random
+ EXTRAARGS_LIBCURL := --disable-ntlm-wb --without-random --enable-threaded-resolver LIBS=-lpthread
VERSION_SPIDERMONKEY := 1.7.0
endif
diff --git a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p
new file mode 100644
index 0000000..9a2b590
--- /dev/null
+++ b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p
@@ -0,0 +1,61 @@
+--- lib/hostip4.c 2013-10-23 21:55:34.000000000 +0100
++++ lib/hostip4.c 2014-01-30 10:19:46.900018967 +0000
+@@ -122,6 +122,11 @@ Curl_addrinfo *Curl_getaddrinfo(struct c
+ * implying that only threadsafe code and function calls may be used.
+ *
+ */
++#ifdef __amigaos4__
++#include <proto/exec.h>
++#include <proto/bsdsocket.h>
++#endif
++
+ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
+ int port)
+ {
+@@ -132,6 +137,9 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const
+ struct hostent *h = NULL;
+ struct in_addr in;
+ struct hostent *buf = NULL;
++#ifdef __amigaos4__
++ struct SocketIFace *ISocket = NULL;
++#endif
+
+ if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
+ /* This is a dotted IP address 123.123.123.123-style */
+@@ -294,7 +302,20 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const
+ * gethostbyname() is the preferred one.
+ */
+ else {
++#ifdef __amigaos4__
++ struct Library *SocketBase = IExec->OpenLibrary("bsdsocket.library", 4);
++ if (SocketBase)
++ {
++ ISocket = (struct SocketIFace *)IExec->GetInterface(SocketBase, "main", 1, NULL);
++ }
++
++ if (ISocket)
++ {
++ h = ISocket->gethostbyname((void*)hostname);
++ }
++#else
+ h = gethostbyname((void*)hostname);
++#endif
+ #endif /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */
+ }
+
+@@ -304,7 +325,14 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const
+ if(buf) /* used a *_r() function */
+ free(buf);
+ }
+-
++#ifdef __amigaos4__
++ if (ISocket)
++ {
++ struct Library *SocketBase = ISocket->Data.LibBase;
++ IExec->DropInterface((struct Interface *)ISocket);
++ IExec->CloseLibrary(SocketBase);
++ }
++#endif
+ return ai;
+ }
+ #endif /* defined(CURLRES_IPV4) && !defined(CURLRES_ARES) */
diff --git a/sdk/recipes/patches/spidermonkey/ppc-amigaos-1.7.0/Makefile.ref.p b/sdk/recipes/patches/spidermonkey/ppc-amigaos-1.7.0/Makefile.ref.p
index 9de3033..482907b 100644
--- a/sdk/recipes/patches/spidermonkey/ppc-amigaos-1.7.0/Makefile.ref.p
+++ b/sdk/recipes/patches/spidermonkey/ppc-amigaos-1.7.0/Makefile.ref.p
@@ -428,9 +428,9 @@
+ $(CC) $(CFLAGS) -c $< -o $@
+
+export:
-+ $(MKDIR) $(JS_DIST)/include/js
-+ $(CP) libjs.a $(JS_DIST)/lib
-+ $(CP) *.h $(JS_DIST)/include/js
-+ $(CP) *.tbl $(JS_DIST)/include/js
++ $(MKDIR) -p $(JS_DIST)/include/js
++ $(CP) -f libjs.a $(JS_DIST)/lib
++ $(CP) -f *.h $(JS_DIST)/include/js
++ $(CP) -f *.tbl $(JS_DIST)/include/js
+