tor.spec 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ##
  2. ## tor.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_dist 0.1.2.13
  26. %define V_opkg 0.1.2.13
  27. # package information
  28. Name: tor
  29. Summary: Anonymous Internet Communication System
  30. URL: http://tor.eff.org/
  31. Vendor: R. Dingledine & N. Mathewson
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: PLUS
  35. Group: Network
  36. License: LGPL
  37. Version: %{V_opkg}
  38. Release: 20070425
  39. # list of sources
  40. Source0: http://tor.eff.org/dist/tor-%{V_dist}.tar.gz
  41. Source1: rc.tor
  42. Source2: torrc
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20060823, gcc
  47. PreReq: OpenPKG, openpkg >= 20060823, tsocks
  48. BuildPreReq: openssl, libevent, zlib
  49. PreReq: openssl, libevent, zlib
  50. AutoReq: no
  51. AutoReqProv: no
  52. %description
  53. Tor is a toolset for a wide range of organizations and people
  54. that want to improve their safety and security on the Internet.
  55. Using Tor can help you anonymize web browsing and publishing,
  56. instant messaging, IRC, SSH, and other applications that use the TCP
  57. protocol. Tor also provides a platform on which software developers
  58. can build new applications with built-in anonymity, safety, and
  59. privacy features. Your traffic is safer when you use Tor, because
  60. communications are bounced around a distributed network of servers,
  61. called onion routers. Instead of taking a direct route from source to
  62. destination, data packets on the Tor network take a random pathway
  63. through several servers that cover your tracks so no observer at any
  64. single point can tell where the data came from or where it's going.
  65. %track
  66. prog tor = {
  67. version = %{V_dist}
  68. url = http://tor.eff.org/dist/
  69. regex = tor-(\d+\.\d+(\.\d+)*(-(alpha|beta|rc))?)\.tar\.gz
  70. }
  71. %prep
  72. %setup -q -n tor-%{V_dist}
  73. %build
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O}" \
  76. CPPFLAGS="%{l_cppflags}" \
  77. LDFLAGS="%{l_ldflags}" \
  78. ./configure \
  79. --prefix=%{l_prefix} \
  80. --with-ssl-dir=%{l_prefix} \
  81. --with-libevent-dir=%{l_prefix}
  82. %{l_make} %{l_mflags -O}
  83. %install
  84. rm -rf $RPM_BUILD_ROOT
  85. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  86. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  87. mv $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc.sample \
  88. $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc
  89. %{l_shtool} subst \
  90. -e 's;exec tsocks;exec %{l_prefix}/bin/tsocks;' \
  91. $RPM_BUILD_ROOT%{l_prefix}/bin/torify
  92. %{l_shtool} mkdir -f -p -m 755 \
  93. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  94. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  95. %{SOURCE rc.tor} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  96. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  97. %{SOURCE torrc} $RPM_BUILD_ROOT%{l_prefix}/etc/tor/
  98. %{l_shtool} mkdir -f -p -m 755 \
  99. $RPM_BUILD_ROOT%{l_prefix}/var/tor/db
  100. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  101. %{l_files_std} \
  102. '%config %{l_prefix}/etc/tor/*' \
  103. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor' \
  104. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor/db'
  105. %files -f files
  106. %clean
  107. rm -rf $RPM_BUILD_ROOT
  108. %post
  109. # after upgrade, restart service
  110. [ $1 -eq 2 ] || exit 0
  111. eval `%{l_rc} tor status 2>/dev/null`
  112. [ ".$tor_active" = .yes ] && %{l_rc} tor restart
  113. exit 0
  114. %preun
  115. # before erase, stop service and remove log files
  116. [ $1 -eq 0 ] || exit 0
  117. %{l_rc} tor stop 2>/dev/null
  118. rm -f $RPM_INSTALL_PREFIX/var/tor/tor.* >/dev/null 2>&1 || true
  119. rm -f $RPM_INSTALL_PREFIX/var/tor/db/* >/dev/null 2>&1 || true
  120. exit 0