diff options
Diffstat (limited to 'other/analysis/gen-file.sh')
-rw-r--r-- | other/analysis/gen-file.sh | 116 |
1 files changed, 74 insertions, 42 deletions
diff --git a/other/analysis/gen-file.sh b/other/analysis/gen-file.sh index 710e20d7..89144eff 100644 --- a/other/analysis/gen-file.sh +++ b/other/analysis/gen-file.sh | |||
@@ -1,48 +1,80 @@ | |||
1 | CPPFLAGS="-DMIN_LOGGER_LEVEL=LOG_TRACE -Iauto_tests -Itoxcore -Itoxav -Itoxencryptsave `pkg-config --cflags libsodium opus vpx`" | 1 | #!/bin/sh |
2 | |||
3 | CPPFLAGS="$CPPFLAGS -DMIN_LOGGER_LEVEL=LOGGER_LEVEL_TRACE" | ||
4 | CPPFLAGS="$CPPFLAGS -isystem /usr/include/opus" | ||
5 | CPPFLAGS="$CPPFLAGS -Iauto_tests" | ||
6 | CPPFLAGS="$CPPFLAGS -Iother" | ||
7 | CPPFLAGS="$CPPFLAGS -Iother/bootstrap_daemon/src" | ||
8 | CPPFLAGS="$CPPFLAGS -Iother/fun" | ||
9 | CPPFLAGS="$CPPFLAGS -Itesting" | ||
10 | CPPFLAGS="$CPPFLAGS -Itoxcore" | ||
11 | CPPFLAGS="$CPPFLAGS -Itoxav" | ||
12 | CPPFLAGS="$CPPFLAGS -Itoxencryptsave" | ||
13 | |||
14 | LDFLAGS="$LDFLAGS -lopus -lsodium -lvpx -lpthread -lconfig" | ||
2 | 15 | ||
3 | put() { | 16 | put() { |
4 | if [ "$SKIP_LINES" = "" ]; then | 17 | if [ "$SKIP_LINES" = "" ]; then |
5 | echo "#line 1 \"$1\"" >> test.c | 18 | echo "#line 1 \"$1\"" >> amalgamation.cc |
19 | fi | ||
20 | cat $1 >> amalgamation.cc | ||
21 | } | ||
22 | |||
23 | putmain() { | ||
24 | echo "namespace $(echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g') {" >> amalgamation.cc | ||
25 | if [ "$SKIP_LINES" = "" ]; then | ||
26 | echo "#line 1 \"$1\"" >> amalgamation.cc | ||
6 | fi | 27 | fi |
7 | cat $1 >> test.c | 28 | sed -e 's/^int main(/static &/' $1 >> amalgamation.cc |
29 | echo "} // namespace $(echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g')" >> amalgamation.cc | ||
30 | } | ||
31 | |||
32 | callmain() { | ||
33 | echo " call($(echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g')::main, argc, argv);" >> amalgamation.cc | ||
8 | } | 34 | } |
9 | 35 | ||
10 | :> test.c | 36 | :> amalgamation.cc |
11 | 37 | ||
12 | put toxcore/tox.c | 38 | echo "#include <algorithm>" >> amalgamation.cc |
13 | 39 | echo "#include <cstdio>" >> amalgamation.cc | |
14 | put toxcore/DHT.c | 40 | echo "#include <memory>" >> amalgamation.cc |
15 | put toxcore/LAN_discovery.c | 41 | echo "#include <random>" >> amalgamation.cc |
16 | put toxcore/Messenger.c | 42 | |
17 | put toxcore/TCP_client.c | 43 | echo "#define TOX_DEFINED" >> amalgamation.cc |
18 | put toxcore/TCP_connection.c | 44 | echo "typedef struct Messenger Tox;" >> amalgamation.cc |
19 | put toxcore/TCP_server.c | 45 | |
20 | put toxcore/crypto_core.c | 46 | put auto_tests/check_compat.h |
21 | put toxcore/crypto_core_mem.c | 47 | |
22 | put toxcore/friend_connection.c | 48 | FIND_QUERY="find . '-(' -name '*.cc' -or -name '*.c' '-)'" |
23 | put toxcore/friend_requests.c | 49 | FIND_QUERY="$FIND_QUERY -and -not -wholename './super_donators/*'" |
24 | put toxcore/group.c | 50 | FIND_QUERY="$FIND_QUERY -and -not -wholename './toxav/*.cc'" |
25 | put toxcore/list.c | 51 | FIND_QUERY="$FIND_QUERY -and -not -wholename './toxcore/*.cc'" |
26 | put toxcore/logger.c | 52 | FIND_QUERY="$FIND_QUERY -and -not -wholename './toxencryptsave/*.cc'" |
27 | put toxcore/network.c | 53 | FIND_QUERY="$FIND_QUERY -and -not -name amalgamation.cc" |
28 | put toxcore/net_crypto.c | 54 | FIND_QUERY="$FIND_QUERY -and -not -name av_test.c" |
29 | put toxcore/onion.c | 55 | FIND_QUERY="$FIND_QUERY -and -not -name dht_test.c" |
30 | put toxcore/onion_announce.c | 56 | FIND_QUERY="$FIND_QUERY -and -not -name version_test.c" |
31 | put toxcore/onion_client.c | 57 | |
32 | put toxcore/ping.c | 58 | for i in $(eval $FIND_QUERY); do |
33 | put toxcore/ping_array.c | 59 | if ! grep -q '^int main(' $i; then |
34 | put toxcore/tox_api.c | 60 | put $i |
35 | put toxcore/util.c | 61 | fi |
36 | 62 | done | |
37 | # Not included yet, since there are too many issues with this code. | 63 | |
38 | #put toxav/audio.c | 64 | for i in $(eval $FIND_QUERY); do |
39 | #put toxav/bwcontroller.c | 65 | if grep -q '^int main(' $i; then |
40 | #put toxav/groupav.c | 66 | putmain $i |
41 | #put toxav/msi.c | 67 | fi |
42 | #put toxav/ring_buffer.c | 68 | done |
43 | #put toxav/rtp.c | 69 | |
44 | #put toxav/toxav.c | 70 | echo "static void call(int m(), int argc, char **argv) { m(); }" >> amalgamation.cc |
45 | #put toxav/toxav_old.c | 71 | echo "static void call(int m(int, char **), int argc, char **argv) { m(argc, argv); }" >> amalgamation.cc |
46 | #put toxav/video.c | 72 | |
47 | 73 | echo "int main(int argc, char **argv) {" >> amalgamation.cc | |
48 | put toxencryptsave/toxencryptsave.c | 74 | for i in $(eval $FIND_QUERY); do |
75 | if grep -q '^int main(' $i; then | ||
76 | callmain $i | ||
77 | fi | ||
78 | done | ||
79 | echo " return 0;" >> amalgamation.cc | ||
80 | echo "}" >> amalgamation.cc | ||