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

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

move Windows Installer NSIS code from OSM SVN to our own repository

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.4/launch4j-3.4-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 "$1" ]; then
45  export VERSION=$1
46  export JOSM_BUILD="no"
47  export WEBKIT_DOWNLAD="no"
48  export JOSM_FILE="/home/josm/www/download/josm-tested.jar"
49else
50  svncorerevision=`svnversion -n ../core`
51  #svnpluginsrevision=`svnversion -n ../plugins`
52  #svnrevision="$svncorerevision-$svnpluginsrevision"
53
54  #export VERSION=custom-${svnrevision}
55  export VERSION=`echo ${svncorerevision} | sed -e 's/M//g' -e 's/S//g' -e 's/P//g'`
56  export JOSM_BUILD="yes"
57  export WEBKIT_DOWNLOAD="yes"
58  export JOSM_FILE="..\core\dist\josm-custom.jar"
59fi
60
61echo "Creating Windows Installer for josm-$VERSION"
62
63echo 
64echo "##################################################################"
65echo "### Download and unzip the webkit stuff"
66if [ "x$WEBKIT_DOWNLOAD" == "xyes" ]; then
67    wget --continue --timestamping http://josm.openstreetmap.de/download/windows/webkit-image.zip
68else
69    if ! [ -f webkit-image.zip ]; then
70      ln -s /home/josm/www/download/windows/webkit-image.zip .
71    fi
72fi
73#mkdir -p webkit-image
74#cd webkit-image
75unzip -o webkit-image.zip
76#cd ..
77
78echo 
79echo "##################################################################"
80echo "### Build the Complete josm + Plugin Stuff"
81if [ "x$JOSM_BUILD" == "xyes" ]; then
82    (
83        echo "Build the Complete josm Stuff"
84       
85        echo "Compile Josm"
86        cd ../core
87        ant -q clean
88        ant -q compile || exit -1
89        cd ..
90       
91        echo "Compile Josm Plugins"
92        cd plugins
93        ant -q clean
94        ant -q dist || exit -1
95        ) || exit -1
96fi
97
98/bin/cp $JOSM_FILE josm-tested.jar
99
100function build_exe {
101
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
114        $LAUNCH4J "launch4j_${TARGET}.xml"
115        # comment previous line and uncomment next one on Windows
116        #"$LAUNCH4J" "launch4j_${TARGET}.xml"
117
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
137build_exe "josm" "64\/32" 128 1024
138# 64-bit binary generation commented until possible with launch4j / nsis
139# build_exe "josm64"  "64" 256 2048
140
141/bin/rm -f josm-tested.jar 2>/dev/null >/dev/null
Note: See TracBrowser for help on using the repository browser.