stun/stun.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 417
76ceb617f880
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 ##
     2 ##  stun.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 ##
    24 #   package information
    25 Name:         stun
    26 Summary:      STUN Client & Server
    27 URL:          http://www.vovida.org/applications/downloads/stun/
    28 Vendor:       Vovida
    29 Packager:     OpenPKG Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        EVAL
    32 Group:        VoIP
    33 License:      Open Source
    34 Version:      0.97
    35 Release:      20120208
    37 #   list of sources
    38 Source0:      http://switch.dl.sourceforge.net/stun/stund-%{version}.tgz
    39 Source1:      rc.stun
    40 Patch0:       stun.patch
    42 #   build information
    43 Prefix:       %{l_prefix}
    44 BuildRoot:    %{l_buildroot}
    45 BuildPreReq:  OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes
    46 PreReq:       OpenPKG, openpkg >= 20060823
    47 AutoReq:      no
    48 AutoReqProv:  no
    50 %description
    51     The STUN (Simple Traversal of UDP through NATs (Network Address
    52     Translation)) server is an implementation of the STUN protocol that
    53     enables STUN functionality in SIP-based systems. The STUN server
    54     tar ball also include a client API to enable STUN functionality in
    55     SIP endpoints. In addition there is a command line UNIX client and
    56     a graphical windows client that check what type of NAT the user is
    57     using. STUN is an application-layer protocol that can determine the
    58     public IP and nature of a NAT device that sits between the STUN
    59     client and STUN server. The current version of the code supports
    60     most of RFC 3489 except the ability to get OTPs from the server.
    62 %track
    63     prog stun = {
    64         version   = %{version}
    65         url       = http://prdownloads.sourceforge.net/stun/
    66         regex     = stund_(.+?)\.tgz
    67     }
    69 %prep
    70     %setup -q -n stund
    71     %patch -p0
    72     %{l_shtool} subst \
    73         -e 's;\(|| defined(__i386__)\) );\1 || defined(__x86_64__) );' \
    74         stun.cxx
    75     case "%{l_platform -t}" in
    76         *-sunos* )
    77             %{l_shtool} subst \
    78                 -e 's;^\(LDFLAGS\)+=.*;\1=;' \
    79                 -e 's;^#\(LDFLAGS+=\) -lnsl -lsocket;\1-lsocket -lnsl -ldl;' \
    80                 Makefile
    81             ;;
    82         * )
    83             %{l_shtool} subst \
    84                 -e 's;^\(LDFLAGS\)+=.*;\1=;' \
    85                 Makefile
    86             ;;
    87     esac
    89 %build
    90     %{l_make} %{l_mflags -O} \
    91         CXX="%{l_cxx}" \
    92         CXXFLAGS="%{l_cxxflags -O}"
    94 %install
    95     rm -rf $RPM_BUILD_ROOT
    96     %{l_shtool} mkdir -f -p -m 755 \
    97         $RPM_BUILD_ROOT%{l_prefix}/bin \
    98         $RPM_BUILD_ROOT%{l_prefix}/sbin \
    99         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   100         $RPM_BUILD_ROOT%{l_prefix}/var/stun
   101     %{l_shtool} install -c -s -m 755 \
   102         client $RPM_BUILD_ROOT%{l_prefix}/bin/stun
   103     %{l_shtool} install -c -s -m 755 \
   104         server $RPM_BUILD_ROOT%{l_prefix}/sbin/stund
   105     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   106         %{SOURCE rc.stun} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   107     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   109 %files -f files
   111 %clean
   112     rm -rf $RPM_BUILD_ROOT
   114 %post
   115     if [ $1 -eq 1 ]; then
   116         #   display final hints on initial installation
   117         ( echo "Before starting the STUN daemon, please set the configuration"
   118           echo "variables \"stun_bind_addr{1,2}\" in $RPM_INSTALL_PREFIX/etc/rc.conf"
   119           echo "to two *different* IP addresses bound to your host. STUN requires this."
   120         ) | %{l_rpmtool} msg -b -t notice
   121     fi
   123     #   after upgrade, restart service
   124     [ $1 -eq 2 ] || exit 0
   125     eval `%{l_rc} stun status 2>/dev/null`
   126     [ ".$stun_active" = .yes ] && %{l_rc} stun restart
   127     exit 0
   129 %preun
   130     #   before erase, stop service and remove log files
   131     [ $1 -eq 0 ] || exit 0
   132     %{l_rc} stun stop 2>/dev/null
   133     rm -f $RPM_INSTALL_PREFIX/var/stun/stun.pid >/dev/null 2>&1 || true
   134     exit 0

mercurial