source: josm/trunk/windows/josm-setup-unix.sh@ 11467

Last change on this file since 11467 was 7853, checked in by Don-vip, 10 years ago

fix/debug problems seen on Jenkins:

  • delete old windows installer files before building new one
  • better error message for unexplained regression + attempt to fix it by synchronization in CachedFile
  • Property svn:executable set to *
File size: 4.9 KB
Line 
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/
12# wget http://softlayer-ams.dl.sourceforge.net/project/launch4j/launch4j-3/3.5/launch4j-3.5-linux.tgz
13# and unpack it to /usr/share/launch4j
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
19
20## settings ##
21
22# trying to find launch4j
23if [ -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"
26elif [ -s /usr/share/launch4j/launch4j.jar ]; then
27 # as described above
28 LAUNCH4J="java -jar /usr/share/launch4j/launch4j.jar"
29elif [ -s ../launch4j/launch4j.jar ]; then
30 LAUNCH4J="java -jar ../launch4j/launch4j.jar"
31elif [ -s $HOME/launch4j/launch4j.jar ]; then
32 LAUNCH4J="java -jar $HOME/launch4j/launch4j.jar"
33else
34 # launch4j installed locally under this nsis folder
35 LAUNCH4J="java -jar ./launch4j/launch4j.jar"
36fi
37echo Using launch4j: $LAUNCH4J
38
39# trying to find makensis
40if [ -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"
43else
44 # UNIX like
45 MAKENSIS=/usr/bin/makensis
46fi
47echo Using NSIS: $MAKENSIS
48
49if [ -n "$2" ]; then
50 # 2 arguments: for Ant build.xml and Jenkins CI
51 export VERSION=$1
52 export JOSM_BUILD="no"
53 export WEBKIT_DOWNLOAD="yes"
54 export JOSM_FILE=$2
55elif [ -n "$1" ]; then
56 # 1 argument: for official JOSM server
57 export VERSION=$1
58 export JOSM_BUILD="no"
59 export WEBKIT_DOWNLOAD="no"
60 export JOSM_FILE="/home/josm/www/download/josm-tested.jar"
61else
62 # no argument: for everyone else
63 svncorerevision=`svnversion -n ..`
64 #svnpluginsrevision=`svnversion -n ../../plugins`
65 #svnrevision="$svncorerevision-$svnpluginsrevision"
66
67 #export VERSION=custom-${svnrevision}
68 export VERSION=`echo ${svncorerevision} | sed -e 's/M//g' -e 's/S//g' -e 's/P//g'`
69 export JOSM_BUILD="yes"
70 export WEBKIT_DOWNLOAD="yes"
71 export JOSM_FILE="..\dist\josm-custom.jar"
72fi
73
74echo "Creating Windows Installer for josm-$VERSION"
75
76echo
77echo "##################################################################"
78echo "### Download and unzip the webkit stuff"
79if [ "x$WEBKIT_DOWNLOAD" == "xyes" ]; then
80 wget --continue --timestamping http://josm.openstreetmap.de/download/windows/webkit-image.zip
81else
82 if ! [ -f webkit-image.zip ]; then
83 ln -s /home/josm/www/download/windows/webkit-image.zip .
84 fi
85fi
86unzip -o webkit-image.zip
87
88echo
89echo "##################################################################"
90echo "### Build the Complete josm + Plugin Stuff"
91if [ "x$JOSM_BUILD" == "xyes" ]; then
92 (
93 echo "Build the Complete josm Stuff"
94
95 echo "Compile Josm"
96 cd ../core
97 ant -q clean
98 ant -q compile || exit -1
99 cd ..
100
101 echo "Compile Josm Plugins"
102 cd plugins
103 ant -q clean
104 ant -q dist || exit -1
105 ) || exit -1
106fi
107
108/bin/cp $JOSM_FILE josm-tested.jar
109
110function build_exe {
111
112 export TARGET=$1 # josm / josm64. Used in file name of launcher and installer
113
114 /bin/rm -f "launch4j_${TARGET}.xml"
115 /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"
116
117 echo
118 echo "##################################################################"
119 echo "### convert jar to ${TARGET}.exe with launch4j"
120 # (an exe file makes attaching to file extensions a lot easier)
121 # launch4j - http://launch4j.sourceforge.net/
122 # delete old exe file first
123 /bin/rm -f ${TARGET}*.exe
124 $LAUNCH4J "launch4j_${TARGET}.xml"
125 # comment previous line and uncomment next one on Windows
126 #"$LAUNCH4J" "launch4j_${TARGET}.xml"
127
128 if ! [ -s ${TARGET}.exe ]; then
129 echo "NO ${TARGET}.exe File Created"
130 exit -1
131 fi
132
133 /bin/rm -f "launch4j_${TARGET}.xml"
134
135 echo
136 echo "##################################################################"
137 echo "### create the ${TARGET}-installer-${VERSION}.exe with makensis"
138 # NSIS - http://nsis.sourceforge.net/Main_Page
139 # apt-get install nsis
140 "$MAKENSIS" -V2 -DVERSION=$VERSION -DDEST=$TARGET josm.nsi
141
142 # keep the intermediate file, for debugging
143 /bin/rm -f ${TARGET}-intermediate.exe 2>/dev/null >/dev/null
144 /bin/mv ${TARGET}.exe ${TARGET}-intermediate.exe 2>/dev/null >/dev/null
145}
146
147build_exe "josm" "64\/32" 128 1024
148# 64-bit binary generation commented until possible with launch4j / nsis
149# build_exe "josm64" "64" 256 2048
150
151/bin/rm -f josm-tested.jar 2>/dev/null >/dev/null
Note: See TracBrowser for help on using the repository browser.