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

Last change on this file since 7842 was 7842, checked in by Don-vip, 5 years ago

fix windows installer script

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