Merge branch 'bug1653'
[tor.git] / contrib / package_nsis-mingw.sh
blob59811f4f11a31c8a6e3e6566c67d342187c74d74
1 #!/bin/sh
3 # ===============================================================================
4 # package_nsis-ming.sh is distributed under this license:
6 # Copyright (c) 2006-2007 Andrew Lewman
7 # Copyright (c) 2008 The Tor Project, Inc.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions are
11 # met:
13 # * Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
16 # * Redistributions in binary form must reproduce the above
17 # copyright notice, this list of conditions and the following disclaimer
18 # in the documentation and/or other materials provided with the
19 # distribution.
21 # * Neither the names of the copyright owners nor the names of its
22 # contributors may be used to endorse or promote products derived from
23 # this software without specific prior written permission.
25 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 # ===============================================================================
38 # Script to package a Tor installer on win32. This script assumes that
39 # you have already built Tor, that you are running msys/mingw, and that
40 # you know what you are doing.
42 # Start in the tor source directory after you've compiled tor.exe
43 # This means start as ./contrib/package_nsis-mingw.sh
45 rm -rf win_tmp
46 mkdir win_tmp
47 mkdir win_tmp/bin
48 mkdir win_tmp/contrib
49 mkdir win_tmp/doc
50 mkdir win_tmp/doc/spec
51 mkdir win_tmp/doc/design-paper
52 mkdir win_tmp/doc/contrib
53 mkdir win_tmp/src
54 mkdir win_tmp/src/config
55 mkdir win_tmp/tmp
57 cp src/or/tor.exe win_tmp/bin/
58 cp src/tools/tor-resolve.exe win_tmp/bin/
59 cp contrib/tor.ico win_tmp/bin/
60 cp src/config/geoip win_tmp/bin/
61 strip win_tmp/bin/*.exe
63 # There is no man2html in mingw.
64 # Maybe we should add this into make dist instead.
65 # One has to do this manually and cp it do the tor-source/doc dir
66 #man2html doc/tor.1.in > win_tmp/tmp/tor-reference.html
67 #man2html doc/tor-resolve.1 > win_tmp/tmp/tor-resolve.html
69 clean_newlines() {
70 perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg;' $1 >$2
73 clean_localstatedir() {
74 perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg; s{\@LOCALSTATEDIR\@/(lib|log)/tor/}{C:\\Documents and Settings\\Application Data\\Tor\\}' $1 >$2
77 for fn in address-spec.txt bridges-spec.txt control-spec.txt dir-spec.txt path-spec.txt rend-spec.txt socks-extensions.txt tor-spec.txt version-spec.txt; do
78 clean_newlines doc/spec/$fn win_tmp/doc/spec/$fn
79 done
81 for fn in HACKING tor-gencert.html tor.html torify.html tor-resolve.html; do
82 clean_newlines doc/$fn win_tmp/doc/$fn
83 done
85 for fn in README ChangeLog LICENSE; do
86 clean_newlines $fn win_tmp/$fn
87 done
89 clean_localstatedir src/config/torrc.sample.in win_tmp/src/config/torrc.sample
91 cp contrib/tor-mingw.nsi.in win_tmp/contrib/
93 cd win_tmp
94 "C:\Program Files\NSIS\makensis.exe" contrib/tor-mingw.nsi.in