support building on Cygwin

This commit is contained in:
Joel Dice 2008-10-11 14:46:20 -06:00
parent 54e618847a
commit 1a39012002
2 changed files with 61 additions and 28 deletions

View File

@ -6,10 +6,12 @@ version = 0.1.1
build-arch = $(shell uname -m | sed 's/^i.86$$/i386/')
build-platform = \
$(shell uname -s | tr [:upper:] [:lower:] | sed 's/^mingw32.*$$/windows/')
$(shell uname -s | tr [:upper:] [:lower:] \
| sed 's/^mingw32.*$$/mingw32/' \
| sed 's/^cygwin.*$$/cygwin/')
arch = $(build-arch)
platform = $(build-platform)
platform = $(subst cygwin,windows,$(subst mingw32,windows,$(build-platform)))
ifeq ($(platform),windows)
arch = i386
@ -62,6 +64,8 @@ cflags = $(build-cflags)
common-lflags = -lm -lz
build-lflags =
lflags = $(common-lflags) -lpthread -ldl
system = posix
@ -76,6 +80,8 @@ so-suffix = .so
shared = -shared
native-path = echo
ifeq ($(arch),i386)
object-arch = i386
object-format = elf32-i386
@ -103,20 +109,27 @@ ifeq ($(platform),windows)
so-suffix = .dll
exe-suffix = .exe
ifeq ($(build-platform),windows)
build-cflags = $(common-cflags) \
"-I$(JAVA_HOME)/include/win32" -I$(src) -mthreads
else
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
cflags = $(common-cflags) -I$(inc)
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
cxx = i586-mingw32msvc-g++
cc = i586-mingw32msvc-gcc
dlltool = i586-mingw32msvc-dlltool
ar = i586-mingw32msvc-ar
ranlib = i586-mingw32msvc-ranlib
objcopy = i586-mingw32msvc-objcopy
else
build-cflags = $(common-cflags) \
"-I$(JAVA_HOME)/include/win32" -I$(src) -mthreads
ifeq ($(build-platform),cygwin)
build-lflags += -mno-cygwin
build-cflags += -mno-cygwin
lflags += -mno-cygwin
cflags += -mno-cygwin
native-path = cygpath -m
endif
endif
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
cflags = $(common-cflags) -I$(inc)
endif
ifeq ($(mode),debug)
@ -333,7 +346,7 @@ $(boot-object): $(boot-source)
$(build)/classpath.jar: $(classpath-dep)
(wd=$$(pwd); \
cd $(classpath-build); \
$(jar) c0f "$${wd}/$(@)" $$(find . -name '*.class'))
$(jar) c0f "$$($(native-path) "$${wd}/$(@)")" $$(find . -name '*.class'))
$(binaryToMacho): $(src)/binaryToMacho.cpp
$(cxx) $(^) -o $(@)
@ -392,5 +405,5 @@ $(executable-dynamic): $(driver-dynamic-object) $(dynamic-library)
$(generator): $(generator-objects)
@echo "linking $(@)"
$(build-cc) $(^) -o $(@)
$(build-cc) $(^) $(build-lflags) -o $(@)

View File

@ -11,19 +11,18 @@ on Mac OS X:
$ make
$ build/darwin-i386-compile-fast/avian -cp build/test Hello
on Windows:
Install the current MSYS from the MinGW page (selecting the C and C++
compilers). Follow the post-install options to create the file system
link to the compiler. Upgrade to GNU make 3.81 by downloading the
current release of GNU make from the same download page as the MSYS
download page. Extract the tarball into your MSYS installation
directory. Open the MSYS shell and:
on Windows (MSYS):
$ export JAVA_HOME="C:/Program Files/Java/jdk1.6.0_07"
$ make
$ build/windows-i386-compile-fast/avian -cp build/test Hello
on Windows (Cygwin):
$ export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.6.0_07"
$ make
$ build/windows-i386-compile-fast/avian -cp build/test Hello
Adjust JAVA_HOME according to your system, but be sure to use forward
slashes in the path.
@ -72,15 +71,6 @@ Build requirements include:
Earlier versions of some of these packages may also work but have not
been tested.
If you are cross-compiling for Windows, you may find it useful to use
our win32 repository: (run this from the directory containing the
avian directory)
$ git clone git://oss.readytalk.com/win32.git
This gives you the Windows JNI headers, zlib headers and library, and
a few other useful libraries like OpenSSL and libjpeg.
The build is directed by a single makefile and may be influenced via
certain flags described below.
@ -101,6 +91,33 @@ certain flags described below.
* process - choice between pure interpreter or JIT compiler
default: compile
If you are compiling for Windows, you may either cross-compile using
MinGW or build natively on Windows under MSYS or Cygwin.
Installing MSYS:
1. Download and install the current MinGW and MSYS packages from
mingw.org, selecting the C and C++ compilers when prompted. Use the
post-install script to create the filesystem link to the compiler.
2. Download GNU Make 3.81 from the MSYS download page
(make-3.81-MSYS-1.0.11-2.tar.bz2) and extract the tar file into
e.g. c:/msys/1.0.
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.
You may also find our win32 repository useful: (run this from the
directory containing the avian directory)
$ git clone git://oss.readytalk.com/win32.git
This gives you the Windows JNI headers, zlib headers and library, and
a few other useful libraries like OpenSSL and libjpeg.
Installing
----------
@ -114,6 +131,9 @@ Embedding
The following series of commands illustrates how to produce a
stand-alone executable out of a Java application using Avian.
Note: if you are building on Cygwin, add -mno-cygwin to each of the
compile and link commands below.
Step 1: Build Avian, create a new directory, and populate it with the
VM object files and bootstrap classpath jar.