aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/sleuthkit/build.sh
blob: c6161409ba8e2a8e444b6970147b44e72b552e2e (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash -eu
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

export CFLAGS="$CFLAGS -Wno-error=non-c-typedef-for-linkage"
export CXXFLAGS="$CXXFLAGS -Wno-error=non-c-typedef-for-linkage"

# Disable error on all warnings
sed -i 's/-Werror//g' ./tsk/util/Makefile.am
sed -i 's/-Werror//g' ./tsk/pool/Makefile.am

# Dont fail if some of the seed downloads fail.
${SRC}/buildcorpus.sh || true

./bootstrap
./configure --enable-static --disable-shared --disable-java --without-afflib --without-libewf --without-libvhdi --without-libvmdk
make -j$(nproc)

declare -A TSK_FS_TYPES=(
  ["ext"]="TSK_FS_TYPE_EXT_DETECT"
  ["fat"]="TSK_FS_TYPE_FAT_DETECT"
  ["hfs"]="TSK_FS_TYPE_HFS"
  ["ntfs"]="TSK_FS_TYPE_NTFS"
  ["iso9660"]="TSK_FS_TYPE_ISO9660"
)

declare -A TSK_VS_TYPES=(
  ["dos"]="TSK_VS_TYPE_DOS"
  ["gpt"]="TSK_VS_TYPE_GPT"
  ["mac"]="TSK_VS_TYPE_MAC"
  ["sun"]="TSK_VS_TYPE_SUN"
)

# The fls APFS fuzz target has a seperate source file since it uses the libtsk
# pool layer.
$CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk \
    $SRC/sleuthkit_fls_apfs_fuzzer.cc -o $OUT/sleuthkit_fls_apfs_fuzzer \
    $LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a

for type in ${!TSK_FS_TYPES[@]}; do
  $CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk -DFSTYPE=${TSK_FS_TYPES[$type]} \
      $SRC/sleuthkit_fls_fuzzer.cc -o $OUT/sleuthkit_fls_${type}_fuzzer \
      $LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a
done

for type in ${!TSK_VS_TYPES[@]}; do
  $CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk -DVSTYPE=${TSK_VS_TYPES[$type]} \
      $SRC/sleuthkit_mmls_fuzzer.cc -o $OUT/sleuthkit_mmls_${type}_fuzzer \
      $LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a
done