chromium-browser-stable-sla.../rosa.sh
2018-10-31 10:02:21 +03:00

64 lines
2.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Run this script after uploading the source code of a new version of Chromium
set -x
dir0="$(pwd)"
# $ env Ffmpeg_branding=ChromeOS Platform=%_arch BUILD=1 rosa.sh
Ffmpeg_branding="${Ffmpeg_branding:-ChromeOS}"
[ -z "$Platform" ] && Platform="$(uname -m)"
case "$Platform" in
x86_64 ) current_cpu='x64'; ffmpeg_cpu='x64' ;;
# from rpm --eval '%ix86'
i386 | i486 | i586 | i686 | i786 | i886 | i986 | pentium2 | pentium3 | pentium4 | k6 | athlon | athlon_xp ) current_cpu='x86'; ffmpeg_cpu='ia32' ;;
esac
if ! ls rosa.sh; then
echo "Error. This script must be ran from the root of Chromium sources!"
exit 1
fi
# third_party/ffmpeg is git-ignored in third_party/.gitignore
if grep -qE '^/ffmpeg$' third_party/.gitignore; then
sed -i third_party/.gitignore -e 's,^/ffmpeg$,,g'
fi
for i in 'libavcodec/autorename_libavcodec_hevcdec.c' 'libavformat/autorename_libavformat_hevc.c'
do
if ! grep -qE "$i" third_party/.gitignore; then
echo "/ffmpeg/${i}" >> third_party/.gitignore
fi
done
if [ "$BUILD" = '1' ]; then
# https://github.com/henrypp/chromium/blob/master/hevc_support_new.md
pushd third_party/ffmpeg
#chmod +x ./chromium/scripts/build_ffmpeg.py # not necessary, but to avoid errors
#./chromium/scripts/build_ffmpeg.py --branding="$Ffmpeg_branding" --config-only -- linux "$current_cpu"
/bin/cp libavcodec/hevcdec.c libavcodec/autorename_libavcodec_hevcdec.c
/bin/cp libavformat/hevc.c libavformat/autorename_libavformat_hevc.c
popd
pushd third_party/ffmpeg/chromium/config/${Ffmpeg_branding}/linux/${ffmpeg_cpu}/
for string in CONFIG_HEVC_DECODER CONFIG_HEVC_DEMUXER CONFIG_HEVC_PARSER
do
for file in config.asm config.h
do
if grep -q "$i" "$file"; then
sed -i "$file" -e "s/#define ${string} 0/#define ${string} 1/g"
fi
done
done
popd
sed_l(){
file=third_party/ffmpeg/chromium/config/${Ffmpeg_branding}/linux/${ffmpeg_cpu}/${3}/${1}_list.c
if ! grep -q '_hevc_' "$file"; then
sed -i "$file" -e "s/\&ff_${4}_${2},/\&ff_${4}_${2},\n \&ff_hevc_${2},/g"
fi
}
sed_l codec decoder libavcodec h264
sed_l parser parser libavcodec h264
sed_l demuxer demuxer libavformat matroska
fi