tor/tor.spec

changeset 789
cbbc8daa8174
child 790
ab976cd2e548
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tor/tor.spec	Wed Jan 22 21:02:10 2014 +0100
     1.3 @@ -0,0 +1,134 @@
     1.4 +##
     1.5 +##  tor.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package version
    1.28 +%define       V_dist  0.2.3.14-alpha
    1.29 +%define       V_opkg  0.2.3.14
    1.30 +
    1.31 +#   package information
    1.32 +Name:         tor
    1.33 +Summary:      Anonymous Internet Communication System
    1.34 +URL:          http://www.torproject.org/
    1.35 +Vendor:       R. Dingledine & N. Mathewson
    1.36 +Packager:     OpenPKG Foundation e.V.
    1.37 +Distribution: OpenPKG Community
    1.38 +Class:        PLUS
    1.39 +Group:        Network
    1.40 +License:      LGPL
    1.41 +Version:      %{V_opkg}
    1.42 +Release:      20120427
    1.43 +
    1.44 +#   list of sources
    1.45 +Source0:      http://www.torproject.org/dist/tor-%{V_dist}.tar.gz
    1.46 +Source1:      rc.tor
    1.47 +Source2:      torrc
    1.48 +
    1.49 +#   build information
    1.50 +BuildPreReq:  OpenPKG, openpkg >= 20100101, gcc
    1.51 +PreReq:       OpenPKG, openpkg >= 20100101, tsocks
    1.52 +BuildPreReq:  openssl, libevent, zlib
    1.53 +PreReq:       openssl, libevent, zlib
    1.54 +
    1.55 +%description
    1.56 +   Tor is a toolset for a wide range of organizations and people
    1.57 +   that want to improve their safety and security on the Internet.
    1.58 +   Using Tor can help you anonymize web browsing and publishing,
    1.59 +   instant messaging, IRC, SSH, and other applications that use the TCP
    1.60 +   protocol. Tor also provides a platform on which software developers
    1.61 +   can build new applications with built-in anonymity, safety, and
    1.62 +   privacy features. Your traffic is safer when you use Tor, because
    1.63 +   communications are bounced around a distributed network of servers,
    1.64 +   called onion routers. Instead of taking a direct route from source to
    1.65 +   destination, data packets on the Tor network take a random pathway
    1.66 +   through several servers that cover your tracks so no observer at any
    1.67 +   single point can tell where the data came from or where it's going.
    1.68 +
    1.69 +%track
    1.70 +    prog tor = {
    1.71 +        version   = %{V_dist}
    1.72 +        url       = http://www.torproject.org/dist/
    1.73 +        regex     = tor-(\d+\.\d+(\.\d+)*(-(alpha|beta|rc))?)\.tar\.gz
    1.74 +    }
    1.75 +
    1.76 +%prep
    1.77 +    %setup -q -n tor-%{V_dist}
    1.78 +
    1.79 +%build
    1.80 +    libs=""
    1.81 +    case "%{l_platform -t}" in
    1.82 +        *-linux* ) libs="$libs -lrt" ;;
    1.83 +    esac
    1.84 +    CC="%{l_cc}" \
    1.85 +    CFLAGS="%{l_cflags -O}" \
    1.86 +    CPPFLAGS="%{l_cppflags}" \
    1.87 +    LDFLAGS="%{l_ldflags}" \
    1.88 +    LIBS="$libs" \
    1.89 +    ./configure \
    1.90 +        --prefix=%{l_prefix} \
    1.91 +        --mandir=%{l_prefix}/man \
    1.92 +        --with-ssl-dir=%{l_prefix} \
    1.93 +        --with-libevent-dir=%{l_prefix} \
    1.94 +        --disable-asciidoc
    1.95 +    %{l_make} %{l_mflags -O}
    1.96 +
    1.97 +%install
    1.98 +    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    1.99 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.100 +    mv $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc.sample \
   1.101 +       $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc
   1.102 +    %{l_shtool} subst \
   1.103 +        -e 's;exec tsocks;exec %{l_prefix}/bin/tsocks;' \
   1.104 +        $RPM_BUILD_ROOT%{l_prefix}/bin/torify
   1.105 +    %{l_shtool} mkdir -f -p -m 755 \
   1.106 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.107 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.108 +        %{SOURCE rc.tor} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.109 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.110 +        %{SOURCE torrc} $RPM_BUILD_ROOT%{l_prefix}/etc/tor/
   1.111 +    %{l_shtool} mkdir -f -p -m 755 \
   1.112 +        $RPM_BUILD_ROOT%{l_prefix}/var/tor/db
   1.113 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.114 +        %{l_files_std} \
   1.115 +        '%config %{l_prefix}/etc/tor/*' \
   1.116 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor' \
   1.117 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor/db'
   1.118 +
   1.119 +%files -f files
   1.120 +
   1.121 +%clean
   1.122 +
   1.123 +%post
   1.124 +    #   after upgrade, restart service
   1.125 +    [ $1 -eq 2 ] || exit 0
   1.126 +    eval `%{l_rc} tor status 2>/dev/null`
   1.127 +    [ ".$tor_active" = .yes ] && %{l_rc} tor restart
   1.128 +    exit 0
   1.129 +
   1.130 +%preun
   1.131 +    #   before erase, stop service and remove log files
   1.132 +    [ $1 -eq 0 ] || exit 0
   1.133 +    %{l_rc} tor stop 2>/dev/null
   1.134 +    rm -f $RPM_INSTALL_PREFIX/var/tor/tor.* >/dev/null 2>&1 || true
   1.135 +    rm -f $RPM_INSTALL_PREFIX/var/tor/db/*  >/dev/null 2>&1 || true
   1.136 +    exit 0
   1.137 +

mercurial