honeyd/honeyd.spec

changeset 602
6b1bca241155
parent 574
1074e5934dd9
child 671
f82939c12e5f
equal deleted inserted replaced
0:0e77e087468d 1:c3bc87604717
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE. 21 ## SUCH DAMAGE.
22 ## 22 ##
23 23
24 # package version 24 # package version
25 %define V_honeyd 1.5b 25 %define V_honeyd 1.5c
26 %define V_libdnsres 0.1a 26 %define V_libdnsres 0.1a
27 27
28 # package information 28 # package information
29 Name: honeyd 29 Name: honeyd
30 Summary: Creates a Virtual Host on Network 30 Summary: Creates a Virtual Host on Network
34 Distribution: OpenPKG Community 34 Distribution: OpenPKG Community
35 Class: EVAL 35 Class: EVAL
36 Group: Security 36 Group: Security
37 License: BSD 37 License: BSD
38 Version: %{V_honeyd} 38 Version: %{V_honeyd}
39 Release: 20080101 39 Release: 20120800
40 40
41 # package options 41 # package options
42 %option with_fsl yes 42 %option with_fsl yes
43 %option with_gui no 43 %option with_gui no
44 44
58 Source12: cdefs.h 58 Source12: cdefs.h
59 Source13: setenv.h 59 Source13: setenv.h
60 Source14: setenv.c 60 Source14: setenv.c
61 Source15: vasprintf.c 61 Source15: vasprintf.c
62 Source16: vasprintf.h 62 Source16: vasprintf.h
63 Source17: http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz 63 Source17: evbuffer.h
64 Source18: http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz
64 Patch0: honeyd.patch 65 Patch0: honeyd.patch
65 66
66 # build information 67 # build information
67 Prefix: %{l_prefix} 68 BuildPreReq: OpenPKG, openpkg >= 20100808, make
68 BuildRoot: %{l_buildroot} 69 PreReq: OpenPKG, openpkg >= 20100808
69 BuildPreReq: OpenPKG, openpkg >= 20060823, make
70 PreReq: OpenPKG, openpkg >= 20060823
71 BuildPreReq: libdnet, libpcap, libevent, libedit, zlib, pcre 70 BuildPreReq: libdnet, libpcap, libevent, libedit, zlib, pcre
72 PreReq: libdnet, libpcap, libevent, libedit, zlib, pcre 71 PreReq: libdnet, libpcap, libevent, libedit, zlib, pcre
73 %if "%{with_fsl}" == "yes" 72 %if "%{with_fsl}" == "yes"
74 BuildPreReq: fsl 73 BuildPreReq: fsl
75 PreReq: fsl 74 PreReq: fsl
76 %endif 75 %endif
77 %if "%{with_gui}" == "yes" 76 %if "%{with_gui}" == "yes"
78 PreReq: java, JAVA-JDK 77 PreReq: java, JAVA-JDK
79 %endif 78 %endif
80 AutoReq: no
81 AutoReqProv: no
82 79
83 %description 80 %description
84 Honeyd is a small daemon that creates virtual hosts on a network. 81 Honeyd is a small daemon that creates virtual hosts on a network.
85 The hosts can be configured to run arbitrary services, and their 82 The hosts can be configured to run arbitrary services, and their
86 TCP personality can be adapted so that they appear to be running 83 TCP personality can be adapted so that they appear to be running
105 regex = libdnsres-(__VER__)\.tar\.gz 102 regex = libdnsres-(__VER__)\.tar\.gz
106 } 103 }
107 104
108 %prep 105 %prep
109 %setup -q 106 %setup -q
110 %setup -q -D -T -a 17 107 %setup -q -D -T -a 18
111 %patch -p0 108 %patch -p0
112 %{l_shtool} subst \
113 -e 's;AF_LOCAL;AF_UNIX;' \
114 *.c
115 %{l_shtool} subst \
116 -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \
117 -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \
118 Makefile.in
119 cp -f %{SOURCE setenv.c} . 109 cp -f %{SOURCE setenv.c} .
120 cp -f %{SOURCE setenv.h} . 110 cp -f %{SOURCE setenv.h} .
121 cp -f %{SOURCE vasprintf.c} . 111 cp -f %{SOURCE vasprintf.c} .
122 cp -f %{SOURCE vasprintf.h} . 112 cp -f %{SOURCE vasprintf.h} .
113 cp -f %{SOURCE evbuffer.h} .
123 cp -f %{SOURCE cdefs.h} . 114 cp -f %{SOURCE cdefs.h} .
115 %{l_shtool} mkdir -f -p -m 755 libdnsres-%{V_libdnsres}/sys
116 cp -f %{SOURCE cdefs.h} libdnsres-%{V_libdnsres}/sys/
117 %{l_shtool} subst \
118 -e 's;AF_LOCAL;AF_UNIX;' \
119 *.c
120 %{l_shtool} subst \
121 -e 's;\(for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h net/bpf.h syslog.h unistd.h assert.h\);\1 sys/cdefs.h;' \
122 -e 's;\(for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid\) \(kqueue\);\1 setenv \2;' \
123 configure
124 %{l_shtool} subst \
125 -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \
126 -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \
127 Makefile.in
124 %{l_shtool} subst \ 128 %{l_shtool} subst \
125 -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \ 129 -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \
126 honeyd.h 130 honeyd.h
131 %{l_shtool} subst \
132 -e 's;\(encode_int\);loc_\1;g' \
133 tagging.[ch]
134 %{l_shtool} subst \
135 -e '/#include <event.h>/a#include "evbuffer.h"' \
136 honeydstats.c \
137 untagging.c \
138 ui.c
139 %{l_shtool} subst \
140 -e 's;flock(fd, [^)][^)]*);lockf(fd, F_LOCK, 0);g' \
141 subsystems/smtp.c
127 %{l_shtool} subst \ 142 %{l_shtool} subst \
128 -e 's/\(user_target=no\)/\1; pic_mode=no;/' \ 143 -e 's/\(user_target=no\)/\1; pic_mode=no;/' \
129 -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ 144 -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
130 -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ 145 -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
131 ltmain.sh 146 ltmain.sh
135 -e 's;-levent;-levent -lsocket -lnsl;g' \ 150 -e 's;-levent;-levent -lsocket -lnsl;g' \
136 configure 151 configure
137 %{l_shtool} subst \ 152 %{l_shtool} subst \
138 -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \ 153 -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \
139 Makefile.in 154 Makefile.in
155 %{l_shtool} subst \
156 -e 's;-lsocket;-lsocket -lnsl -lresolv;g' \
157 libdnsres-%{V_libdnsres}/configure
140 ;; 158 ;;
141 esac 159 esac
160 %{l_shtool} subst \
161 -e 's;#if \((!defined(BSD))\) || \((BSD < [0-9][0-9]*)\);#if (!defined(__sun)) \&\& (!defined(__SVR4)) \&\& \1 \&\& \2;' \
162 libdnsres-%{V_libdnsres}/dnsres.h \
163 libdnsres-%{V_libdnsres}/resolv.h
164 %{l_shtool} subst \
165 -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
166 libdnsres-%{V_libdnsres}/dnsres.h \
167 libdnsres-%{V_libdnsres}/resolv.h \
168 libdnsres-%{V_libdnsres}/res_random.c
169 %{l_shtool} subst \
170 -e 's;top_buildir;top_builddir;' \
171 -e 's;\(am_simple_test_OBJECTS = simple_test\.\$(OBJEXT)\);\1 arc4random.$(OBJEXT);' \
172 libdnsres-%{V_libdnsres}/Makefile.in
173 %{l_shtool} subst \
174 -e '/#include "config.h"/a#ifndef HAVE_ARC4RANDOM' \
175 libdnsres-%{V_libdnsres}/arc4random.c
176 echo '#endif' >>libdnsres-%{V_libdnsres}/arc4random.c
177 echo '#ifndef MIN' >>keycount.h
178 echo '#define MIN(a,b) (((a) < (b)) ? (a) : (b))' >>keycount.h
179 echo '#endif' >>keycount.h
142 180
143 %build 181 %build
144 ( cd libdnsres-%{V_libdnsres} 182 ( cd libdnsres-%{V_libdnsres}
183 loc_cppflags=
184 case "%{l_platform -t}" in
185 *-sunos* )
186 loc_cppflags="-D_KERNEL"
187 ;;
188 esac
145 CC="%{l_cc}" \ 189 CC="%{l_cc}" \
146 CFLAGS="%{l_cflags -O}" \ 190 CFLAGS="%{l_cflags -O}" \
147 CPPFLAGS="%{l_cppflags}" \ 191 CPPFLAGS="%{l_cppflags} $loc_cppflags" \
148 ./configure \ 192 ./configure \
149 --with-libevent=%{l_prefix} \ 193 --with-libevent=%{l_prefix} \
150 --disable-shared 194 --disable-shared
151 %{l_make} %{l_mflags} 195 %{l_make} %{l_mflags}
152 ln .libs/libdnsres.a .
153 ) || exit $? 196 ) || exit $?
154 CC="%{l_cc}" \ 197 CC="%{l_cc}" \
155 CFLAGS="%{l_cflags -O}" \ 198 CFLAGS="%{l_cflags -O}" \
156 CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \ 199 CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \
157 LDFLAGS="%{l_fsl_ldflags}" \ 200 LDFLAGS="%{l_fsl_ldflags}" \
161 --with-libevent=%{l_prefix} \ 204 --with-libevent=%{l_prefix} \
162 --with-libdnet=%{l_prefix} \ 205 --with-libdnet=%{l_prefix} \
163 --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \ 206 --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \
164 --with-libpcre=%{l_prefix} \ 207 --with-libpcre=%{l_prefix} \
165 --without-python 208 --without-python
166 %{l_make} %{l_mflags} 209 %{l_make} %{l_mflags -O}
167 210
168 %install 211 %install
169 rm -rf $RPM_BUILD_ROOT
170
171 # create directories 212 # create directories
172 %{l_shtool} mkdir -f -p -m 755 \ 213 %{l_shtool} mkdir -f -p -m 755 \
173 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 214 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
174 $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \ 215 $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \
175 $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \ 216 $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \
230 '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf' 271 '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf'
231 272
232 %files -f files 273 %files -f files
233 274
234 %clean 275 %clean
235 rm -rf $RPM_BUILD_ROOT
236 276
237 %pre 277 %pre
238 # before upgrade, save status and stop service 278 # before upgrade, save status and stop service
239 [ $1 -eq 2 ] || exit 0 279 [ $1 -eq 2 ] || exit 0
240 eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}` 280 eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}`

mercurial