forked from nekipelov/redisclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amalgamation.sh
executable file
·29 lines (22 loc) · 928 Bytes
/
amalgamation.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash -ex
AMALGAMATION_FILE_NAME=amalgamated/redisclient
HEADERS="src/redisclient/version.h \
src/redisclient/redisbuffer.h \
src/redisclient/redisvalue.h \
src/redisclient/redisparser.h \
src/redisclient/impl/redisclientimpl.h \
src/redisclient/redisasyncclient.h \
src/redisclient/redissyncclient.h"
echo > "$AMALGAMATION_FILE_NAME.h"
echo > "$AMALGAMATION_FILE_NAME.cpp"
for file in $HEADERS
do
cat "$file" >> "$AMALGAMATION_FILE_NAME.h"
done
find src -name '*.cpp' -print0 | sort -z | xargs -r0 cat >> "$AMALGAMATION_FILE_NAME.cpp"
sed -i 's|# *ifn\?def .*$||' "$AMALGAMATION_FILE_NAME.h"
sed -i 's|# *endif.*$||' "$AMALGAMATION_FILE_NAME.h"
sed -i 's|#include ".*$||' "$AMALGAMATION_FILE_NAME.h"
sed -i 's|#include ".*$||' "$AMALGAMATION_FILE_NAME.cpp"
sed -i 's|REDIS_CLIENT_DECL||' "$AMALGAMATION_FILE_NAME.h"
sed -i '1s|^|#include "redisclient.h"|' "$AMALGAMATION_FILE_NAME.cpp"