Skip to content

Commit 798048b

Browse files
committed
Added new build script\n
1 parent 6863555 commit 798048b

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

WebKitFuzz/build_webkitfuzz.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
3+
echo "[*] Building webkitfuzz."
4+
5+
export CC=/usr/bin/clang
6+
export CXX=/usr/bin/clang++
7+
8+
# -g flag for debugging symbols
9+
# -w to skip printing warnings
10+
# -Wfatal-error to immediately stop build with an error is detected
11+
export CFLAGS="-fsanitize=address -g -w -Wfatal-error"
12+
export CXXFLAGS="-fsanitize=address -g -w -Wfatal-error"
13+
export LDFLAGS="-fsanitize=address -g"
14+
export ASAN_OPTIONS="detect_leaks=0"
15+
16+
mkdir build
17+
cd build
18+
19+
echo "[*] webkitfuzz: running cmake"
20+
21+
# Explanation of cmake flags:
22+
# -DCMAKE_BULD_TYPE=Release -DPORT=GTK -- Build release build of WebKit GTK port
23+
#
24+
# -G "Unix Makefiles". Change to -G "Ninja" if you want to build with ninja
25+
#
26+
# -DCMAKE_INSTALL_PREFIX=. -DCMAKE_INSTALL_LIBEXECDIR=libexec/
27+
# -DLIB_INSTALL_DIR=lib/ -DCMAKE_SKIP_RPATCH=ON - Required to have all the build
28+
# files and libs end up in your build/ directory so webkitfuzz uses those files
29+
# instead of the default on your machine
30+
#
31+
# -DENABLE_SANITIZERS=address - Build with ASAN
32+
# -DENABLE_MINIBROWSER=ON - webkitfuzz uses minibrowser
33+
#
34+
# The rest turn off dependencies not needed for most fuzzing cases
35+
cmake -DCMAKE_BUILD_TYPE=Release -DPORT=GTK -G "Unix Makefiles" \
36+
-DCMAKE_INSTALL_PREFIX=. -DCMAKE_SKIP_RPATH=ON -DLIB_INSTALL_DIR=./lib \
37+
-DCMAKE_INSTALL_LIBEXECDIR=./libexec \
38+
-DENABLE_SANITIZERS=address \
39+
-DENABLE_MINIBROWSER=ON \
40+
-DUSE_LIBSECRET=OFF \
41+
-DENABLE_GEOLOCATION=OFF \
42+
-DENABLE_GTKDOC=OFF \
43+
-DENABLE_MEDIA_STREAM=OFF \
44+
-DENABLE_WEB_RTC=OFF \
45+
-DUSE_SOUP2=ON \
46+
-DUSE_WPE_RENDERER=OFF \
47+
-DUSE_SYSTEMD=OFF \
48+
-DENABLE_INTROSPECTION=OFF \
49+
-DENABLE_SPELLCHECK=OFF \
50+
-DUSE_LIBNOTIFY=OFF \
51+
-DUSE_LIBHYPHEN=OFF \
52+
-DUSE_WOFF2=OFF \
53+
-DUSE_JPEGXL=OFF \
54+
-DENABLE_THUNDER=OFF \
55+
-DENABLE_JOURNALD_LOG=OFF \
56+
..
57+
58+
# Calling make with <num cores>*2. Change based on your machine
59+
echo "[*]: Calling make -j $((`nproc`*2))"
60+
make -j$((`nproc`*2))
61+
62+
echo "[*] Finished make. Calling make install."
63+
make install
64+
65+
echo "[*] Finished! Run webkitfuzz from build/ directory."
66+
echo "[*] Command to run: ASAN_OPTIONS=detect_leaks=0,exitcode=42,log_path=asan_logs/ ASAN_SYMBOLIZER_PATH=</path/to/llvm-symbolizer> LD_LIBRARY_PATH=lib ./bin/webkitfuzz </path/to/sample> <timeout in sec>"

0 commit comments

Comments
 (0)