[7838] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # Creates an josm-setup-xy.exe File
|
---|
| 4 | #
|
---|
| 5 | # for working on a debian-unix system install the nsis package with
|
---|
| 6 | # apt-get install nsis
|
---|
| 7 | # replace the /usr/share/nsis/Plugins/System.dll with the Version from the nsis .zip File
|
---|
| 8 | # The one coming with the debian package is missing the Call:: Function
|
---|
| 9 | # See also /usr/share/doc/nsis/README.Debian
|
---|
| 10 | #
|
---|
| 11 | # Then download launch4j from http://launch4j.sourceforge.net/
|
---|
[7839] | 12 | # wget http://softlayer-ams.dl.sourceforge.net/project/launch4j/launch4j-3/3.5/launch4j-3.5-linux.tgz
|
---|
[7838] | 13 | # and unpack it to /usr/share/launch4j
|
---|
[7844] | 14 | #
|
---|
| 15 | # On Debian/Ubuntu 64bits, follow then this procedure
|
---|
| 16 | # http://sourceforge.net/p/launch4j/feature-requests/74/#2051
|
---|
| 17 | # if you get this error: launch4j: net.sf.launch4j.ExecException: java.io.IOException:
|
---|
| 18 | # Cannot run program "/usr/share/launch4j/bin/windres": error=2, No such file or directory
|
---|
[7838] | 19 |
|
---|
| 20 | ## settings ##
|
---|
| 21 |
|
---|
| 22 | # trying to find launch4j
|
---|
| 23 | if [ -s "/cygdrive/c/Program Files (x86)/Launch4j/launch4jc.exe" ]; then
|
---|
| 24 | # Windows under cygwin or MobaXterm
|
---|
| 25 | LAUNCH4J="/cygdrive/c/Program Files (x86)/Launch4j/launch4jc.exe"
|
---|
| 26 | elif [ -s /usr/share/launch4j/launch4j.jar ]; then
|
---|
| 27 | # as described above
|
---|
| 28 | LAUNCH4J="java -jar /usr/share/launch4j/launch4j.jar"
|
---|
| 29 | elif [ -s ../launch4j/launch4j.jar ]; then
|
---|
| 30 | LAUNCH4J="java -jar ../launch4j/launch4j.jar"
|
---|
| 31 | elif [ -s $HOME/launch4j/launch4j.jar ]; then
|
---|
| 32 | LAUNCH4J="java -jar $HOME/launch4j/launch4j.jar"
|
---|
| 33 | else
|
---|
| 34 | # launch4j installed locally under this nsis folder
|
---|
| 35 | LAUNCH4J="java -jar ./launch4j/launch4j.jar"
|
---|
| 36 | fi
|
---|
| 37 | echo Using launch4j: $LAUNCH4J
|
---|
| 38 |
|
---|
| 39 | # trying to find makensis
|
---|
| 40 | if [ -s "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" ]; then
|
---|
| 41 | # Windows under cygwin or MobaXterm
|
---|
| 42 | MAKENSIS="/cygdrive/c/Program Files (x86)/NSIS/makensis.exe"
|
---|
| 43 | else
|
---|
| 44 | # UNIX like
|
---|
| 45 | MAKENSIS=/usr/bin/makensis
|
---|
| 46 | fi
|
---|
| 47 | echo Using NSIS: $MAKENSIS
|
---|
| 48 |
|
---|
[7839] | 49 | if [ -n "$2" ]; then
|
---|
| 50 | # 2 arguments: for Ant build.xml and Jenkins CI
|
---|
[7838] | 51 | export VERSION=$1
|
---|
| 52 | export JOSM_BUILD="no"
|
---|
[7839] | 53 | export JOSM_FILE=$2
|
---|
| 54 | elif [ -n "$1" ]; then
|
---|
| 55 | # 1 argument: for official JOSM server
|
---|
| 56 | export VERSION=$1
|
---|
| 57 | export JOSM_BUILD="no"
|
---|
[7838] | 58 | export JOSM_FILE="/home/josm/www/download/josm-tested.jar"
|
---|
| 59 | else
|
---|
[7839] | 60 | # no argument: for everyone else
|
---|
[16239] | 61 | svncorerevision=`svnversion -n ../..`
|
---|
| 62 | #svnpluginsrevision=`svnversion -n ../../../plugins`
|
---|
[7838] | 63 | #svnrevision="$svncorerevision-$svnpluginsrevision"
|
---|
| 64 |
|
---|
| 65 | #export VERSION=custom-${svnrevision}
|
---|
| 66 | export VERSION=`echo ${svncorerevision} | sed -e 's/M//g' -e 's/S//g' -e 's/P//g'`
|
---|
| 67 | export JOSM_BUILD="yes"
|
---|
[16239] | 68 | export JOSM_FILE="..\..\dist\josm-custom.jar"
|
---|
[7838] | 69 | fi
|
---|
| 70 |
|
---|
| 71 | echo "Creating Windows Installer for josm-$VERSION"
|
---|
| 72 |
|
---|
| 73 | echo
|
---|
| 74 | echo "##################################################################"
|
---|
| 75 | echo "### Build the Complete josm + Plugin Stuff"
|
---|
| 76 | if [ "x$JOSM_BUILD" == "xyes" ]; then
|
---|
| 77 | (
|
---|
| 78 | echo "Build the Complete josm Stuff"
|
---|
[16239] | 79 |
|
---|
[7838] | 80 | echo "Compile Josm"
|
---|
[16239] | 81 | cd ../..
|
---|
[7838] | 82 | ant -q clean
|
---|
| 83 | ant -q compile || exit -1
|
---|
| 84 | cd ..
|
---|
[16239] | 85 |
|
---|
[7838] | 86 | echo "Compile Josm Plugins"
|
---|
| 87 | cd plugins
|
---|
| 88 | ant -q clean
|
---|
| 89 | ant -q dist || exit -1
|
---|
| 90 | ) || exit -1
|
---|
| 91 | fi
|
---|
| 92 |
|
---|
| 93 | /bin/cp $JOSM_FILE josm-tested.jar
|
---|
| 94 |
|
---|
| 95 | function build_exe {
|
---|
| 96 |
|
---|
| 97 | export TARGET=$1 # josm / josm64. Used in file name of launcher and installer
|
---|
| 98 |
|
---|
| 99 | /bin/rm -f "launch4j_${TARGET}.xml"
|
---|
| 100 | /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"
|
---|
| 101 |
|
---|
| 102 | echo
|
---|
| 103 | echo "##################################################################"
|
---|
| 104 | echo "### convert jar to ${TARGET}.exe with launch4j"
|
---|
| 105 | # (an exe file makes attaching to file extensions a lot easier)
|
---|
| 106 | # launch4j - http://launch4j.sourceforge.net/
|
---|
| 107 | # delete old exe file first
|
---|
[7853] | 108 | /bin/rm -f ${TARGET}*.exe
|
---|
[7838] | 109 | $LAUNCH4J "launch4j_${TARGET}.xml"
|
---|
| 110 | # comment previous line and uncomment next one on Windows
|
---|
| 111 | #"$LAUNCH4J" "launch4j_${TARGET}.xml"
|
---|
| 112 |
|
---|
| 113 | if ! [ -s ${TARGET}.exe ]; then
|
---|
| 114 | echo "NO ${TARGET}.exe File Created"
|
---|
| 115 | exit -1
|
---|
| 116 | fi
|
---|
| 117 |
|
---|
| 118 | /bin/rm -f "launch4j_${TARGET}.xml"
|
---|
| 119 |
|
---|
| 120 | echo
|
---|
| 121 | echo "##################################################################"
|
---|
| 122 | echo "### create the ${TARGET}-installer-${VERSION}.exe with makensis"
|
---|
| 123 | # NSIS - http://nsis.sourceforge.net/Main_Page
|
---|
| 124 | # apt-get install nsis
|
---|
| 125 | "$MAKENSIS" -V2 -DVERSION=$VERSION -DDEST=$TARGET josm.nsi
|
---|
| 126 |
|
---|
| 127 | # keep the intermediate file, for debugging
|
---|
| 128 | /bin/rm -f ${TARGET}-intermediate.exe 2>/dev/null >/dev/null
|
---|
| 129 | /bin/mv ${TARGET}.exe ${TARGET}-intermediate.exe 2>/dev/null >/dev/null
|
---|
| 130 | }
|
---|
| 131 |
|
---|
[13722] | 132 | build_exe "josm" "64\/32" 256 2048
|
---|
[7838] | 133 | # 64-bit binary generation commented until possible with launch4j / nsis
|
---|
| 134 | # build_exe "josm64" "64" 256 2048
|
---|
| 135 |
|
---|
| 136 | /bin/rm -f josm-tested.jar 2>/dev/null >/dev/null
|
---|