r15253@catbus: nickm | 2007-09-21 15:03:51 -0400
[tor.git] / contrib / package_nsis-weasel.sh
blob8dd494852704f2035b98c92300a834a6a78ec048
1 #!/bin/sh
3 set -e
6 # Script to package a Tor installer on win32. This script assumes that
7 # you have already built Tor, that you are running cygwin, and that your
8 # environment is basically exactly the same as Nick's.
10 if ! [ -d Win32Build ] || ! [ -d contrib ]; then
11 echo "No Win32Build and/or no contrib directory here. Are we in the right place?" >&2
12 exit 1
15 rm -rf win_tmp
16 mkdir win_tmp
17 mkdir win_tmp/bin
18 mkdir win_tmp/contrib
19 mkdir win_tmp/doc
20 mkdir win_tmp/doc/website
21 mkdir win_tmp/doc/design-paper
22 mkdir win_tmp/doc/contrib
23 mkdir win_tmp/src
24 mkdir win_tmp/src/config
25 mkdir win_tmp/tmp
27 cp Win32Build/vc7/Tor/Debug/Tor.exe win_tmp/bin/tor.exe
28 cp Win32Build/vc7/tor_resolve/Debug/tor_resolve.exe win_tmp/bin
29 cp ../c-windows-system32/libeay32.dll win_tmp/bin
30 cp ../c-windows-system32/ssleay32.dll win_tmp/bin
32 man2html doc/tor.1.in > win_tmp/tmp/tor-reference.html
33 man2html doc/tor-resolve.1 > win_tmp/tmp/tor-resolve.html
35 clean_newlines() {
36 perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg;' $1 >$2
39 clean_localstatedir() {
40 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
43 for fn in \
44 doc/HACKING \
45 doc/control-spec.txt \
46 doc/dir-spec.txt \
47 doc/rend-spec.txt \
48 doc/socks-extensions.txt \
49 doc/tor-spec.txt \
50 doc/version-spec.txt \
52 doc/website/* \
53 ; do
54 clean_newlines "$fn" win_tmp/"$fn"
55 done
56 mmv win_tmp/doc/website/"*.html.*" win_tmp/doc/website/"#1.#2.html"
58 cp doc/design-paper/tor-design.pdf win_tmp/doc/design-paper/tor-design.pdf
60 for fn in tor-reference.html tor-resolve.html; do \
61 clean_newlines win_tmp/tmp/$fn win_tmp/doc/$fn
62 done
64 for fn in README AUTHORS ChangeLog LICENSE; do \
65 clean_newlines $fn win_tmp/$fn
66 done
68 clean_localstatedir src/config/torrc.sample.in win_tmp/src/config/torrc.sample
70 cp contrib/tor.nsi.in win_tmp/contrib/tor.nsi
72 echo '/WEBSITE-FILES-HERE/'
73 echo 'a' # append
74 for fn in win_tmp/doc/website/*; do
75 echo -n 'File "..\doc\website\'
76 echo -n "`basename $fn`"
77 echo '"'
78 done
79 echo "." # end input
80 echo "w" # write
81 echo "q" # quit
82 ) | ed win_tmp/contrib/tor.nsi
84 cd win_tmp/contrib
86 echo "Now run"
87 echo ' t:'
88 echo ' cd \tor\win_tmp\contrib'
89 echo ' c:\programme\nsis\makensis tor.nsi'
90 echo ' move tor-*.exe ../../..'