Tue, 28 Aug 2012 18:28:20 +0200
Update version, modernize packaging, and slightly correct build configuration.
1 ##
2 ## tun.spec -- OpenPKG RPM Specification
3 ## Copyright (c) 2009 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: 20090106
41 # list of sources
42 Source0: http://vtun.sourceforge.net/tun/tun-%{version}.tar.gz
43 Patch0: tun.patch
45 # build information
46 Prefix: %{l_prefix}
47 BuildRoot: %{l_buildroot}
48 BuildPreReq: OpenPKG, openpkg >= 20050726, make
49 PreReq: OpenPKG, openpkg >= 20050726
50 AutoReq: no
51 AutoReqProv: no
53 %description
54 Tun provides packet reception and transmission for user space
55 programs. It can be viewed as a simple Point-to-Point device, which
56 instead of receiving packets from a physical media, receives them
57 from user space program and instead of sending packets via physical
58 media writes them to the user space program.
60 %track
61 prog tun = {
62 version = %{version}
63 url = http://vtun.sourceforge.net/tun/
64 regex = tun-(__VER__)\.tar\.gz
65 }
67 %prep
68 %setup -q -n tun-%{version}
69 %patch -p0
71 %build
72 CC="%{l_cc}" \
73 CFLAGS="%{l_cflags -O}" \
74 ./configure \
75 --prefix=%{l_prefix}
76 locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
77 ( cd $locplat
78 %{l_make} %{l_mflags -O}
79 ) || exit $?
81 %install
82 rm -rf $RPM_BUILD_ROOT
83 %{l_shtool} mkdir -f -p -m 755 \
84 $RPM_BUILD_ROOT%{l_prefix}/lib/tun
85 locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
86 ( cd $locplat
87 %{l_shtool} install -c -m 644 \
88 tun tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun
89 ) || exit $?
90 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
92 %files -f files
94 %clean
95 rm -rf $RPM_BUILD_ROOT
97 %post
98 if [ $1 -eq 1 -o $1 -eq 2 ]; then
99 # announce special nature of this package
100 ( echo "Attention: The special nature of the package contents require privileged"
101 echo "interation, and must be carefully copied and nonportably installed to"
102 echo "system areas outside of the OpenPKG instance."
103 echo ""
104 echo "This package therefore does not conform to basic OpenPKG principles, and"
105 echo "should be removed immediately after its short term utility is exhausted."
106 echo ""
107 echo "To complete the installation on a SVR4 style operating system:"
108 echo ""
109 echo " $ su -"
110 echo " # find %{l_prefix}/lib/tun/ -print"
111 echo " # shtool install -c -m 755 -o root -g sys tun /usr/kernel/drv/"
112 echo " # shtool install -c -m 644 -o root -g sys tun.conf /usr/kernel/drv/"
113 echo " # shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/"
114 echo " # /usr/sbin/rem_drv tun"
115 echo " # /usr/sbin/add_drv tun"
116 ) | %{l_rpmtool} msg -b -t notice
117 fi
118 exit 0
120 %postun
121 [ $1 -eq 0 ] || exit 0
122 # announce special nature of this package on uninstall
123 ( echo "Attention: The special nature of the package contents require privileged"
124 echo "interation, and must be carefully deleted and nonportably uninstalled"
125 echo "from system areas outside of the OpenPKG instance."
126 echo ""
127 echo " $ su -"
128 echo " # ls -ld /usr/kernel/drv/*tun* /usr/include/net/*tun*"
129 echo " # /usr/sbin/rem_drv tun"
130 echo " # ls -ld /usr/kernel/drv/*tun*"
131 echo " # ls -ld /usr/include/net/*tun*"
132 echo " # rm -f /usr/kernel/drv/tun"
133 echo " # rm -f /usr/kernel/drv/tun.conf"
134 echo " # rm -f /usr/include/net/if_tun.h"
135 ) | %{l_rpmtool} msg -b -t notice
136 exit 0