package_nsis-mingw.sh 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. strip win_tmp/bin/*.exe
  52. # There is no man2html in mingw.
  53. # Maybe we should add this into make dist instead.
  54. # One has to do this manually and cp it do the tor-source/doc dir
  55. #man2html doc/tor.1.in > win_tmp/tmp/tor-reference.html
  56. #man2html doc/tor-resolve.1 > win_tmp/tmp/tor-resolve.html
  57. clean_newlines() {
  58. perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg;' $1 >$2
  59. }
  60. clean_localstatedir() {
  61. 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
  62. }
  63. for fn in address-spec.txt bridges-spec.txt control-spec.txt dir-spec.txt path-spec.txt rend-spec.txt socks-extensions.txt tor-spec.txt version-spec.txt; do
  64. clean_newlines doc/spec/$fn win_tmp/doc/spec/$fn
  65. done
  66. for fn in HACKING tor-gencert.html tor.html torify.html tor-resolve.html; do
  67. clean_newlines doc/$fn win_tmp/doc/$fn
  68. done
  69. for fn in README 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. makensis.exe contrib/tor-mingw.nsi.in