AppleCommander/build/build-applecommander-mingw

81 lines
2.9 KiB
Plaintext
Raw Normal View History

#!/bin/sh
exec >$0.log 2>&1
APPLECOMMANDER_FILES=$(cd com; \
find . -name "*.java" -not -name "*Test.java" -not -name "ImageIoImage.java" \
-not -name "SunJpegImage.java" -print |
sed 's#^\./#com/#')
OPTS="-static -O3 --no-bounds-checking -funroll-loops -finline-functions \
-fkeep-inline-functions -malign-double"
echo "**********************************************"
echo "** COMPILING **"
echo "**********************************************"
echo
# Need to load image-related stuff... (Should be done in SWT build)
#echo Compiling SWTImageLoaders.java ...
#gcj --classpath="swt.jar;AppleCommander.jar" $OPTS -g0 -c SWTImageLoaders.java
for i in $APPLECOMMANDER_FILES
do
OBJ_FILE=$(echo $i | sed 's/\//_/g' | sed 's/\.java$/\.o/')
echo Compiling $i to $OBJ_FILE
gcj --classpath="swt.jar;AppleCommander.jar" $OPTS -g0 -c -o $OBJ_FILE $i
done
echo "**********************************************"
echo "** RESOURCES **"
echo "**********************************************"
echo
for i in $(ls com/webcodepro/applecommander/ui/images/*.gif \
com/webcodepro/applecommander/storage/*.dump \
com/webcodepro/applecommander/storage/*.properties)
do
FILENAME=$(basename $i)
OBJ=$FILENAME.o
echo Compiling resource $i
gcj -c --resource=$i -o $OBJ $i
done
echo "**********************************************"
echo "** BUILD EXE **"
echo "**********************************************"
echo
gcj -mwindows --classpath="swt.jar;AppleCommander.jar" $OPTS \
--main=com.webcodepro.applecommander.ui.AppleCommander \
-o AppleCommander *.o -L. -lswt
echo "**********************************************"
echo "** CLEAN **"
echo "**********************************************"
echo
rm *.o
echo "**********************************************"
echo "** STRIPPING EXE **"
echo "**********************************************"
echo
strip -x AppleCommander.exe -o AppleCommander-strip.exe
# Only run UPX if it is on the command path:
UPX=$(type -p upx)
if [ "$UPX" ] && [ -x $UPX ]
then
echo "**********************************************"
echo "** PACKING EXE WITH UPX **"
echo "** (will need to choose the smallest exe..) **"
echo "**********************************************"
echo
upx --best --crp-ms=999999 --nrv2b -o AppleCommander-strip-nrv2b.exe AppleCommander-strip.exe
upx --best --crp-ms=999999 --nrv2d -o AppleCommander-strip-nrv2d.exe AppleCommander-strip.exe
upx --best --crp-ms=999999 -o AppleCommander-strip-upxbest.exe AppleCommander-strip.exe
upx -o AppleCommander-strip-upxdefault.exe AppleCommander-strip.exe
fi
echo "**********************************************"
echo "** DONE!! **"
echo "**********************************************"