1 #############################################################################
3 # The XWT upstream code Makefile
6 # upstream packages we need
7 packages := jikes-1.18 binutils-2.13.2.1 newlib-1.11.0 w32api-2.3 mingw-runtime-3.0 freetype-2.1.4 gcc-3.3 jpeg-6b
10 url_newlib-1.11.0 := ftp://sources.redhat.com/pub/newlib/newlib-1.11.0.tar.gz
11 url_binutils-2.13.2.1 := ftp://ftp.gnu.org/gnu/binutils/binutils-2.13.2.1.tar.gz
12 url_w32api-2.3 := http://twtelecom.dl.sourceforge.net/sourceforge/mingw/w32api-2.3.tar.gz
13 url_mingw-runtime-3.0 := http://twtelecom.dl.sourceforge.net/sourceforge/mingw/mingw-runtime-3.0.tar.gz
14 url_freetype-2.1.4 := http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.4.tar.gz
15 url_gcc-3.3 := http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-3.3/gcc-3.3.tar.gz
16 url_jpeg-6b := http://www.ijg.org/files/jpegsrc.v6b.tar.gz
17 url_jikes-1.18 := http://www.megacz.com/tmp/jikes-1.18.tgz #ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.gz
20 configure_gcc-3.3 := --enable-languages=c,c++,java --enable-gc-type=boehm --disable-shared --disable-jvmpi
21 configure_gcc-3.3 += --disable-java-awt --disable-interpreter --enable-static
22 configure_gcc-3.3-powerpc-apple := --enable-threads=posix --disable-hash-synchronization # FIXME: can we enable hashsync?
23 configure_gcc-3.3-i686-pc-mingw32 := --enable-threads=win32 --enable-hash-synchronization
24 configure_gcc-3.3-i686-pc-linux-gnu := --enable-threads=posix --enable-hash-synchronization
25 configure_gcc-3.3-mips := --nfp --with-newlib=yes --enable-multilib --disable-threads
26 configure_gcc-3.3-sparc-sun-solaris2.7 := --enable-threads=posix --disable-multilib
28 # jikes has a special target to autodetect a pre-installed jikes, and to autodetect the JVM's $CLASSPATH
30 echo "jikes " > .jikes
31 (type jikes && (jikes --version | grep "Version 1.18")) || \
32 (make jikes-1.18/src jikes-1.18/.installed && echo -n "upstream/jikes-1.18/install/bin/jikes " > .jikes)
33 echo -n "$(jikes_flags) -bootclasspath " >> .jikes
34 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java
35 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java
36 javac GetBootClassPath.java
37 java -cp . GetBootClassPath >> .jikes
40 # make the package's directory (if it doesn't exist)
44 # if the make target was specified in $(package)-$(target) format, break it apart and recurse
45 $(packages:%=%-$(target)): %-$(target): %
46 make mkdirs $</src $</.installed target=$(patsubst $<-%,%,$@)
48 # download the source code
49 $(packages:%=%/src): %/src: %
50 @echo -e "\ndownloading $<..."
52 @curl $(url_$<) | tar xzf - -C $<
53 (test -e $</patches && cd $</$< && for A in ../patches/*.patch; do patch -p0 < $$A; done); true
56 # configure and build it
57 $(packages:%=%/.installed): %/.installed: %
58 @mkdir -p $</build-$(target) $</install
59 @echo -e "\nconfiguring $<..."
60 cd $</build-$(target); \
61 CC="$(patsubst Darwin,/usr/bin/gcc3 -no-cpp-precomp,$(findstring Darwin,$(host)))" \
62 ../src/configure --prefix=`pwd`/../install $(configure_$<) $(configure_$<-$(target))
63 @echo -e "\nbuilding $<..."
64 @cd $</build-$(target); make
65 @echo -e "\ninstalling $<..."
66 @cd $</build-$(target); make install