package_nsis-mingw.sh 3.5 KB

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