How to build MIDP 1.0.3 under Windows using Cygwin

Cygwin

Cygwin is a UNIX environment for Windows. It's located at http://sources.redhat.com/cygwin/

When running the setup program, in the 'Select Packages' dialog box, choose to install gcc2, gcc-mingw, make and mingw-runtime under the 'Category' field.

Install JDK 1.3.1

Install JDK 1.3.1 under cygwin's '/usr/local'. For example, if cygwin is install at 'd:/cygwin', install JDK at 'd:/cygwin/usr/local/jdk1.3.1'. This will make cygwin find jdk more easily.

Edit cygwin's '/etc/profile'. Add the following line:
PATH="/usr/local/jdk1.3.1/bin:$PATH"

chmod a+x /usr/local/jdk1.3.1/bin/*
Note: Doing this is for make to be able to determine they are executables.

J2ME MIDP 2.0

MIDP is built on top of CLDC. Therefore, you need to download J2ME CLDC 1.0.4 first from Sun's website at http://java.sun.com/j2me/download.html

In cygwin, unzip j2me_cldc-1_0_4-fcs-src-b30-winunix-13_nov_2002.zip
mv j2me_cldc cldc1.0.4fcs

Download J2ME MIDP 2.0, Windows version

In cygwin, unzip midp-2_0-fcs-src-b45-windows-i686-12_nov_2002.zip
chmod -R u+w midp2.0fcs

Modify build/win32/kvm/makefiles/Defs-pre.gmk, change 'gcc' to 'gcc-2'.
Note: This is because Cygwin's gcc (gcc 3.2) can't handle -mno-cygwin correctly. Therefore, we need to use gcc-2 (gcc 2.95.3) instead.

Modify build/win32/kvm/Platform.gmk:
KVM_DIR = $(BUILD_DIR)/../../../cldc1.0.4fcs

Build J2ME MIDP 2.0

cd midp2.0fcs/build/win32/kvm

make GCC=true ALT_BOOTDIR=/usr/local/jdk1.3.1

The built image is build/win32/kvm/bin/midp.exe