tun/tun.spec

Tue, 28 Aug 2012 18:34:20 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:34:20 +0200
changeset 567
c4b42a78297a
parent 387
33ae2d61c751
child 667
9dacbd1d1aa2
permissions
-rw-r--r--

Modernize packaging for forthcoming stack release.

     1 ##
     2 ##  tun.spec -- OpenPKG RPM Specification
     3 ##  Copyright (c) 2012 Michael Schloh von Bennewitz <michael@schloh.com>
     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 # MSvB Fixme: Device driver could possibly be stripped
    25 #    %{l_shtool} install -c -m -s 755 \
    26 #        tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    28 #   package information
    29 Name:         tun
    30 Summary:      Universal TUN/TAP Device Driver
    31 URL:          http://vtun.sourceforge.net/tun/
    32 Vendor:       Maxim Krasnyansky
    33 Packager:     Michael Schloh von Bennewitz
    34 Distribution: Europalab Networks Production
    35 Class:        EVAL
    36 Group:        Driver
    37 License:      GPL
    38 Version:      1.1
    39 Release:      20120800
    41 #   list of sources
    42 Source0:      http://vtun.sourceforge.net/tun/tun-%{version}.tar.gz
    43 Patch0:       tun.patch
    45 #   build information
    46 BuildPreReq:  OpenPKG, openpkg >= 20100101, make
    47 PreReq:       OpenPKG, openpkg >= 20100101
    49 %description
    50     Tun provides packet reception and transmission for user space       
    51     programs. It can be viewed as a simple Point-to-Point device, which 
    52     instead of receiving packets from a physical media, receives them   
    53     from user space program and instead of sending packets via physical 
    54     media writes them to the user space program.                        
    56 %track
    57     prog tun = {
    58         version   = %{version}
    59         url       = http://vtun.sourceforge.net/tun/
    60         regex     = tun-(__VER__)\.tar\.gz
    61     }
    63 %prep
    64     %setup -q -n tun-%{version}
    65     %patch -p0
    66     case "%{l_platform -t}" in
    67         *-sunos5.11 )
    68             %{l_shtool} subst \
    69                 -e 's;ddi_power\([ \t]*/\* devo_power \*/\);NULL\1;' \
    70                 -e 's;\(else if( (cmd == DDI_SUSPEND)\) || (cmd == DDI_PM_SUSPEND) );\1);' \
    71                 solaris/tun.c
    72             ;;
    73     esac
    75 %build
    76     CC="%{l_cc}" \
    77     CFLAGS="%{l_cflags -O}" \
    78     ./configure \
    79         --prefix=%{l_prefix}
    80     locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
    81     ( cd $locplat
    82       %{l_make} %{l_mflags -O}
    83     ) || exit $?
    85 %install
    86     %{l_shtool} mkdir -f -p -m 755 \
    87         $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    88     locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
    89     ( cd $locplat
    90       %{l_shtool} install -c -m 644 \
    91           tun tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    92     ) || exit $?
    93     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
    95 %files -f files
    97 %clean
    99 %post
   100     if [ $1 -eq 1 -o $1 -eq 2 ]; then
   101         #   announce special nature of this package
   102         ( echo "Attention: The special nature of the package contents require privileged"
   103           echo "interation, and must be carefully copied and nonportably installed to"
   104           echo "system areas outside of the OpenPKG instance."
   105           echo ""
   106           echo "This package therefore does not conform to basic OpenPKG principles, and"
   107           echo "should be removed immediately after its short term utility is exhausted."
   108           echo ""
   109           echo "To complete the installation on a SVR4 style operating system:"
   110           echo ""
   111           echo "  $ su -"
   112           echo "  # find %{l_prefix}/lib/tun/ -print"
   113           echo "  # shtool install -c -m 755 -o root -g sys tun /usr/kernel/drv/"
   114           echo "  # shtool install -c -m 644 -o root -g sys tun.conf /usr/kernel/drv/"
   115           echo "  # shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/"
   116           echo "  # /usr/sbin/rem_drv tun"
   117           echo "  # /usr/sbin/add_drv tun"
   118         ) | %{l_rpmtool} msg -b -t notice
   119     fi
   120     exit 0
   122 %postun
   123     [ $1 -eq 0 ] || exit 0
   124     #   announce special nature of this package on uninstall
   125     ( echo "Attention: The special nature of the package contents require privileged"
   126       echo "interation, and must be carefully deleted and nonportably uninstalled"
   127       echo "from system areas outside of the OpenPKG instance."
   128       echo ""
   129       echo "  $ su -"
   130       echo "  # ls -ld /usr/kernel/drv/*tun* /usr/include/net/*tun*"
   131       echo "  # /usr/sbin/rem_drv tun"
   132       echo "  # ls -ld /usr/kernel/drv/*tun*"
   133       echo "  # ls -ld /usr/include/net/*tun*"
   134       echo "  # rm -f /usr/kernel/drv/tun"
   135       echo "  # rm -f /usr/kernel/drv/tun.conf"
   136       echo "  # rm -f /usr/include/net/if_tun.h"
   137     ) | %{l_rpmtool} msg -b -t notice
   138     exit 0

mercurial