]> git.llucax.com Git - software/libev.git/blob - import_libevent
5d9454103ea9acdce2a0d5a2e9fe058d56fc49f5
[software/libev.git] / import_libevent
1 #!/bin/sh
2
3 LE=../libevent-1.3e
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/epoll_sub.c .
27 cp $LE/evbuffer.c .
28 cp $LE/buffer.c .
29 cp $LE/evhttp.h .
30 cp $LE/http.c .
31 cp $LE/event_tagging.c .
32 cp $LE/http-internal.h .
33 cp $LE/strlcpy-internal.h .
34 cp $LE/log.c .
35 cp $LE/log.h .
36 cp $LE/strlcpy.c .
37 rsync -a $LE/WIN32* $LE/sample $LE/test $LE/compat . --del
38 rename 's/libevent/libev/' WIN32-Prj/lib*
39 cp $LE/aclocal.m4 .
40 cp $LE/acconfig.h .
41 cp $LE/config.h.in .
42 cp $LE/event_rpcgen.py .
43 cp $LE/*.3 .
44
45 perl -i -pe 's/libevent/libev/g' sample/Makefile.am
46 perl -i -pe 's/libevent/libev/g' test/Makefile.am
47
48 perl -i -pe 's/#include <event.h>$/#include "event.h"/' test/*.c
49
50 perl -i -ne '
51    next if /"event-internal.h"/;
52    s/base\d?->sig.ev_signal_added/0/;
53    s/base\d?->sig.ev_signal_pair\[0\]/-1/;
54    next if /test_signal_(dealloc|pipeloss|switchbase)\(\)/;
55    next if /test_priorities\(\d\)/;
56    print;
57 ' test/regress.c
58
59 perl -ne '
60    s/\bsignal.c\b//g;
61    s/\bevport.c\b//g;
62    s/\bkqueue.c\b//g;
63    s/\bdevpoll.c\b//g;
64    s/\brtsig.c\b//g;
65    s/\bselect.c\b//g;
66    s/\bpoll.c\b//g;
67    s/\bepoll.c\b//g;
68    s/\bepoll_sub.c\b//g;
69    s/\bevent-internal.h\b//g;
70    s/\bevsignal.h\b//g;
71    s/^(EXTRA_DIST\s*=\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_win32.c /;
72    s/^(include_HEADERS\s*=\s*)/$1 ev.h event_compat.h /;
73    s/^(libevent_la_SOURCES\s*=\s*)/$1 ev.c /;
74    s/^(libevent_la_LIBADD\s*=\s*)/$1 -lm /;
75    s/libevent/libev/g;
76    print;
77 ' <$LE/Makefile.am >Makefile.am
78
79 perl -ne '
80    s/libevent/libev/g;
81    s/AC_LIBOBJ\(select\)/: ;/g;
82    s/AC_LIBOBJ\(poll\)/: ;/g;
83    s/AC_LIBOBJ\(kqueue\)/: ;/g;
84    s/AC_LIBOBJ\(epoll\)/: ;/g;
85    s/AC_LIBOBJ\(devpoll\)/: ;/g;
86    s/AC_LIBOBJ\(evport\)/: ;/g;
87    s/AC_LIBOBJ\(signal\)/: ;/g;
88    s/AC_LIBOBJ\(rtsig\)/: ;/g;
89    print;
90 ' <$LE/configure.in >configure.in
91
92 aclocal-1.7
93 automake-1.7 --add-missing
94 autoconf
95 libtoolize
96 CC="ccache gcc" ./configure --prefix=/opt/libev --disable-shared "$@"
97
98