package_nsis-mingw.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/sh
  2. #
  3. # ===============================================================================
  4. # package_nsis-ming.sh is distributed under this license:
  5. # Copyright (c) 2006-2007 Andrew Lewman
  6. # Copyright (c) 2008 The Tor Project, Inc.
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions are
  9. # met:
  10. # * Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # * Redistributions in binary form must reproduce the above
  13. # copyright notice, this list of conditions and the following disclaimer
  14. # in the documentation and/or other materials provided with the
  15. # distribution.
  16. # * Neither the names of the copyright owners nor the names of its
  17. # contributors may be used to endorse or promote products derived from
  18. # this software without specific prior written permission.
  19. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. # ===============================================================================
  31. # Script to package a Tor installer on win32. This script assumes that
  32. # you have already built Tor, that you are running msys/mingw, and that
  33. # you know what you are doing.
  34. # Start in the tor source directory after you've compiled tor.exe
  35. # This means start as ./contrib/package_nsis-mingw.sh
  36. rm -rf win_tmp
  37. mkdir win_tmp
  38. mkdir win_tmp/bin
  39. mkdir win_tmp/contrib
  40. mkdir win_tmp/doc
  41. mkdir win_tmp/doc/spec
  42. mkdir win_tmp/doc/design-paper
  43. mkdir win_tmp/doc/contrib
  44. mkdir win_tmp/src
  45. mkdir win_tmp/src/config
  46. mkdir win_tmp/tmp
  47. cp src/or/tor.exe win_tmp/bin/
  48. cp src/tools/tor-resolve.exe win_tmp/bin/
  49. cp contrib/tor.ico win_tmp/bin/
  50. cp src/config/geoip 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