fix windows cross openjdk-src build

This mainly involves some makefile ugliness to work around bugs in the
native Windows OpenJDK code involving conflicting static and
not-static declarations which GCC 4.0 and later justifiably reject but
MSVC tolerates.
This commit is contained in:
Joel Dice 2010-12-01 20:05:22 -07:00
parent af8e043989
commit 4a3b5ad1ab
4 changed files with 22 additions and 13 deletions

View File

@ -268,18 +268,18 @@ ifeq ($(platform),windows)
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
openjdk-extra-cflags += -I$(src)/openjdk/caseSensitive
cxx = x86_64-w64-mingw32-g++ -m32
cc = x86_64-w64-mingw32-gcc -m32
dlltool = x86_64-w64-mingw32-dlltool -mi386 --as-flags=--32
ar = x86_64-w64-mingw32-ar
ranlib = x86_64-w64-mingw32-ranlib
strip = x86_64-w64-mingw32-strip --strip-all
# cxx = i586-mingw32msvc-g++
# cc = i586-mingw32msvc-gcc
# dlltool = i586-mingw32msvc-dlltool
# ar = i586-mingw32msvc-ar
# ranlib = i586-mingw32msvc-ranlib
# strip = i586-mingw32msvc-strip
# cxx = x86_64-w64-mingw32-g++ -m32
# cc = x86_64-w64-mingw32-gcc -m32
# dlltool = x86_64-w64-mingw32-dlltool -mi386 --as-flags=--32
# ar = x86_64-w64-mingw32-ar
# ranlib = x86_64-w64-mingw32-ranlib
# strip = x86_64-w64-mingw32-strip --strip-all
cxx = i586-mingw32msvc-g++
cc = i586-mingw32msvc-gcc
dlltool = i586-mingw32msvc-dlltool
ar = i586-mingw32msvc-ar
ranlib = i586-mingw32msvc-ranlib
strip = i586-mingw32msvc-strip --strip-all
else
build-system = windows
common-cflags += "-I$(JAVA_HOME)/include/win32"
@ -824,8 +824,10 @@ $(openjdk-objects): $(build)/openjdk/%.o: $(openjdk-src)/%.c \
$(openjdk-headers-dep)
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
sed 's/^static jclass ia_class;//' < $(<) > $(build)/openjdk/$(notdir $(<))
$(cc) -fPIC $(openjdk-extra-cflags) $(openjdk-cflags) \
$(optimization-cflags) -w -c $(<) $(call output,$(@))
$(optimization-cflags) -w -c $(build)/openjdk/$(notdir $(<)) \
$(call output,$(@))
$(openjdk-local-objects): $(build)/openjdk/%.o: $(src)/openjdk/%.c \
$(openjdk-headers-dep)
@ -843,6 +845,9 @@ ifeq ($(platform),windows)
sed 's/^#ifdef _WIN64/#if 1/' \
< "$(openjdk-src)/windows/native/java/net/net_util_md.h" \
> $(build)/openjdk/net_util_md.h
cp "$(openjdk-src)/windows/native/java/net/NetworkInterface.h" \
$(build)/openjdk/NetworkInterface.h
echo 'static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);' >> $(build)/openjdk/NetworkInterface.h
endif
@touch $(@)

View File

@ -221,6 +221,7 @@ ifeq ($(platform),windows)
"-I$(openjdk-src)/windows/native/java/io" \
"-I$(openjdk-src)/windows/native/java/net" \
"-I$(openjdk-src)/windows/native/java/util" \
"-I$(openjdk-src)/windows/native/sun/nio/ch" \
"-I$(openjdk-src)/windows/javavm/include" \
"-I$(root)/win32/include" \
-D_JNI_IMPLEMENTATION_ \

View File

@ -54,6 +54,8 @@
typedef int socklen_t;
# define RTLD_DEFAULT 0
#else // not PLATFORM_WINDOWS
# include <unistd.h>

View File

@ -0,0 +1 @@
#include "ws2tcpip.h"