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 comming 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://mesh.dl.sourceforge.net/sourceforge/launch4j/launch4j-3.0.0-pre2-linux.tgz
|
---|
13 | # and unpack it to /usr/share/launch4j
|
---|
14 |
|
---|
15 | ## settings ##
|
---|
16 |
|
---|
17 | # trying to find launch4j
|
---|
18 | if [ -s /cygdrive/c/Programme/Launch4j/launch4jc.exe ]; then
|
---|
19 | # Windows under cygwin
|
---|
20 | LAUNCH4J="/cygdrive/c/Programme/Launch4j/launch4jc.exe"
|
---|
21 | elif [ -s /usr/share/launch4j/launch4j.jar ]; then
|
---|
22 | # as described above
|
---|
23 | LAUNCH4J="java -jar /usr/share/launch4j/launch4j.jar"
|
---|
24 | elif [ -s ../launch4j/launch4j.jar ]; then
|
---|
25 | LAUNCH4J="java -jar ../launch4j/launch4j.jar"
|
---|
26 | else
|
---|
27 | # launch4j installed locally under this nsis folder
|
---|
28 | LAUNCH4J="java -jar ./launch4j/launch4j.jar"
|
---|
29 | fi
|
---|
30 | echo Using launch4j: $LAUNCH4J
|
---|
31 |
|
---|
32 | # trying to find makensis
|
---|
33 | if [ -s /cygdrive/c/Programme/nsis/makensis.exe ]; then
|
---|
34 | # Windows under cygwin
|
---|
35 | MAKENSIS="/cygdrive/c/Programme/nsis/makensis.exe"
|
---|
36 | else
|
---|
37 | # UNIX like
|
---|
38 | MAKENSIS=/usr/bin/makensis
|
---|
39 | fi
|
---|
40 | echo Using NSIS: $MAKENSIS
|
---|
41 |
|
---|
42 | if [ -n "$1" ]; then
|
---|
43 | export VERSION=$1
|
---|
44 | export JOSM_BUILD="no"
|
---|
45 | export WEBKIT_DOWNLAD="no"
|
---|
46 | else
|
---|
47 | svncorerevision=`svnversion ../core`
|
---|
48 | svnpluginsrevision=`svnversion ../plugins`
|
---|
49 | svnrevision="$svncorerevision-$svnpluginsrevision"
|
---|
50 |
|
---|
51 | export VERSION=custom-${svnrevision}
|
---|
52 | export JOSM_BUILD="yes"
|
---|
53 | export WEBKIT_DOWNLOAD="yes"
|
---|
54 | fi
|
---|
55 |
|
---|
56 | echo "Creating Windows Installer for josm-$VERSION"
|
---|
57 |
|
---|
58 | echo
|
---|
59 | echo "##################################################################"
|
---|
60 | echo "### Download and unzip the webkit stuff"
|
---|
61 | if [ "x$WEBKIT_DOWNLOAD" == "xyes" ]; then
|
---|
62 | wget --continue --timestamping http://josm.openstreetmap.de/download/windows/webkit-image.zip
|
---|
63 | fi
|
---|
64 | mkdir -p webkit-image
|
---|
65 | cd webkit-image
|
---|
66 | unzip -o ../webkit-image.zip
|
---|
67 | cd ..
|
---|
68 |
|
---|
69 | echo
|
---|
70 | echo "##################################################################"
|
---|
71 | echo "### Build the Complete josm + Plugin Stuff"
|
---|
72 | if [ "x$JOSM_BUILD" == "xyes" ]; then
|
---|
73 | (
|
---|
74 | echo "Build the Complete josm Stuff"
|
---|
75 |
|
---|
76 | echo "Compile Josm"
|
---|
77 | cd ../core
|
---|
78 | ant -q clean
|
---|
79 | ant -q compile || exit -1
|
---|
80 | cd ..
|
---|
81 |
|
---|
82 | echo "Compile Josm Plugins"
|
---|
83 | cd plugins
|
---|
84 | ant -q clean
|
---|
85 | ant -q dist || exit -1
|
---|
86 | ) || exit -1
|
---|
87 | fi
|
---|
88 |
|
---|
89 | echo
|
---|
90 | echo "##################################################################"
|
---|
91 | echo "### convert jar to exe with launch4j"
|
---|
92 | # (an exe file makes attaching to file extensions a lot easier)
|
---|
93 | # launch4j - http://launch4j.sourceforge.net/
|
---|
94 | # delete old exe file first
|
---|
95 | /bin/rm -f josm.exe
|
---|
96 | $LAUNCH4J "launch4j.xml"
|
---|
97 |
|
---|
98 | if ! [ -s josm.exe ]; then
|
---|
99 | echo "NO Josm File Created"
|
---|
100 | exit -1
|
---|
101 | fi
|
---|
102 |
|
---|
103 | echo
|
---|
104 | echo "##################################################################"
|
---|
105 | echo "### create the josm-installer-${VERSION}.exe with makensis"
|
---|
106 | # NSIS - http://nsis.sourceforge.net/Main_Page
|
---|
107 | # apt-get install nsis
|
---|
108 | $MAKENSIS -V2 -DVERSION=$VERSION josm.nsi
|
---|
109 |
|
---|
110 | # keep the intermediate file, for debugging
|
---|
111 | /bin/rm josm-intermediate.exe 2>/dev/null >/dev/null
|
---|
112 | /bin/mv josm.exe josm-intermediate.exe 2>/dev/null >/dev/null
|
---|