cras: Build from top level directory (#9649)

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
This commit is contained in:
Li-Yu Yu 2023-02-11 04:20:51 +08:00 committed by GitHub
parent 7192fb3a32
commit 429f1cf2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 12 deletions

View File

@ -43,14 +43,6 @@ RUN apt-get -y update && \
vim \ vim \
zip zip
RUN apt-get clean RUN apt-get clean
RUN cd /tmp && git clone https://github.com/ndevilla/iniparser.git && \
cd iniparser && \
make && \
cp libiniparser.* /usr/local/lib && \
cp src/dictionary.h src/iniparser.h /usr/local/include && \
chmod 644 /usr/local/include/dictionary.h /usr/local/include/iniparser.h && \
chmod 644 /usr/local/lib/libiniparser.a && \
chmod 755 /usr/local/lib/libiniparser.so.*
RUN cd /tmp && git clone https://github.com/google/googletest.git -b v1.8.x && \ RUN cd /tmp && git clone https://github.com/google/googletest.git -b v1.8.x && \
cd googletest && \ cd googletest && \
@ -73,5 +65,5 @@ RUN mkdir -p /tmp/alsa-build && cd /tmp/alsa-build && \
RUN cd $SRC && git clone https://chromium.googlesource.com/chromiumos/third_party/adhd RUN cd $SRC && git clone https://chromium.googlesource.com/chromiumos/third_party/adhd
WORKDIR adhd/cras WORKDIR adhd
COPY build.sh $SRC/ COPY build.sh $SRC/

View File

@ -26,7 +26,7 @@ export CARGO_BUILD_TARGET="x86_64-unknown-linux-gnu"
cargo build --release --target-dir=${WORK}/cargo_out cargo build --release --target-dir=${WORK}/cargo_out
cp ${WORK}/cargo_out/${CARGO_BUILD_TARGET}/release/libcras_rust.a /usr/local/lib cp ${WORK}/cargo_out/${CARGO_BUILD_TARGET}/release/libcras_rust.a /usr/local/lib
cd ${SRC}/adhd/cras cd ${SRC}/adhd
# Set bazel options. # Set bazel options.
# See also: # See also:
# https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/bazel_build_fuzz_tests # https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/bazel_build_fuzz_tests
@ -67,5 +67,25 @@ mv ${WORK}/build/fuzzer/* ${OUT}/
zip -j ${OUT}/rclient_message_corpus.zip ${SRC}/adhd/cras/src/fuzz/corpus/* zip -j ${OUT}/rclient_message_corpus.zip ${SRC}/adhd/cras/src/fuzz/corpus/*
cp "${SRC}/adhd/cras/src/fuzz/cras_hfp_slc.dict" "${OUT}/cras_hfp_slc.dict" cp "${SRC}/adhd/cras/src/fuzz/cras_hfp_slc.dict" "${OUT}/cras_hfp_slc.dict"
# Add *.rs soft link for coverage build
ln -s ${SRC}/adhd/cras/src/server/rust/src/* ${SRC} if [ "$SANITIZER" = "coverage" ]; then
echo "Collecting the repository source files for coverage tracking."
ln -s ${SRC}/adhd/cras/src/server/rust/src/* ${SRC}
declare -r COVERAGE_SOURCES="${OUT}/proc/self/cwd"
mkdir -p "${COVERAGE_SOURCES}"
declare -r RSYNC_FILTER_ARGS=(
"--include" "*.h"
"--include" "*.cc"
"--include" "*.hpp"
"--include" "*.cpp"
"--include" "*.c"
"--include" "*.inc"
"--include" "*/"
"--exclude" "*"
)
rsync -avLk "${RSYNC_FILTER_ARGS[@]}" \
"$(bazel info execution_root)/" \
"${COVERAGE_SOURCES}/"
fi