fix Cygwin 1.7.x build

Recent versions of Cygwin's GCC no longer support the -mno-cygwin flag
(compilation works, but linking fails).  However, Cygwin now includes
mingw64-i686-gcc, mingw64-x86_64-gcc, and related packages, so we use
those compilers instead.  This has the added benefit that we can build
native x86_64 binaries on Cygwin now.

This will break the build for old Cygwin installs, so it will be
necessary to upgrade Cygwin and install the aforementioned packages to
build Avian going forward.
This commit is contained in:
Joel Dice 2011-07-12 22:58:51 +00:00
parent c3fa08c430
commit a2dca0dc62
3 changed files with 28 additions and 15 deletions

36
makefile Normal file → Executable file
View File

@ -94,12 +94,12 @@ ifneq ($(openjdk),)
lib/security/java.policy lib/security/cacerts
local-policy = lib/security/local_policy.jar
ifeq ($(shell test -e $(openjdk)/$(local-policy) && echo found),found)
ifeq ($(shell test -e "$(openjdk)/$(local-policy)" && echo found),found)
javahome-files += $(local-policy)
endif
export-policy = lib/security/US_export_policy.jar
ifeq ($(shell test -e $(openjdk)/$(export-policy) && echo found),found)
ifeq ($(shell test -e "$(openjdk)/$(export-policy)" && echo found),found)
javahome-files += $(export-policy)
endif
@ -181,7 +181,8 @@ endif
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
converter-cflags = -D__STDC_CONSTANT_MACROS -Isrc/binaryToObject
converter-cflags = -D__STDC_CONSTANT_MACROS -Isrc/binaryToObject \
-fno-rtti -fno-exceptions
cflags = $(build-cflags)
@ -333,15 +334,20 @@ ifeq ($(platform),windows)
openjdk-extra-cflags =
build-lflags = -L$(lib) $(common-lflags)
ifeq ($(build-platform),cygwin)
build-lflags += -mno-cygwin
build-cflags += -mno-cygwin
openjdk-extra-cflags += -mno-cygwin
lflags += -mno-cygwin
cflags += -mno-cygwin
build-cxx = i686-w64-mingw32-g++
build-cc = i686-w64-mingw32-gcc
dlltool = i686-w64-mingw32-dlltool
ar = i686-w64-mingw32-ar
ranlib = i686-w64-mingw32-ranlib
strip = i686-w64-mingw32-strip
endif
endif
ifeq ($(arch),x86_64)
ifeq ($(build-platform),cygwin)
build-cxx = x86_64-w64-mingw32-g++
build-cc = x86_64-w64-mingw32-gcc
endif
cxx = x86_64-w64-mingw32-g++ $(mflag)
cc = x86_64-w64-mingw32-gcc $(mflag)
dlltool = x86_64-w64-mingw32-dlltool
@ -758,7 +764,7 @@ $(boot-javahome-object): $(src)/boot-javahome.cpp
$(compile-object)
$(build)/binaryToObject-main.o: $(src)/binaryToObject/main.cpp
$(build-cxx) -c $(^) -o $(@)
$(build-cxx) $(converter-cflags) -c $(^) -o $(@)
$(build)/binaryToObject-elf64.o: $(src)/binaryToObject/elf.cpp
$(build-cxx) $(converter-cflags) -DBITS_PER_WORD=64 -c $(^) -o $(@)
@ -776,7 +782,7 @@ $(build)/binaryToObject-pe.o: $(src)/binaryToObject/pe.cpp
$(build-cxx) $(converter-cflags) -c $(^) -o $(@)
$(converter): $(converter-objects)
$(build-cxx) $(^) -o $(@)
$(build-cc) $(^) -o $(@)
$(build)/classpath.jar: $(classpath-dep) $(classpath-jar-dep)
@echo "creating $(@)"
@ -930,8 +936,14 @@ 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
sed \
-e 's/IpPrefix/hide_IpPrefix/' \
-e 's/IpSuffix/hide_IpSuffix/' \
-e 's/IpDad/hide_IpDad/' \
-e 's/ScopeLevel/hide_ScopeLevel/' \
-e 's/SCOPE_LEVEL/hide_SCOPE_LEVEL/' \
< "$(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

@ -184,6 +184,7 @@ ifeq ($(platform),windows)
$(openjdk-src)/windows/native/java/lang/ProcessEnvironment_md.c \
$(openjdk-src)/windows/native/java/lang/ProcessImpl_md.c \
$(openjdk-src)/windows/native/java/net/net_util_md.c \
$(openjdk-src)/windows/native/java/net/DualStackPlainSocketImpl.c \
$(openjdk-src)/windows/native/java/net/InetAddressImplFactory.c \
$(openjdk-src)/windows/native/java/net/Inet4AddressImpl.c \
$(openjdk-src)/windows/native/java/net/Inet6AddressImpl.c \
@ -210,6 +211,7 @@ ifeq ($(platform),windows)
$(openjdk-src)/windows/native/sun/security/provider/WinCAPISeedGenerator.c
openjdk-headers-classes += \
java.net.DualStackPlainSocketImpl \
java.lang.ProcessImpl \
sun.io.Win32ErrorMode \
sun.nio.ch.WindowsSelectorImpl \
@ -225,7 +227,6 @@ ifeq ($(platform),windows)
"-I$(root)/win32/include" \
-D_JNI_IMPLEMENTATION_ \
-D_JAVASOFT_WIN32_TYPEDEF_MD_H_ \
-D_WINSOCK2API_ \
-Ds6_words=_s6_words \
-Ds6_bytes=_s6_bytes
else

View File

@ -162,8 +162,8 @@ Installing MSYS:
Installing Cygwin:
1. Download and run setup.exe from cygwin.com, installing the base
system and these packages: make, gcc-mingw-g++, and (optionally)
git.
system and these packages: make, gcc-mingw-g++,
mingw64-i686-gcc-g++, mingw64-x86_64-gcc-g++, and (optionally) git.
You may also find our win32 repository useful: (run this from the
directory containing the avian directory)