tor.spec 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ##
  2. ## tor.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_dist 0.2.0.24-rc
  25. %define V_opkg 0.2.0.24
  26. # package information
  27. Name: tor
  28. Summary: Anonymous Internet Communication System
  29. URL: http://www.torproject.org/
  30. Vendor: R. Dingledine & N. Mathewson
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: PLUS
  34. Group: Network
  35. License: LGPL
  36. Version: %{V_opkg}
  37. Release: 20080423
  38. # list of sources
  39. Source0: http://www.torproject.org/dist/tor-%{V_dist}.tar.gz
  40. Source1: rc.tor
  41. Source2: torrc
  42. # build information
  43. Prefix: %{l_prefix}
  44. BuildRoot: %{l_buildroot}
  45. BuildPreReq: OpenPKG, openpkg >= 20060823, gcc
  46. PreReq: OpenPKG, openpkg >= 20060823, tsocks
  47. BuildPreReq: openssl, libevent, zlib
  48. PreReq: openssl, libevent, zlib
  49. AutoReq: no
  50. AutoReqProv: no
  51. %description
  52. Tor is a toolset for a wide range of organizations and people
  53. that want to improve their safety and security on the Internet.
  54. Using Tor can help you anonymize web browsing and publishing,
  55. instant messaging, IRC, SSH, and other applications that use the TCP
  56. protocol. Tor also provides a platform on which software developers
  57. can build new applications with built-in anonymity, safety, and
  58. privacy features. Your traffic is safer when you use Tor, because
  59. communications are bounced around a distributed network of servers,
  60. called onion routers. Instead of taking a direct route from source to
  61. destination, data packets on the Tor network take a random pathway
  62. through several servers that cover your tracks so no observer at any
  63. single point can tell where the data came from or where it's going.
  64. %track
  65. prog tor = {
  66. version = %{V_dist}
  67. url = http://www.torproject.org/dist/
  68. regex = tor-(\d+\.\d+(\.\d+)*(-(alpha|beta|rc))?)\.tar\.gz
  69. }
  70. %prep
  71. %setup -q -n tor-%{V_dist}
  72. %build
  73. CC="%{l_cc}" \
  74. CFLAGS="%{l_cflags -O}" \
  75. CPPFLAGS="%{l_cppflags}" \
  76. LDFLAGS="%{l_ldflags}" \
  77. ./configure \
  78. --prefix=%{l_prefix} \
  79. --mandir=%{l_prefix}/man \
  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