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