package_nsis-weasel.sh 2.3 KB

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