2021-10-26 07:18:13 -03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-04-20 17:07:06 -04:00
|
|
|
# Copyright (c) 2022 Alex313031.
|
2022-04-11 11:47:10 -04:00
|
|
|
|
2022-04-09 04:11:10 -04:00
|
|
|
YEL='\033[1;33m' # Yellow
|
2022-08-02 18:28:38 -04:00
|
|
|
CYA='\033[1;96m' # Cyan
|
2022-06-06 19:32:22 -04:00
|
|
|
RED='\033[1;31m' # Red
|
|
|
|
GRE='\033[1;32m' # Green
|
|
|
|
c0=$'\033[0m' # Reset Text
|
|
|
|
bold=$'\033[1m' # Bold Text
|
|
|
|
underline=$'\033[4m' # Underline Text
|
|
|
|
|
|
|
|
# Error handling
|
|
|
|
yell() { echo "$0: $*" >&2; }
|
|
|
|
die() { yell "$*"; exit 111; }
|
|
|
|
try() { "$@" || die "${RED}Failed $*"; }
|
2022-04-09 04:11:10 -04:00
|
|
|
|
2022-06-25 12:38:59 -04:00
|
|
|
# --help
|
|
|
|
displayHelp () {
|
|
|
|
printf "\n" &&
|
|
|
|
printf "${bold}${GRE}Script to copy Thorium source files over the Chromium source tree.${c0}\n" &&
|
2022-07-30 23:12:58 -04:00
|
|
|
printf "${bold}${YEL}Use the --mac flag for MacOS builds.${c0}\n" &&
|
2022-06-25 12:38:59 -04:00
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
--help) displayHelp; exit 0;;
|
|
|
|
esac
|
|
|
|
|
2022-04-09 04:11:10 -04:00
|
|
|
printf "\n" &&
|
|
|
|
printf "${YEL}Creating build output directory...\n" &&
|
|
|
|
tput sgr0 &&
|
|
|
|
|
2021-10-29 06:58:28 -03:00
|
|
|
mkdir -v -p $HOME/chromium/src/out/thorium/ &&
|
2022-04-09 04:11:10 -04:00
|
|
|
printf "\n" &&
|
|
|
|
|
2022-05-18 17:25:10 -04:00
|
|
|
printf "${YEL}Copying Thorium source files over the Chromium tree...\n" &&
|
2022-04-09 04:11:10 -04:00
|
|
|
tput sgr0 &&
|
2021-10-28 13:53:43 -03:00
|
|
|
|
2022-07-09 19:45:38 -04:00
|
|
|
cp -r -v src/BUILD.gn $HOME/chromium/src/ &&
|
|
|
|
cp -r -v src/ash/. $HOME/chromium/src/ash/ &&
|
|
|
|
cp -r -v src/build/. $HOME/chromium/src/build/ &&
|
|
|
|
cp -r -v src/chrome/. $HOME/chromium/src/chrome/ &&
|
|
|
|
cp -r -v src/components/. $HOME/chromium/src/components/ &&
|
|
|
|
cp -r -v src/extensions/. $HOME/chromium/src/extensions/ &&
|
|
|
|
cp -r -v src/content/. $HOME/chromium/src/content/ &&
|
|
|
|
cp -r -v src/media/. $HOME/chromium/src/media/ &&
|
|
|
|
cp -r -v src/net/. $HOME/chromium/src/net/ &&
|
|
|
|
cp -r -v src/sandbox/. $HOME/chromium/src/sandbox/ &&
|
|
|
|
cp -r -v src/third_party/. $HOME/chromium/src/third_party/ &&
|
|
|
|
cp -r -v src/tools/. $HOME/chromium/src/tools/ &&
|
|
|
|
cp -r -v src/ui/. $HOME/chromium/src/ui/ &&
|
|
|
|
cp -r -v src/v8/. $HOME/chromium/src/v8/ &&
|
2022-07-09 22:40:37 -04:00
|
|
|
cp -r -v thorium_shell/. $HOME/chromium/src/out/thorium/ &&
|
|
|
|
cp -r -v pak_src/bin/pak $HOME/chromium/src/out/thorium/ &&
|
|
|
|
cp -r -v pak_src/bin/pak-win/. $HOME/chromium/src/out/thorium/ &&
|
2021-10-26 07:18:13 -03:00
|
|
|
|
2022-07-06 23:45:32 -04:00
|
|
|
# Workaround for DevTools
|
2022-07-16 00:15:32 -04:00
|
|
|
mkdir -v -p $HOME/chromium/src/out/thorium/gen/third_party/devtools-frontend/src/front_end/Images/ &&
|
2022-07-09 19:46:35 -04:00
|
|
|
cp -r -v src/third_party/devtools-frontend/src/front_end/Images/src/chromeSelectDark.svg $HOME/chromium/src/out/thorium/gen/third_party/devtools-frontend/src/front_end/Images/ &&
|
2022-07-06 23:45:32 -04:00
|
|
|
|
2022-07-30 23:12:58 -04:00
|
|
|
# MacOS Widevine Workaround
|
|
|
|
copyMacOS () {
|
|
|
|
printf "\n" &&
|
|
|
|
printf "${YEL}Copying cdm_registration.cc for MacOS...${c0}\n" &&
|
|
|
|
cp -r -v infra/cdm_registration.cc $HOME/chromium/src/chrome/common/media/ &&
|
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
--mac) copyMacOS;
|
|
|
|
esac
|
|
|
|
|
2022-06-06 19:32:22 -04:00
|
|
|
printf "${GRE}Done!\n" &&
|
2022-04-09 04:11:10 -04:00
|
|
|
printf "\n" &&
|
|
|
|
|
|
|
|
printf "${YEL}Setting NINJA_SUMMARIZE_BUILD=1 and aliases to download the PGO Profiles for supported targets, and the gsync alias.\n" &&
|
2022-04-20 17:07:06 -04:00
|
|
|
|
|
|
|
export NINJA_SUMMARIZE_BUILD=1 &&
|
|
|
|
|
2022-04-22 15:37:47 -04:00
|
|
|
export EDITOR=nano &&
|
|
|
|
|
|
|
|
export VISUAL=nano &&
|
|
|
|
|
2022-05-09 04:06:08 -04:00
|
|
|
alias origin='git checkout -f origin/main' &&
|
|
|
|
|
|
|
|
alias rebase='git rebase-update' &&
|
|
|
|
|
2022-06-06 19:32:22 -04:00
|
|
|
alias args='gn args out/thorium' &&
|
2022-05-09 04:06:08 -04:00
|
|
|
|
|
|
|
alias gnls='gn ls out/thorium' &&
|
|
|
|
|
2022-04-20 17:07:06 -04:00
|
|
|
alias gsync='gclient sync --with_branch_heads --with_tags -f -R -D' &&
|
|
|
|
|
2022-05-09 04:06:08 -04:00
|
|
|
alias runhooks='gclient runhooks' &&
|
|
|
|
|
2022-04-20 17:07:06 -04:00
|
|
|
alias pgo='python3 tools/update_pgo_profiles.py --target=linux update --gs-url-base=chromium-optimization-profiles/pgo_profiles' &&
|
|
|
|
|
|
|
|
alias pgow='python3 tools/update_pgo_profiles.py --target=win64 update --gs-url-base=chromium-optimization-profiles/pgo_profiles' &&
|
|
|
|
|
|
|
|
alias pgom='python3 tools/update_pgo_profiles.py --target=mac update --gs-url-base=chromium-optimization-profiles/pgo_profiles' &&
|
|
|
|
|
2022-04-09 04:11:10 -04:00
|
|
|
printf "\n" &&
|
|
|
|
|
2022-05-18 17:25:10 -04:00
|
|
|
printf "${YEL}Dropping you to ~/chromium/src\n" &&
|
2022-04-09 04:11:10 -04:00
|
|
|
printf "\n" &&
|
|
|
|
|
|
|
|
printf "${YEL}Look in this file to see the aliases and what they're for.\n" &&
|
|
|
|
printf "\n" &&
|
|
|
|
|
2022-06-06 19:32:22 -04:00
|
|
|
printf "${GRE}Enjoy Thorium!\n" &&
|
2022-04-09 04:11:10 -04:00
|
|
|
printf "\n" &&
|
|
|
|
tput sgr0 &&
|
|
|
|
|
2022-06-06 19:32:22 -04:00
|
|
|
cd ~/chromium/src &&
|
2021-10-26 07:18:13 -03:00
|
|
|
|
|
|
|
exit 0
|