package_nsis-mingw.sh 3.6 KB

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