Skip to content

Commit

Permalink
tweaks for win32-amd64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
twall committed Sep 23, 2012
1 parent f46c5ff commit e91fbd3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
12 changes: 6 additions & 6 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ endif

ifeq ($(OS),win32)
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
CDEFINES=-DHAVE_PROTECTION -DPSAPI_VERSION=1
CDEFINES=-DHAVE_PROTECTION -DPSAPI_VERSION=1 -DFFI_BUILDING
LIBS=-lpsapi
WINDRES=windres
EXTRAOBJS=$(RSRC)
Expand Down Expand Up @@ -184,7 +184,7 @@ WINDRES=$(MINGW_PREFIX)windres

ifeq ($(CC),$(MINGW))
# No SEH under mingw64
CDEFINES=-DPSAPI_VERSION=1
CDEFINES=-DPSAPI_VERSION=1
LD = $(CC)
LDFLAGS=-o $@ -shared
LIBS= -lmingwex -lpsapi -lkernel32 -lmsvcrt
Expand All @@ -197,8 +197,8 @@ LD=$(FFI_SRC)/../ld.sh -m64
COPT=
LIBS=psapi.lib
ARSFX=.lib
FFI_CONFIG+=--host=x86_64-pc-mingw32 && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
FFI_ENV+=LD="$(LD)" CPP="$(CPP)" CFLAGS="$(CDEFINES)"
FFI_CONFIG+=--host=x86_64-w64-mingw32 && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
FFI_ENV+=LD="$(LD)" CPP="$(CPP)"
EXTRAOBJS+=$(DLLCB)
endif
endif
Expand Down Expand Up @@ -239,7 +239,7 @@ ifeq ($(OS),aix)
LIBSFX=.a
PCFLAGS+=-fPIC
CDEFINES+=-DHAVE_PROTECTION -DNO_JAWT -Wall -D_AIX -DPOWERPC_AIX
COPT+=-D_AIX -DPOWERPC_AIX -mxl-compat -g
COPT+=-D_AIX -DPOWERPC_AIX -mxl-compat
LDFLAGS+=-Wl,-lc128,-lc,-lm,-lpthread
FFI_ENV+=AR_FLAGS="-X32_64 cru"
STRIP=echo strip -X32_64
Expand Down Expand Up @@ -358,7 +358,7 @@ $(TESTLIB2): $(BUILD)/testlib2.o
$(LD) $(LDFLAGS) $< $(TESTDEP) $(LIBS)

ifneq ($(DYNAMIC_LIBFFI),true)
$(FFI_LIB):
$(FFI_LIB):
@mkdir -p $(FFI_BUILD)
@if [ ! -f $(FFI_BUILD)/Makefile ]; then \
echo "Configuring libffi ($(ARCH))"; \
Expand Down
12 changes: 6 additions & 6 deletions native/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,13 @@ static void make_key() {
static void
jvm_detach_on_exit(JavaVM* jvm) {
#ifdef _WIN32
TlsSetValue(dwTlsIndex, jvm);
TlsSetValue(dwTlsIndex, (void *)jvm);
#else
static pthread_once_t key_once = PTHREAD_ONCE_INIT;
pthread_once(&key_once, make_key);
if (!jvm || pthread_getspecific(key) == NULL) {
pthread_setspecific(key, jvm);
}
static pthread_once_t key_once = PTHREAD_ONCE_INIT;
pthread_once(&key_once, make_key);
if (!jvm || pthread_getspecific(key) == NULL) {
pthread_setspecific(key, jvm);
}
#endif
}

Expand Down
5 changes: 2 additions & 3 deletions native/cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

nowarn="/wd4127 /wd4820 /wd4706 /wd4100 /wd4255 /wd4668"
args="/nologo /EHac /W3 $nowarn" # /WX
md="/MD"

cl="cl"
ml="ml"
Expand Down Expand Up @@ -176,13 +177,11 @@ do
done

args="$md $args"
echo "Compiling..."
echo "$cl $args (INCLUDE=$INCLUDE LIB=$LIB)"
echo "$cl $args"
eval "$cl $args"
result=$?
# @#!%@!# ml64 broken output
if [ -n "$assembly" ]; then
echo "Currently in $(pwd)"
mv $src $outdir
mv *.obj $target
fi
Expand Down

0 comments on commit e91fbd3

Please sign in to comment.