tor.spec 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ##
  2. ## tor.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/>
  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.4.7.7
  25. %define V_opkg 0.4.7.7
  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 Project
  32. Distribution: OpenPKG Community
  33. Class: PLUS
  34. Group: Networking
  35. License: LGPL
  36. Version: %{V_opkg}
  37. Release: 20220427
  38. # list of sources
  39. Source0: https://dist.torproject.org/tor-%{V_dist}.tar.gz
  40. Source1: rc.tor
  41. Source2: torrc
  42. # build information
  43. BuildPreReq: OpenPKG, openpkg >= 20160101, gcc
  44. PreReq: OpenPKG, openpkg >= 20160101, tsocks
  45. BuildPreReq: openssl-threads, libevent, zlib
  46. PreReq: openssl-threads, libevent, zlib
  47. %description
  48. Tor is a toolset for a wide range of organizations and people
  49. that want to improve their safety and security on the Internet.
  50. Using Tor can help you anonymize web browsing and publishing,
  51. instant messaging, IRC, SSH, and other applications that use the TCP
  52. protocol. Tor also provides a platform on which software developers
  53. can build new applications with built-in anonymity, safety, and
  54. privacy features. Your traffic is safer when you use Tor, because
  55. communications are bounced around a distributed network of servers,
  56. called onion routers. Instead of taking a direct route from source to
  57. destination, data packets on the Tor network take a random pathway
  58. through several servers that cover your tracks so no observer at any
  59. single point can tell where the data came from or where it's going.
  60. %track
  61. prog tor = {
  62. version = %{V_dist}
  63. url = https://dist.torproject.org/
  64. regex = tor-(\d+\.\d+(?:\.\d+)*)\.tar\.gz
  65. }
  66. %prep
  67. %setup -q -n tor-%{V_dist}
  68. %build
  69. libs=""
  70. case "%{l_platform -t}" in
  71. *-linux* ) libs="$libs -lrt" ;;
  72. esac
  73. CC="%{l_cc}" \
  74. CFLAGS="%{l_cflags -O}" \
  75. CPPFLAGS="%{l_cppflags openssl-threads .}" \
  76. LDFLAGS="%{l_ldflags openssl-threads .}" \
  77. LIBS="$libs" \
  78. ./configure \
  79. --prefix=%{l_prefix} \
  80. --mandir=%{l_prefix}/man \
  81. --with-ssl-dir=%{l_prefix}/lib/openssl-threads \
  82. --with-libevent-dir=%{l_prefix} \
  83. --disable-asciidoc
  84. %{l_make} %{l_mflags -O}
  85. %install
  86. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  87. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  88. mv $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc.sample \
  89. $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc
  90. %{l_shtool} subst \
  91. -e 's;exec tsocks;exec %{l_prefix}/bin/tsocks;' \
  92. $RPM_BUILD_ROOT%{l_prefix}/bin/torify
  93. %{l_shtool} mkdir -f -p -m 755 \
  94. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  95. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  96. %{SOURCE rc.tor} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  97. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  98. %{SOURCE torrc} $RPM_BUILD_ROOT%{l_prefix}/etc/tor/
  99. %{l_shtool} mkdir -f -p -m 755 \
  100. $RPM_BUILD_ROOT%{l_prefix}/var/tor/db
  101. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  102. %{l_files_std} \
  103. '%config %{l_prefix}/etc/tor/*' \
  104. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor' \
  105. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor/db'
  106. %files -f files
  107. %clean
  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