Backport candidate. Updated to work with all versions of osx we support (10.3-10.5).
[tor/rransom.git] / contrib / package_nsis-mingw.sh
blob439c6352b8353e7ec77d55f98293ce37bd41f6a7
1 #!/bin/sh
3 # Script to package a Tor installer on win32. This script assumes that
4 # you have already built Tor, that you are running msys/mingw, and that
5 # you know what you are doing.
7 # Start in the tor source directory after you've compiled tor.exe
8 # This means start as ./contrib/package_nsis-mingw.sh
10 rm -rf win_tmp
11 mkdir win_tmp
12 mkdir win_tmp/bin
13 mkdir win_tmp/contrib
14 mkdir win_tmp/doc
15 mkdir win_tmp/doc/spec
16 mkdir win_tmp/doc/design-paper
17 mkdir win_tmp/doc/contrib
18 mkdir win_tmp/src
19 mkdir win_tmp/src/config
20 mkdir win_tmp/tmp
22 cp src/or/tor.exe win_tmp/bin/
23 cp src/tools/tor-resolve.exe win_tmp/bin/
24 cp /usr/local/ssl/lib/libcrypto.a win_tmp/bin/
25 cp /usr/local/ssl/lib/libssl.a win_tmp/bin/
26 cp contrib/tor.ico win_tmp/bin/
28 # YOU must copy torbutton xpi into the contrib dir
29 #cp contrib/torbutton-1.0.4-fx+tb.xpi win_tmp/bin/
31 # There is no man2html in mingw.
32 # Maybe we should add this into make dist instead.
33 # One has to do this manually and cp it do the tor-source/doc dir
34 #man2html doc/tor.1.in > win_tmp/tmp/tor-reference.html
35 #man2html doc/tor-resolve.1 > win_tmp/tmp/tor-resolve.html
37 clean_newlines() {
38 perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg;' $1 >$2
41 clean_localstatedir() {
42 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
45 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
46 clean_newlines doc/spec/$fn win_tmp/doc/spec/$fn
47 done
49 cp doc/design-paper/tor-design.pdf win_tmp/doc/design-paper/tor-design.pdf
51 for fn in HACKING tor-reference.html tor-resolve.html; do
52 clean_newlines doc/$fn win_tmp/doc/$fn
53 done
55 for fn in README AUTHORS ChangeLog LICENSE; do
56 clean_newlines $fn win_tmp/$fn
57 done
59 clean_localstatedir src/config/torrc.sample.in win_tmp/src/config/torrc.sample
61 cp contrib/tor-mingw.nsi.in win_tmp/contrib/
63 cd win_tmp
64 "C:\Program Files\NSIS\makensis.exe" contrib/tor-mingw.nsi.in