-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgen_prebuilt.sh
More file actions
executable file
·31 lines (25 loc) · 915 Bytes
/
gen_prebuilt.sh
File metadata and controls
executable file
·31 lines (25 loc) · 915 Bytes
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
29
30
31
#!/bin/sh
mkdir -p temp
# this script generates prebuilt headers
cat include/stacktrace_fwd.h \
include/detail/demangle/$3.h \
include/detail/stack/$1.h \
include/detail/decode/$2.h \
include/stacktrace.h \
include/code_position_exception.h \
include/stacktrace_exception.h > temp/out_1.h
sed -i -e 's/#include ".\+"//g' temp/out_1.h
sed -i -e 's/#include \w\+//g' temp/out_1.h
sed -i -e 's/#ifndef .\+//g' temp/out_1.h
sed -i -e 's/#endif//g' temp/out_1.h
sed -i -e 's/#define _.\+//g' temp/out_1.h
# build actual output
echo -e '#ifndef __STACKTRACE_SINGLE_HEADER__\n' > temp/out_2.h
echo -e '#define __STACKTRACE_SINGLE_HEADER__\n' >> temp/out_2.h
echo -e '#define MAX_CAPTURE_FRAMES 100\n' >> temp/out_2.h
cat temp/out_1.h >> temp/out_2.h
echo -e '#endif' >> temp/out_2.h
clang-format -i temp/out_2.h
dos2unix temp/out_2.h
cp temp/out_2.h prebuilt/$1_$2_$3.h
rm -rf temp