[5148] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
[5204] | 3 | # Creates an josm-setup-xy.exe File
|
---|
[5229] | 4 | #
|
---|
[5148] | 5 | # for working on a debian-unix system install the nsis package with
|
---|
| 6 | # apt-get install nsis
|
---|
[5164] | 7 | # replace the /usr/share/nsis/Plugins/System.dll with the Version from the nsis .zip File
|
---|
[30580] | 8 | # The one coming with the debian package is missing the Call:: Function
|
---|
[5164] | 9 | # See also /usr/share/doc/nsis/README.Debian
|
---|
| 10 | #
|
---|
| 11 | # Then download launch4j from http://launch4j.sourceforge.net/
|
---|
[30580] | 12 | # wget http://softlayer-ams.dl.sourceforge.net/project/launch4j/launch4j-3/3.4/launch4j-3.4-linux.tgz
|
---|
[5164] | 13 | # and unpack it to /usr/share/launch4j
|
---|
[5148] | 14 |
|
---|
| 15 | ## settings ##
|
---|
| 16 |
|
---|
[14191] | 17 | # trying to find launch4j
|
---|
[30580] | 18 | if [ -s "/cygdrive/c/Program Files (x86)/Launch4j/launch4jc.exe" ]; then
|
---|
| 19 | # Windows under cygwin or MobaXterm
|
---|
| 20 | LAUNCH4J="/cygdrive/c/Program Files (x86)/Launch4j/launch4jc.exe"
|
---|
[14191] | 21 | elif [ -s /usr/share/launch4j/launch4j.jar ]; then
|
---|
| 22 | # as described above
|
---|
| 23 | LAUNCH4J="java -jar /usr/share/launch4j/launch4j.jar"
|
---|
[17706] | 24 | elif [ -s ../launch4j/launch4j.jar ]; then
|
---|
| 25 | LAUNCH4J="java -jar ../launch4j/launch4j.jar"
|
---|
[29367] | 26 | elif [ -s $HOME/launch4j/launch4j.jar ]; then
|
---|
| 27 | LAUNCH4J="java -jar $HOME/launch4j/launch4j.jar"
|
---|
[14191] | 28 | else
|
---|
| 29 | # launch4j installed locally under this nsis folder
|
---|
| 30 | LAUNCH4J="java -jar ./launch4j/launch4j.jar"
|
---|
[14189] | 31 | fi
|
---|
[14191] | 32 | echo Using launch4j: $LAUNCH4J
|
---|
[14189] | 33 |
|
---|
[14191] | 34 | # trying to find makensis
|
---|
[30580] | 35 | if [ -s "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" ]; then
|
---|
| 36 | # Windows under cygwin or MobaXterm
|
---|
| 37 | MAKENSIS="/cygdrive/c/Program Files (x86)/NSIS/makensis.exe"
|
---|
[14191] | 38 | else
|
---|
| 39 | # UNIX like
|
---|
[17706] | 40 | MAKENSIS=/usr/bin/makensis
|
---|
[14191] | 41 | fi
|
---|
| 42 | echo Using NSIS: $MAKENSIS
|
---|
[14189] | 43 |
|
---|
[17706] | 44 | if [ -n "$1" ]; then
|
---|
| 45 | export VERSION=$1
|
---|
| 46 | export JOSM_BUILD="no"
|
---|
| 47 | export WEBKIT_DOWNLAD="no"
|
---|
[24927] | 48 | export JOSM_FILE="/home/josm/www/download/josm-tested.jar"
|
---|
[17706] | 49 | else
|
---|
[30580] | 50 | svncorerevision=`svnversion -n ../core`
|
---|
| 51 | #svnpluginsrevision=`svnversion -n ../plugins`
|
---|
| 52 | #svnrevision="$svncorerevision-$svnpluginsrevision"
|
---|
[5148] | 53 |
|
---|
[30580] | 54 | #export VERSION=custom-${svnrevision}
|
---|
| 55 | export VERSION=`echo ${svncorerevision} | sed -e 's/M//g' -e 's/S//g' -e 's/P//g'`
|
---|
[17706] | 56 | export JOSM_BUILD="yes"
|
---|
| 57 | export WEBKIT_DOWNLOAD="yes"
|
---|
[18004] | 58 | export JOSM_FILE="..\core\dist\josm-custom.jar"
|
---|
[17706] | 59 | fi
|
---|
[5157] | 60 |
|
---|
[30616] | 61 | echo "Creating Windows Installer for josm-$VERSION"
|
---|
[5157] | 62 |
|
---|
[14189] | 63 | echo
|
---|
| 64 | echo "##################################################################"
|
---|
| 65 | echo "### Download and unzip the webkit stuff"
|
---|
[17706] | 66 | if [ "x$WEBKIT_DOWNLOAD" == "xyes" ]; then
|
---|
| 67 | wget --continue --timestamping http://josm.openstreetmap.de/download/windows/webkit-image.zip
|
---|
[29984] | 68 | else
|
---|
| 69 | if ! [ -f webkit-image.zip ]; then
|
---|
| 70 | ln -s /home/josm/www/download/windows/webkit-image.zip .
|
---|
| 71 | fi
|
---|
[17706] | 72 | fi
|
---|
[29984] | 73 | #mkdir -p webkit-image
|
---|
| 74 | #cd webkit-image
|
---|
| 75 | unzip -o webkit-image.zip
|
---|
| 76 | #cd ..
|
---|
[14189] | 77 |
|
---|
| 78 | echo
|
---|
| 79 | echo "##################################################################"
|
---|
| 80 | echo "### Build the Complete josm + Plugin Stuff"
|
---|
[17706] | 81 | if [ "x$JOSM_BUILD" == "xyes" ]; then
|
---|
[5149] | 82 | (
|
---|
| 83 | echo "Build the Complete josm Stuff"
|
---|
[5148] | 84 |
|
---|
[5149] | 85 | echo "Compile Josm"
|
---|
| 86 | cd ../core
|
---|
[5156] | 87 | ant -q clean
|
---|
| 88 | ant -q compile || exit -1
|
---|
[5149] | 89 | cd ..
|
---|
| 90 |
|
---|
| 91 | echo "Compile Josm Plugins"
|
---|
| 92 | cd plugins
|
---|
[5156] | 93 | ant -q clean
|
---|
| 94 | ant -q dist || exit -1
|
---|
[5149] | 95 | ) || exit -1
|
---|
[5148] | 96 | fi
|
---|
| 97 |
|
---|
[18004] | 98 | /bin/cp $JOSM_FILE josm-tested.jar
|
---|
[5148] | 99 |
|
---|
[30580] | 100 | function build_exe {
|
---|
[5164] | 101 |
|
---|
[30580] | 102 | export TARGET=$1 # josm / josm64. Used in file name of launcher and installer
|
---|
| 103 |
|
---|
| 104 | /bin/rm -f "launch4j_${TARGET}.xml"
|
---|
| 105 | /bin/sed -e "s/%TARGET%/$1/" -e "s/%RTBITS%/$2/" -e "s/%INIHEAP%/$3/" -e "s/%MAXHEAP%/$4/" -e "s/%VERSION%/$VERSION/" "launch4j.xml" > "launch4j_${TARGET}.xml"
|
---|
| 106 |
|
---|
| 107 | echo
|
---|
| 108 | echo "##################################################################"
|
---|
| 109 | echo "### convert jar to ${TARGET}.exe with launch4j"
|
---|
| 110 | # (an exe file makes attaching to file extensions a lot easier)
|
---|
| 111 | # launch4j - http://launch4j.sourceforge.net/
|
---|
| 112 | # delete old exe file first
|
---|
| 113 | /bin/rm -f ${TARGET}.exe
|
---|
[30616] | 114 | $LAUNCH4J "launch4j_${TARGET}.xml"
|
---|
| 115 | # comment previous line and uncomment next one on Windows
|
---|
| 116 | #"$LAUNCH4J" "launch4j_${TARGET}.xml"
|
---|
[5214] | 117 |
|
---|
[30580] | 118 | if ! [ -s ${TARGET}.exe ]; then
|
---|
| 119 | echo "NO ${TARGET}.exe File Created"
|
---|
| 120 | exit -1
|
---|
| 121 | fi
|
---|
| 122 |
|
---|
| 123 | /bin/rm -f "launch4j_${TARGET}.xml"
|
---|
| 124 |
|
---|
| 125 | echo
|
---|
| 126 | echo "##################################################################"
|
---|
| 127 | echo "### create the ${TARGET}-installer-${VERSION}.exe with makensis"
|
---|
| 128 | # NSIS - http://nsis.sourceforge.net/Main_Page
|
---|
| 129 | # apt-get install nsis
|
---|
| 130 | "$MAKENSIS" -V2 -DVERSION=$VERSION -DDEST=$TARGET josm.nsi
|
---|
| 131 |
|
---|
| 132 | # keep the intermediate file, for debugging
|
---|
| 133 | /bin/rm -f ${TARGET}-intermediate.exe 2>/dev/null >/dev/null
|
---|
| 134 | /bin/mv ${TARGET}.exe ${TARGET}-intermediate.exe 2>/dev/null >/dev/null
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | build_exe "josm" "64\/32" 128 1024
|
---|
[30581] | 138 | # 64-bit binary generation commented until possible with launch4j / nsis
|
---|
| 139 | # build_exe "josm64" "64" 256 2048
|
---|
[30580] | 140 |
|
---|
[18004] | 141 | /bin/rm -f josm-tested.jar 2>/dev/null >/dev/null
|
---|