]> git.llucax.com Git - software/libev.git/blob - import_libevent
minor kqueue optimisation
[software/libev.git] / import_libevent
1 #!/bin/sh
2
3 LE=../libevent-1.4.0-beta
4
5 cp $LE/evdns.h .
6
7 perl -ne '
8    s/\s+char buf\[64\];/\tchar buf[96];/;
9    if (/#include "event.h"/) {
10       print "#ifndef EV_STANDALONE\n$_#endif\n";
11       next;
12    }
13    if (/#include "misc.h"/) {
14       print "#ifndef EV_STANDALONE\n$_#endif\n";
15       next;
16    }
17    if (/#include "(unistd.h|sys\/time.h)"/) {
18       print "#ifndef WIN32\n$_#endif\n";
19       next;
20    }
21    next if /#include "log.h"/;
22
23    print;
24 ' <$LE/evdns.c >evdns.c
25
26 cp $LE/autogen.sh .
27 cp $LE/epoll_sub.c .
28 cp $LE/evbuffer.c .
29 cp $LE/buffer.c .
30 cp $LE/evhttp.h .
31 cp $LE/evutil.h .
32 cp $LE/evutil.c .
33 cp $LE/event-config.h .
34 cp $LE/event-internal.h .
35 cp $LE/evrpc.h .
36 cp $LE/evrpc.c .
37 cp $LE/evrpc-internal.h .
38 cp $LE/http.c .
39 cp $LE/event_tagging.c .
40 cp $LE/http-internal.h .
41 cp $LE/strlcpy-internal.h .
42 cp $LE/log.c .
43 cp $LE/log.h .
44 cp $LE/strlcpy.c .
45 rsync -a $LE/WIN32* $LE/sample $LE/test $LE/compat . --del
46 rename 's/libevent/libev/' WIN32-Prj/lib*
47 cp $LE/aclocal.m4 .
48 #cp $LE/acconfig.h .
49 cp $LE/config.h.in .
50 cp $LE/event_rpcgen.py .
51 cp $LE/*.3 .
52
53 perl -i -pe 's/libevent/libev/g' sample/Makefile.am
54 perl -i -pe 's/libevent/libev/g' test/Makefile.am
55
56 perl -i -pe 's/#include <event.h>$/#include "event.h"/' test/*.c
57
58 perl -i -ne '
59    next if /"event-internal.h"/;
60    s/base\d?->sig.ev_signal_added/0/;
61    s/base\d?->sig.ev_signal_pair\[0\]/-1/;
62    s/base->sig.evsignal_caught/0/;
63    next if /^\ttest_signal_(dealloc|pipeloss|switchbase|assert|restore)\(\)/;
64    next if /^\ttest_simplesignal\(\)/; # non-default-loop
65    next if /^\ttest_immediatesignal\(\)/; # non-default-loop
66    next if /test_priorities\(\d\)/;
67    print;
68 ' test/regress.c
69
70 perl -ne '
71    s/\bmin_heap.h\b//g;
72    s/\bsignal.c\b//g;
73    s/\bevport.c\b//g;
74    s/\bkqueue.c\b//g;
75    s/\bdevpoll.c\b//g;
76    s/\brtsig.c\b//g;
77    s/\bselect.c\b//g;
78    s/\bpoll.c\b//g;
79    s/\bepoll.c\b//g;
80    s/\bepoll_sub.c\b//g;
81    s/\bevent-internal.h\b//g;
82    s/\bevsignal.h\b//g;
83    s/-Wall//;
84    s/^(man_MANS\s*=)/$1 ev.3 /;
85    s/^(EXTRA_DIST\s*=)/$1 ev.h ev_vars.h ev_wrap.h event_compat.h ev_epoll.c ev_select.c ev_poll.c ev_kqueue.c ev_port.c ev_win32.c ev.3 ev.pod ev.html /;
86    s/^(include_HEADERS\s*=)/$1 ev.h event_compat.h /;
87    s/^(CORE_SRC\s*=)/$1 ev.c /;
88    s/^(SYS_LIBS\s*=)/$1 -lm /;
89    s/libevent/libev/g;
90    print;
91 ' <$LE/Makefile.am >Makefile.am
92
93 perl -ne '
94    s/libevent/libev/g;
95    s/AC_LIBOBJ\(select\)/: ;/g;
96    s/AC_LIBOBJ\(poll\)/: ;/g;
97    s/AC_LIBOBJ\(kqueue\)/: ;/g;
98    s/AC_LIBOBJ\(epoll\)/: ;/g;
99    s/AC_LIBOBJ\(devpoll\)/: ;/g;
100    s/AC_LIBOBJ\(evport\)/: ;/g;
101    s/AC_LIBOBJ\(signal\)/: ;/g;
102    s/AC_LIBOBJ\(rtsig\)/: ;/g;
103    print;
104 ' <$LE/configure.in >configure.in
105
106 aclocal-1.7
107 automake-1.7 --add-missing
108 autoconf
109 libtoolize
110 CC="ccache gcc" ./configure --prefix=/opt/libev --disable-shared "$@"
111
112