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