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

Last change on this file since 13619 was 11580, checked in by stoecker, 7 years ago

see #13470 - drop last remaining HTML imagery part in windows installer (uninstaller still contains something)

  • Property svn:executable set to *
File size: 4.4 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 JOSM_FILE=$2
54elif [ -n "$1" ]; then
55 # 1 argument: for official JOSM server
56 export VERSION=$1
57 export JOSM_BUILD="no"
58 export JOSM_FILE="/home/josm/www/download/josm-tested.jar"
59else
60 # no argument: for everyone else
61 svncorerevision=`svnversion -n ..`
62 #svnpluginsrevision=`svnversion -n ../../plugins`
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"
68 export JOSM_FILE="..\dist\josm-custom.jar"
69fi
70
71echo "Creating Windows Installer for josm-$VERSION"
72
73echo
74echo "##################################################################"
75echo "### Build the Complete josm + Plugin Stuff"
76if [ "x$JOSM_BUILD" == "xyes" ]; then
77 (
78 echo "Build the Complete josm Stuff"
79
80 echo "Compile Josm"
81 cd ../core
82 ant -q clean
83 ant -q compile || exit -1
84 cd ..
85
86 echo "Compile Josm Plugins"
87 cd plugins
88 ant -q clean
89 ant -q dist || exit -1
90 ) || exit -1
91fi
92
93/bin/cp $JOSM_FILE josm-tested.jar
94
95function 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
108 /bin/rm -f ${TARGET}*.exe
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
132build_exe "josm" "64\/32" 128 1024
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
Note: See TracBrowser for help on using the repository browser.