Make an attempt to fix bug 1024.
[tor/rransom.git] / contrib / package_nsis-mingw.sh
blob54f0ce228a5b1fb6b2b73a5c23b0bb1378d71ab6
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/
62 # There is no man2html in mingw.
63 # Maybe we should add this into make dist instead.
64 # One has to do this manually and cp it do the tor-source/doc dir
65 #man2html doc/tor.1.in > win_tmp/tmp/tor-reference.html
66 #man2html doc/tor-resolve.1 > win_tmp/tmp/tor-resolve.html
68 clean_newlines() {
69 perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg;' $1 >$2
72 clean_localstatedir() {
73 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
76 for fn in address-spec.txt control-spec.txt control-spec-v0.txt dir-spec.txt dir-spec-v1.txt path-spec.txt rend-spec.txt socks-extensions.txt tor-spec.txt version-spec.txt; do
77 clean_newlines doc/spec/$fn win_tmp/doc/spec/$fn
78 done
80 cp doc/design-paper/tor-design.pdf win_tmp/doc/design-paper/tor-design.pdf
82 for fn in HACKING tor-reference.html tor-resolve.html; do
83 clean_newlines doc/$fn win_tmp/doc/$fn
84 done
86 for fn in README AUTHORS ChangeLog LICENSE; do
87 clean_newlines $fn win_tmp/$fn
88 done
90 clean_localstatedir src/config/torrc.sample.in win_tmp/src/config/torrc.sample
92 cp contrib/tor-mingw.nsi.in win_tmp/contrib/
94 cd win_tmp
95 "C:\Program Files\NSIS\makensis.exe" contrib/tor-mingw.nsi.in