• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
2# Copyright 2020 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18# build ICU for linking statically.
19cd $SRC/icu/source
20./configure --disable-shared --enable-static --disable-layoutex \
21  --disable-tests --disable-samples --with-data-packaging=static
22make install -j$(nproc)
23
24# Ugly ugly hack to get static linking to work for icu.
25cd lib
26ls *.a | xargs -n1 ar x
27rm *.a
28ar r libicu.a *.{ao,o}
29ln -s $PWD/libicu.a /usr/lib/x86_64-linux-gnu/libicudata.a
30ln -s $PWD/libicu.a /usr/lib/x86_64-linux-gnu/libicuuc.a
31ln -s $PWD/libicu.a /usr/lib/x86_64-linux-gnu/libicui18n.a
32
33cd $SRC/hermes
34
35if [ "${SANITIZER}" = address ]
36then
37    CONFIGURE_FLAGS="--enable-asan"
38elif [ "${SANITIZER}" = undefined ]
39then
40    CONFIGURE_FLAGS="--enable-ubsan"
41else
42    CONFIGURE_FLAGS=""
43fi
44
45./utils/build/configure.py "${OUT}/build" --build-system "Ninja" ${CONFIGURE_FLAGS} \
46                           --cmake-flags="-DHERMES_USE_STATIC_ICU=ON -DHERMES_FUZZING_FLAG=${LIB_FUZZING_ENGINE} -DHERMES_ENABLE_LIBFUZZER=ON"
47cmake --build "$OUT/build"  --parallel --target fuzzer-jsi-entry
48cp "${OUT}/build/bin/fuzzer-jsi-entry" "${OUT}"
49