Skip to content

Commit

Permalink
fix building under newer xcode, fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
twall committed Apr 8, 2013
1 parent 8a5265c commit a676e3a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ OS=$(shell uname | sed -e 's/CYGWIN.*/win32/g' \
-e 's/Linux.*/linux/g')

JNA_JNI_VERSION=3.6.0 # auto-generated by ant
CHECKSUM=9798f03f944a9144703939cb42256762 # auto-generated by ant
CHECKSUM=e1ef1f9431f659b9adfbf981f169c5d5 # auto-generated by ant

JAVA_INCLUDES=-I"$(JAVA_HOME)/include" \
-I"$(JAVA_HOME)/include/$(OS)"
Expand Down Expand Up @@ -279,6 +279,7 @@ endif


ifeq ($(OS),darwin)
XCODE_VERSION=$(shell xcodebuild -version | grep Xcode | sed 's/^Xcode \([1-9]\).*/\1/g')
JAVA_INCLUDES=-I/System/Library/Frameworks/JavaVM.framework/Headers
DEFAULT_ARCH=$(shell arch)
ARCH=$(shell arch)
Expand All @@ -292,15 +293,20 @@ ifneq ($(ARCH),x86_64)
ALT_ARCHS+=x86_64
endif
ifneq ($(ARCH),ppc)
# not supported on XCode 4+
ifeq ($(XCODE_VERSION),3)
ALT_ARCHS+=ppc
endif
endif
LIBSFX=.dylib
JNISFX=.jnilib
ifneq ($(SDKROOT),)
SYSLIBROOT=-Wl,-syslibroot,$(SDKROOT)
ISYSROOT=-isysroot $(SDKROOT)
ARCHFLAGS=-arch i386 -arch x86_64 -arch ppc
#ARCHFLAGS=-arch i386 -arch x86_64
ARCHFLAGS=-arch i386 -arch x86_64
ifeq ($(XCODE_VERSION),3)
ARCHFLAGS+=-arch ppc
endif
endif

PCFLAGS+=$(ISYSROOT) -x objective-c
Expand All @@ -310,6 +316,7 @@ LDFLAGS=$(ARCHFLAGS) -dynamiclib -o $@ -framework JavaVM \
-current_version $(JNA_JNI_VERSION) \
-mmacosx-version-min=10.3 \
-framework Foundation \
-Wl,-no_compact_unwind \
-install_name ${@F} \
$(SYSLIBROOT)
# JAWT linkage handled by -framework JavaVM
Expand Down
2 changes: 2 additions & 0 deletions native/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
#endif

#include <stdlib.h>
// Force XSI-compliant strerror_r (http://unixhelp.ed.ac.uk/CGI/man-cgi?strerror)
#define _XOPEN_SOURCE 600
#include <string.h>
#include <wchar.h>
#include <jni.h>
Expand Down
2 changes: 2 additions & 0 deletions test/com/sun/jna/LastErrorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void testThrowLastError() {
}
catch(LastErrorException e) {
assertEquals("Exception should contain error code", ERROR, e.getErrorCode());
assertTrue("Exception should include error message: " + e.getMessage(), e.getMessage().length() > 10);
}
}

Expand All @@ -102,6 +103,7 @@ public void testThrowLastErrorDirect() {
}
catch(LastErrorException e) {
assertEquals("Exception should contain error code", ERROR, e.getErrorCode());
assertTrue("Exception should include error message: " + e.getMessage(), e.getMessage().length() > 10);
}
}

Expand Down

0 comments on commit a676e3a

Please sign in to comment.