1 #############################################################################
3 # The XWT upstream code Makefile
6 # deal with Apple's brokenness
7 setcc := CC="$(patsubst Darwin,/usr/bin/gcc3 -no-cpp-precomp,$(findstring Darwin,$(shell uname)))"
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://umn.dl.sourceforge.net/sourceforge/mingw/w32api-2.3.tar.gz
13 url_mingw-runtime-3.0 := http://umn.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
19 # building gcc requires binutils
20 configure_gcc-3.3: install_binutils-2.13.2.1
23 configure_gcc-3.3 := --enable-languages=c,c++,java --enable-gc-type=boehm --disable-shared --disable-jvmpi
24 configure_gcc-3.3 += --disable-java-awt --disable-interpreter --enable-static
25 configure_gcc-3.3 += --with-gnu-ld --with-gnu-as --enable-libgcj
26 configure_gcc-3.3-powerpc-apple := --enable-threads=posix --disable-hash-synchronization
27 configure_gcc-3.3-i686-pc-mingw32 := --enable-threads=win32 --enable-hash-synchronization
28 configure_gcc-3.3-i686-pc-linux-gnu := --enable-threads=posix --enable-hash-synchronization
29 configure_gcc-3.3-sparc-sun-solaris2.7 := --enable-threads=posix --disable-multilib
30 configure_gcc-3.3-mips := --enable-languages=c --nfp --with-newlib=yes --enable-multilib --disable-threads
32 .PRECIOUS: .vendor .download_%_$(target) .configure_%_$(target) .install_%_$(target)
34 # vendor-supplied binaries and headers; this is stuff that comes with various OSes
35 vendor: .vendor; @true
37 @echo -e "\n\033[1mdownloading vendor-supplied headers and libraries...\033[0m"
38 curl http://www.megacz.com/vendor.tgz | tar xzf - -C upstream/install
39 mkdir -p upstream/install/i686-pc-mingw32
40 curl $(url_w32api-2.3) | tar xzf - -C upstream/install/i686-pc-mingw32
41 curl $(url_mingw-runtime-3.0) | tar xzf - -C upstream/install/i686-pc-mingw32
45 @echo -e "\n\033[1mdownloading $*...\033[0m"
47 curl $(url_$*) | tar xzf - -C upstream/$*
48 mv upstream/$*/$* upstream/$*/src; true
49 (test -e upstream/$*/patches && cd upstream/$*/src && for A in ../patches/*.patch; do patch -p0 < $$A; done); true
52 .configure_%_$(target): .download_%
53 @echo -e "\n\033[1mconfiguring $*...\033[0m"
54 mkdir -p upstream/$*/build-$(target)
55 cd upstream/$*/build-$(target); \
56 $(setcc) ../src/configure \
58 --prefix=`pwd`/../../install \
60 $(configure_$*-$(target))
63 .install_%_$(target): .configure_%_$(target)
64 @echo -e "\n\033[1mbuilding $*...\033[0m"
65 cd upstream/$*/build-$(target); $(setcc) PATH=$$PATH:`pwd`/../../install/bin make
66 @echo -e "\n\033[1minstalling $*...\033[0m"
67 cd upstream/$*/build-$(target); $(setcc) PATH=$$PATH:`pwd`/../../install/bin make install
70 .install_freetype-2.1.4_$(target): download_freetype-2.1.4 install_binutils-2.13.2.1 install_gcc-3.3
71 @echo -e "\n\033[1mbuilding freetype $*...\033[0m"
72 cd upstream/freetype-2.1.4/src; make setup ansi; PATH=$$PATH:`pwd`/../install/bin make CC=mips-gcc AR=mips-ar
73 ../install/bin/mips-ranlib freetype-2.1.4/objs/libfreetype.a
76 # jikes has a special target to autodetect a pre-installed jikes, and to autodetect the JVM's $CLASSPATH
78 @echo -e "\n\033[1mdetecting your jikes installation...\033[0m"
79 echo "#!/bin/sh" > .jikes
80 echo 'for A in `find build/class -name \*.class`; do mv $$A $$A.old; done;' >> .jikes
81 echo -n 'PATH=$$PATH:upstream/install/bin/ jikes -classpath lib/libgcj-minimal.jar $$@ -d build/class/ -sourcepath build/java/ ' >> .jikes
82 (type jikes && (jikes --version | grep "Version 1.18")) || make install_jikes-1.18
83 echo -n "$(jikes_flags) -bootclasspath " >> .jikes
84 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java
85 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java
86 javac GetBootClassPath.java
87 java -cp . GetBootClassPath >> .jikes
89 echo 'EXIT=$$?' >> .jikes
90 echo 'for A in `find build/class -name \*.class`; do test -e $$A.old && cmp -s $$A $$A.old && mv $$A.old $$A; done' >> .jikes
91 echo 'for A in `find build/class -name \*.class`; do test -e $$A.old && rm $$A.old; done' >> .jikes
92 echo 'exit $$EXIT' >> .jikes