diff --git a/VERSION.sh b/VERSION.sh index 7f1c6170..0e890944 100755 --- a/VERSION.sh +++ b/VERSION.sh @@ -27,6 +27,15 @@ case $1 in --help) displayHelp; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + THOR_VER="114.0.5735.134" export THOR_VER && @@ -34,10 +43,10 @@ export THOR_VER && printf "\n" printf "${GRE}Current Thorium version is:${c0} ${underline}$THOR_VER${c0}\n" printf "\n" -printf "${RED}NOTE: ${YEL}Checking out${CYA} tags/$THOR_VER ${YEL}in $HOME/chromium/src...${c0}\n" +printf "${RED}NOTE: ${YEL}Checking out${CYA} tags/$THOR_VER ${YEL}in ${CR_SRC_DIR}...${c0}\n" printf "\n" -cd ~/chromium/src && +cd ${CR_SRC_DIR} && git checkout -f tags/$THOR_VER && @@ -47,12 +56,12 @@ git clean -ffd && cd ~/thorium && # Use our artifacts hash -cp -v src/build/vs_toolchain.py ~/chromium/src/build/ && +cp -v src/build/vs_toolchain.py ${CR_SRC_DIR}/build/ && # Add //third_party/libjxl to DEPS -cp -v thorium-libjxl/DEPS ~/chromium/src/ && +cp -v thorium-libjxl/DEPS ${CR_SRC_DIR}/ && -cd ~/chromium/src && +cd ${CR_SRC_DIR} && gclient sync --with_branch_heads --with_tags -f -R -D && diff --git a/build.sh b/build.sh index 9bc0e39c..7a42d973 100755 --- a/build.sh +++ b/build.sh @@ -33,7 +33,7 @@ printf "${CYA}\n" && # Build Thorium export NINJA_SUMMARIZE_BUILD=1 && -./depot_tools/autoninja -C ~/chromium/src/out/thorium chrome chrome_sandbox chromedriver clear_key_cdm thorium_shell -j$@ && +./depot_tools/autoninja -C ${CR_SRC_DIR}/out/thorium chrome chrome_sandbox chromedriver clear_key_cdm thorium_shell -j$@ && cat logos/thorium_logo_ascii_art.txt && diff --git a/build_android.sh b/build_android.sh index ed6e9eab..c2d10766 100644 --- a/build_android.sh +++ b/build_android.sh @@ -28,13 +28,22 @@ case $1 in --help) displayHelp; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && printf "${YEL}Building Thorium for Android...\n" && printf "${YEL}Note: You may want ADB installed.${c0}\n" && printf "${CYA}\n" && # Workaround for branding dir -cd $HOME/chromium/src && +cd ${CR_SRC_DIR} && rm -v -r -f chrome/android/java/res_base/drawable-v26/ic_launcher.xml && rm -v -r -f chrome/android/java/res_base/drawable-v26/ic_launcher_round.xml && rm -v -r -f chrome/android/java/res_chromium_base/mipmap-mdpi/layered_app_icon_background.png && @@ -54,9 +63,9 @@ buildARM32 () { # Build Thorium for ARM32 export NINJA_SUMMARIZE_BUILD=1 && -./depot_tools/autoninja -C ~/chromium/src/out/thorium chrome_public_apk content_shell_apk system_webview_apk -j$@ && +./depot_tools/autoninja -C ${CR_SRC_DIR}/out/thorium chrome_public_apk content_shell_apk system_webview_apk -j$@ && # ADD # thorium_shell_apk -mv ~/chromium/src/out/thorium/apks/ChromePublic.apk ~/chromium/src/out/thorium/apks/Thorium_Public_arm32.apk && +mv ${CR_SRC_DIR}/out/thorium/apks/ChromePublic.apk ${CR_SRC_DIR}/out/thorium/apks/Thorium_Public_arm32.apk && cat logos/thorium_logo_ascii_art.txt && @@ -71,9 +80,9 @@ esac # Build Thorium for ARM64 export NINJA_SUMMARIZE_BUILD=1 && # ADD # thorium_shell_apk -./depot_tools/autoninja -C ~/chromium/src/out/thorium content_shell_apk chrome_public_apk -j$@ && +./depot_tools/autoninja -C ${CR_SRC_DIR}/out/thorium content_shell_apk chrome_public_apk -j$@ && -mv ~/chromium/src/out/thorium/apks/ChromePublic.apk ~/chromium/src/out/thorium/apks/Thorium_Public_arm64.apk && +mv ${CR_SRC_DIR}/out/thorium/apks/ChromePublic.apk ${CR_SRC_DIR}/out/thorium/apks/Thorium_Public_arm64.apk && cat logos/thorium_logo_ascii_art.txt && diff --git a/build_dmg.sh b/build_dmg.sh index 416549ce..f02dd4c5 100755 --- a/build_dmg.sh +++ b/build_dmg.sh @@ -15,11 +15,20 @@ yell() { echo "$0: $*" >&2; } die() { yell "$*"; exit 111; } try() { "$@" || die "${RED}Failed $*"; } +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && printf "${YEL}Building .dmg of Thorium...\n" && printf "${CYA}\n" && -cd ~/chromium/src && +cd ${CR_SRC_DIR} && # Fix file attr xattr -csr out/thorium/Thorium.app && @@ -32,5 +41,5 @@ chrome/installer/mac/pkg-dmg --sourcefile --source out/thorium/Thorium.app --tar cat logos/apple_ascii_art.txt && -printf "${GRE}.DMG Build Completed. ${YEL}Installer at \'//out/thorium/Thorium*_MacOS.dmg\'\n" && +printf "${GRE}.DMG Build Completed. ${YEL}Installer at \'//chromium/src/out/thorium/Thorium*_MacOS.dmg\'\n" && tput sgr0 diff --git a/build_mac.sh b/build_mac.sh index b5077937..e684f680 100755 --- a/build_mac.sh +++ b/build_mac.sh @@ -36,7 +36,7 @@ buildShell () { # Build Thorium export NINJA_SUMMARIZE_BUILD=1 && - ./depot_tools/autoninja -C ~/chromium/src/out/thorium chrome chromedriver thorium_shell -j$@ && + ./depot_tools/autoninja -C ${CR_SRC_DIR}/out/thorium chrome chromedriver thorium_shell -j$@ && cat logos/thorium_logo_ascii_art.txt && @@ -47,6 +47,15 @@ case $1 in --build-shell) buildShell; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && printf "${YEL}Building Thorium for MacOS...\n" && printf "${CYA}\n" && @@ -54,7 +63,7 @@ printf "${CYA}\n" && # Build Thorium export NINJA_SUMMARIZE_BUILD=1 && -./depot_tools/autoninja -C ~/chromium/src/out/thorium chrome chromedriver thorium_shell -j$@ && +./depot_tools/autoninja -C ${CR_SRC_DIR}/out/thorium chrome chromedriver -j$@ && cat logos/thorium_logo_ascii_art.txt && diff --git a/clean.sh b/clean.sh index 92fe60a5..af409633 100755 --- a/clean.sh +++ b/clean.sh @@ -28,11 +28,20 @@ case $1 in --help) displayHelp; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && printf "${YEL}Cleaning up build artifacts...\n" && printf "${RED}\n" && -cd ~/chromium/src/out/thorium && +cd ${CR_SRC_DIR}/out/thorium && rm -r -f -v pyproto && rm -r -f -v obj && @@ -46,8 +55,8 @@ rm -r -f -v etc && rm -r -f -v clang_newlib_x64 && rm -r -f -v thinlto-cache && rm -r -f -v fontconfig_caches && -find ~/chromium/src/out/thorium -name "*deps*" -delete && -find ~/chromium/src/out/thorium -name "*TOC*" -delete && +find ${CR_SRC_DIR}/out/thorium -name "*deps*" -delete && +find ${CR_SRC_DIR}/out/thorium -name "*TOC*" -delete && printf "${GRE}Done cleaning artifacts.\n" && tput sgr0 diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 729d0593..e38e6770 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -1,9 +1,9 @@ -# Checking out and building Thorium on Linux   +# Checking out and building Thorium on Linux   There are instructions for other platforms here in the Thorium Docs directory. -You can also read the [old building instructions](https://github.com/Alex313031/Thorium/blob/main/infra/BUILDING.md). +You can also read the [old building instructions](https://github.com/Alex313031/thorium/blob/main/infra/BUILDING.md). #### Windows -For Windows and Windows [AVX2](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2), I made new dedicated instructions. If you are building on Windows use [BUILDING_WIN.md](https://github.com/Alex313031/Thorium/blob/main/docs/BUILDING_WIN.md) and if you are building for Windows on Linux, use [WIN_CROSS_BUILD_INSTRUCTIONS](https://github.com/Alex313031/Thorium/blob/main/docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt) +For Windows and Windows [AVX2](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2), I made new dedicated instructions. If you are building on Windows use [BUILDING_WIN.md](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING_WIN.md) and if you are building for Windows on Linux, use [WIN_CROSS_BUILD_INSTRUCTIONS](https://github.com/Alex313031/thorium/blob/main/docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt) ## System Requirements @@ -42,13 +42,7 @@ $ export PATH="$PATH:${HOME}/depot_tools" or $ export PATH="$PATH:/home/alex/dep Clone the Thorium repo into *$HOME* ```shell -$ git clone https://github.com/Alex313031/Thorium.git -``` - -Then, make the `set_exec.sh` script executable and run it (this will set all the other scripts in the repo as executable). - -```shell -$ chmod +x set_exec.sh && ./set_exec.sh +$ git clone https://github.com/Alex313031/thorium.git ``` ### Chromium Code @@ -117,16 +111,19 @@ $ gclient runhooks *Optional*: You can also [build with API keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your -build to talk to some Google services like Google Sync, Translate, and GeoLocation.   Thorium has its own keys in a private repository, if you are a builder or would like access to them, contact me. Otherwise, for personal or development builds, +build to talk to some Google services like Google Sync, Translate, and GeoLocation.   Thorium has its own keys in a private repository, if you are a builder or would like access to them, contact me. Otherwise, for personal or development builds, you can create your own keys and add yourself to [google-browser-signin-testaccounts](https://groups.google.com/u/1/a/chromium.org/g/google-browser-signin-testaccounts) to enable Sync. ## Setting up the build -First, we need to run `trunk.sh` (in the root of the Thorium repo.) This will Rebase/Sync the Chromium repo, and revert it to stock Chromium. +First, we need to run `./trunk.sh` (in the root of the Thorium repo.) This will Rebase/Sync the Chromium repo, and revert it to stock Chromium. \ It should be used before every seperate build. See the [Updating](#updating) section. -This will update and sync the sources and at the end it will download the [PGO profiles](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/pgo.md) for Chromium for all platforms. The file will be downloaded to *//chromium/src/chrome/build/pgo_profiles/*.profdata* with the actual file name looking something like 'chrome-linux-main-1632505958-ddbb37bcdfa7dbd7b10cf3a9b6a5bc45e7a958a6.profdata', which should be added to the end of args.gn as per below. +__IMPORTANT__ +This will update and sync the sources to the latest revision (tip of tree) and ensure you have all the version tags. + +- Then, to check out the current Chromium revision that Thorium is using, run `./VERSION.sh`. At the end it will download the [PGO profiles](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/pgo.md) for Chromium for all platforms. The file will be downloaded to *//chromium/src/chrome/build/pgo_profiles/*.profdata* with the actual file name looking something like 'chrome-linux-main-1632505958-ddbb37bcdfa7dbd7b10cf3a9b6a5bc45e7a958a6.profdata', which should be added to the end of args.gn as per below. - Then, (from where you cloned this repo) run `./setup.sh`. This will copy all the files and patches to the needed locations and drop you to *//chromium/src*. - NOTE: To build for MacOS, use `./setup.sh --mac`. To build for Raspberry Pi, use `./setup.sh --raspi`. @@ -134,9 +131,9 @@ Chromium and Thorium use [Ninja](https://ninja-build.org) as their main build to a tool called [GN](https://gn.googlesource.com/gn/+/refs/heads/main/README.md) to generate `.ninja` files in the build output directory. You can create any number of *build directories* with different configurations. To create a build directory: -- Run `gn args out/thorium` and the contents of '[args.gn](https://github.com/Alex313031/Thorium/blob/main/args.gn)' in the root of this repo should be copy/pasted into the editor. Note that for Windows, Mac, ChromiumOS, or Android there are seperate *_args.gn files for those platforms. *--Include your api keys here at the top or leave blank, and edit the last line to point to the actual path and file name of '*.profdata'* -- For more info about args.gn, read the [ABOUT_GN_ARGS.md](https://github.com/Alex313031/Thorium/blob/main/infra/DEBUG/ABOUT_GN_ARGS.md) file. -- '[infra/args.list](https://github.com/Alex313031/Thorium/blob/main/infra/args.list)' contains an alphabetical list with descriptions of all possible build arguments; [gn_args.list](https://github.com/Alex313031/Thorium/blob/main/infra/gn_args.list) gives a similar list but with the flags in args.gn added. +- Run `gn args out/thorium` and the contents of '[args.gn](https://github.com/Alex313031/thorium/blob/main/args.gn)' in the root of this repo should be copy/pasted into the editor. Note that for Windows, Mac, ChromiumOS, or Android there are seperate *_args.gn files for those platforms. *--Include your api keys here at the top or leave blank, and edit the last line to point to the actual path and file name of '*.profdata'* +- For more info about args.gn, read the [ABOUT_GN_ARGS.md](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/ABOUT_GN_ARGS.md) file. +- '[infra/args.list](https://github.com/Alex313031/thorium/blob/main/infra/args.list)' contains an alphabetical list with descriptions of all possible build arguments; [gn_args.list](https://github.com/Alex313031/thorium/blob/main/infra/gn_args.list) gives a similar list but with the flags in args.gn added. You can list all the possible build arguments and pipe it to a text file by running: @@ -148,7 +145,7 @@ $ gn args out/thorium --list >> /path/to/ARGS.list update the build files as needed. * You can replace *thorium* with another name, but it should be a subdirectory of *out*. Note that if you choose another name, the `trunk.sh` and `build.sh` scripts will not work. -* For information on the args.gn that Thorium uses, see [ABOUT_GN_ARGS.md](https://github.com/Alex313031/Thorium/blob/main/docs/ABOUT_GN_ARGS.md). +* For information on the args.gn that Thorium uses, see [ABOUT_GN_ARGS.md](https://github.com/Alex313031/thorium/blob/main/docs/ABOUT_GN_ARGS.md). * For other build arguments, including release settings, see [GN build configuration](https://www.chromium.org/developers/gn-build-configuration). The default will be a vanilla Chromium debug component build matching the current host @@ -188,8 +185,7 @@ working directories going at once. ## Build Thorium -Build Thorium (the "chrome" target), as well as [chrome_sandbox](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/sandboxing.md), [chromedriver](https://chromedriver.chromium.org/home), and [thorium_shell](https://github.com/Alex313031/Thorium/tree/main/thorium_shell#readme) (based on [content_shell](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/testing/web_tests_in_content_shell.md#as-a-simple-browser) ), using the `build.sh` -in the root of the Thorium repo (where the # is the number of jobs): +Build Thorium (the "chrome" target), as well as [chrome_sandbox](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/sandboxing.md), [chromedriver](https://chromedriver.chromium.org/home), and [thorium_shell](https://github.com/Alex313031/thorium/tree/main/thorium_shell#readme) (based on [content_shell](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/testing/web_tests_in_content_shell.md#as-a-simple-browser) ), using the `build.sh` script in the root of the Thorium repo (where the # is the number of jobs): ```shell $ ./build.sh 8 @@ -202,7 +198,7 @@ $ autoninja -C ~/chromium/src/out/thorium chrome chrome_sandbox chromedriver tho ``` `autoninja` is a wrapper that automatically provides optimal values for the -arguments passed to `ninja`. `build.sh` uses a [custom autoninja](https://github.com/Alex313031/Thorium/blob/main/depot_tools/autoninja) in the *depot_tools* directory in Thorium. +arguments passed to `ninja`. `build.sh` uses a [custom autoninja](https://github.com/Alex313031/thorium/blob/main/depot_tools/autoninja) in the *depot_tools* directory in Thorium. You can get a list of all of the other build targets from GN by running `gn ls out/thorium` from the command line. To compile one, pass the GN label to Ninja @@ -216,7 +212,7 @@ Once it is built, you can simply run the browser: ```shell $ out/thorium/thorium ``` -**RECOMMENDED** *- Copy and run [clean.sh](https://github.com/Alex313031/Thorium/blob/main/clean.sh) within this dir to clean up build artifacts.* +**RECOMMENDED** *- Copy and run [clean.sh](https://github.com/Alex313031/thorium/blob/main/clean.sh) within this dir to clean up build artifacts.* ## Installing Thorium @@ -227,12 +223,12 @@ run `thordeb.sh` (where the # is the number of jobs) in the root of the repo: $ ./thordeb.sh 8 ``` To make an appimage, copy the .deb to `//thorium/infra/APPIMAGE/` -and follow the [Instructions](https://github.com/Alex313031/Thorium/blob/main/infra/APPIMAGE/README.md#instructions) therein. +and follow the [Instructions](https://github.com/Alex313031/thorium/blob/main/infra/APPIMAGE/README.md#instructions) therein. ### Tests See the [Debugging](#debugging) section below, as well as -[Thorium UI Debug Shell](https://github.com/Alex313031/Thorium/blob/main/infra/DEBUG/DEBUG_SHELL_README.md). +[Thorium UI Debug Shell](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/DEBUG_SHELL_README.md). Learn about [how to use Chromedriver](https://chromedriver.chromium.org/getting-started) and Google Test at its [GitHub page](https://github.com/google/googletest). @@ -252,11 +248,11 @@ $ ./trunk.sh * Information about [building with Clang](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/clang.md). * You may want to [use a chroot](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/linux/using_a_chroot.md) to isolate yourself from versioning or packaging conflicts. -* Cross-compiling for ARM? (Raspberry Pi) See the [Thorium ARM](https://github.com/Alex313031/Thorium/tree/main/arm#readme) dir and [chromium_arm.md](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/linux/chromium_arm.md). +* Cross-compiling for ARM? (Raspberry Pi) See the [Thorium ARM](https://github.com/Alex313031/thorium/tree/main/arm#readme) dir and [chromium_arm.md](https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/linux/chromium_arm.md). * [Atom](https://atom.io/) and [Geany](https://www.geany.org/) are reccomended IDEs for working on Thorium. ### Debugging -* See the [Thorium DEBUG](https://github.com/Alex313031/Thorium/tree/main/infra/DEBUG#readme) dir, including the [More Info](https://github.com/Alex313031/Thorium/blob/main/infra/DEBUG/README.md#more-info-) section, and [DEBUGGING.md](https://github.com/Alex313031/Thorium/blob/main/infra/DEBUG/DEBUGGING.md). +* See the [Thorium DEBUG](https://github.com/Alex313031/thorium/tree/main/infra/DEBUG#readme) dir, including the [More Info](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/README.md#more-info-) section, and [DEBUGGING.md](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/DEBUGGING.md). ## Notes for other distros @@ -324,4 +320,4 @@ You can install the deps by doing a dry run of `emerge www-client/chromium`. --------------------------------- *Happy Thorium Building!* - + diff --git a/docs/BUILDING_WIN.md b/docs/BUILDING_WIN.md index cef933e6..346eaa1e 100644 --- a/docs/BUILDING_WIN.md +++ b/docs/BUILDING_WIN.md @@ -1,4 +1,4 @@ -# Checking out and Building Thorium for Windows   +# Checking out and Building Thorium for Windows   ## System Requirements @@ -7,7 +7,7 @@ * At least 75GB of free disk space on an NTFS-formatted hard drive. FAT32 will not work, as some of the Git packfiles are larger than 4GB. * An appropriate version of Visual Studio, as described below. -* Windows 10 1709 or newer. +* Windows 10 1809 or newer. ## Setting up Windows @@ -155,7 +155,7 @@ cd src *Optional*: You can also [build with API keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your -build to talk to some Google services like Google Sync, Translate, and GeoLocation.   Thorium has its own keys in a private repository, if you are a builder or would like access to them, contact me. Otherwise, for personal or development builds, +build to talk to some Google services like Google Sync, Translate, and GeoLocation.   Thorium has its own keys in a private repository, if you are a builder or would like access to them, contact me. Otherwise, for personal or development builds, you can create your own keys and add yourself to [google-browser-signin-testaccounts](https://groups.google.com/u/1/a/chromium.org/g/google-browser-signin-testaccounts) to enable Sync. @@ -165,14 +165,15 @@ You can either use git clone, or download a .zip from the repo. It should be pla Using Git: ```shell -git clone https://github.com/Alex313031/Thorium.git +git clone https://github.com/Alex313031/thorium.git ``` -Or download the .zip (Make sure to rename the extracted dir to just Thorium, not Thorium-main). -[https://github.com/Alex313031/Thorium/archive/refs/heads/main.zip](https://github.com/Alex313031/Thorium/archive/refs/heads/main.zip) +Or download the .zip (Make sure to rename the extracted dir to just thorium, not thorium-main). +[https://github.com/Alex313031/thorium/archive/refs/heads/main.zip](https://github.com/Alex313031/thorium/archive/refs/heads/main.zip) ## Setting up the build -First, we need to copy the Thorium source files over the Chromium tree. +First, we need to check out the revision that Chromium is currently using. For this, run `version.bat`. \ +Secondly, we need to copy the Thorium source files over the Chromium tree. \ Run the `setup.bat` script in *Thorium\win_scripts* to automate this. ```shell @@ -197,7 +198,7 @@ gn args out\thorium ``` This will open up notepad.exe, and this is where we will specify build arguments ("args") which direct Ninja on how to lay out the build directory tree. -We will be copy/pasting the contents of the [win_args.gn](https://github.com/Alex313031/Thorium/blob/main/infra/win_args.gn) file (from *C:\src\Thorium\infra\win_args.gn*) into notepad. +We will be copy/pasting the contents of the [win_args.gn](https://github.com/Alex313031/thorium/blob/main/infra/win_args.gn) file (from *C:\src\Thorium\infra\win_args.gn*) into notepad. Notice the three lines at the top, related to API Keys. It is fine to leave them blank, or add the ones you have made. \ __At the bottom__, though, notice the line that says *pgo_data_path = ""*. This is where we will put the full path to the PGO profile data file we downloaded earlier. @@ -205,13 +206,13 @@ That line should look something like: `pgo_data_path = "C:\src\chromium\src\chrome\build\pgo_profiles\chrome-win64-main-1659409120-058034bd778fed227d12a29fd0edd0942810dbf8.profdata"` -* For other build arguments, and what the ones that Thorium uses do, see [ABOUT_GN_ARGS.md](https://github.com/Alex313031/Thorium/blob/main/infra/DEBUG/ABOUT_GN_ARGS.md) & [win_args.list](https://github.com/Alex313031/Thorium/blob/main/infra/win_args.list) +* For other build arguments, and what the ones that Thorium uses do, see [ABOUT_GN_ARGS.md](https://github.com/Alex313031/thorium/blob/main/infra/DEBUG/ABOUT_GN_ARGS.md) & [win_args.list](https://github.com/Alex313031/thorium/blob/main/infra/win_args.list) * For more info on GN, run `gn help` on the command line or read the [quick start guide](https://gn.googlesource.com/gn/+/main/docs/quick_start.md). ## Build Thorium -Build Thorium, and the other things like [chromedriver](https://chromedriver.chromium.org/home) and [thorium_shell](https://github.com/Alex313031/Thorium/tree/main/thorium_shell#readme) with Ninja using the command: +Build Thorium, and the other things like [chromedriver](https://chromedriver.chromium.org/home) and [thorium_shell](https://github.com/Alex313031/thorium/tree/main/thorium_shell#readme) with Ninja using the command: ```shell autoninja -C out\thorium chrome chromedriver thorium_shell setup mini_installer -j8 @@ -254,4 +255,4 @@ git pull origin main *Happy Thorium Building!* - + diff --git a/docs/BUILDING_WIN_CROSS.md b/docs/BUILDING_WIN_CROSS.md index d56d72e0..ed8dd918 100644 --- a/docs/BUILDING_WIN_CROSS.md +++ b/docs/BUILDING_WIN_CROSS.md @@ -1,4 +1,4 @@ -# Cross-Compiling Thorium for Windows on Linux   +# Cross-Compiling Thorium for Windows on Linux   As many Thorium developers are on Linux/Mac, cross-compiling Thorium for Windows targets facilitates development for Windows targets on non-Windows @@ -23,8 +23,10 @@ report crashes, and NaCl defaults to disabled and cannot be enabled in cross builds ([.asm bug](https://crbug.com/762167)). ## Setup -First make sure you've followed the instructions for getting the Chromium and Thorium code from [HERE](https://github.com/Alex313031/Thorium/blob/main/docs/BUILDING.md#get-the-code). \ -Also make sure you have run `setup.sh` to copy the Thorium code over the Chromium tree. +First make sure you've followed the instructions for getting the Chromium and Thorium code from [HERE](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING.md#get-the-code). + +__IMPORTANT__ +Also make sure you have run `./trunk.sh` , `./VERSION.sh` ,and `./setup.sh` to setup and copy the Thorium code over the Chromium tree as per [HERE](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING.md#setting-up-the-build). ## *.gclient* setup @@ -39,7 +41,7 @@ Also make sure you have run `setup.sh` to copy the Thorium code over the Chromiu ] target_os = ['linux', 'win'] -2. Run a `trunk.sh`, and follow instructions on screen. +2. Run `./trunk.sh`, and follow instructions on screen. ### Installing the MSVS Artifacts Archive @@ -70,7 +72,7 @@ setting `DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL` and running `gclient runhooks`: ### Generating a MSVS Artifacts Archive yourself -After installing [Microsoft's development tools](https://github.com/Alex313031/Thorium/blob/main/docs/BUILDING_WIN.md#visual-studio), +After installing [Microsoft's development tools](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING_WIN.md#visual-studio), you can package your Windows SDK installation into a zip file by running the following on a Windows machine in cmd.exe: ```shell @@ -92,11 +94,11 @@ when it was released, and this is what you would use, e.g. 10.0.20348.0 These commands create a zip file named `.zip`, which can be used with the instructions above ^. ## Building -Follow [Setting up the build](https://github.com/Alex313031/Thorium/blob/main/docs/BUILDING.md#setting-up-the-build), except instead of using the `args.gn` from the -root of the Thorium repo, use the [`win_args.gn`](https://github.com/Alex313031/Thorium/blob/main/infra/win_args.gn), from *~/Thorium/infra/* +Follow [Setting up the build](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING.md#setting-up-the-build), except instead of using the `args.gn` from the +root of the Thorium repo, use the [`win_args.gn`](https://github.com/Alex313031/thorium/blob/main/infra/win_args.gn), from *~/Thorium/infra/* -Then, to build, run `build_win.sh`, instead of `build.sh`. See > [Here](https://github.com/Alex313031/Thorium/blob/main/docs/BUILDING.md#build-thorium-). +Then, to build, run `./build_win.sh`, instead of `./build.sh`. See > [Here](https://github.com/Alex313031/thorium/blob/main/docs/BUILDING.md#build-thorium-). *Happy Thorium Building!* - + diff --git a/infra/build_dmg_cr.sh b/infra/build_dmg_cr.sh index 854ed33a..d47b15a4 100644 --- a/infra/build_dmg_cr.sh +++ b/infra/build_dmg_cr.sh @@ -1,22 +1,34 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031 and Midzer. +# Copyright (c) 2023 Alex313031 and Midzer. YEL='\033[1;33m' # Yellow +CYA='\033[1;96m' # Cyan 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 +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 $*"; } +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && printf "${YEL}Building .dmg of Chromium...\n" && -printf "${GRE}\n" && +printf "${CYA}\n" && + +cd ${CR_SRC_DIR} && # Fix file attr xattr -csr out/thorium/Chromium.app && @@ -26,6 +38,8 @@ codesign --force --deep --sign - out/thorium/Chromium.app && # Build dmg package chrome/installer/mac/pkg-dmg --sourcefile --source out/thorium/Chromium.app --target "out/thorium/Chromium_MacOS.dmg" --volname Chromium --symlink /Applications:/Applications --format UDBZ --verbosity 2 && - -printf "${GRE}.DMG Build Completed. ${YEL}Installer at //out/thorium/Chromium*.dmg\n" && + +cat logos/apple_ascii_art.txt && + +printf "${GRE}.DMG Build Completed. ${YEL}Installer at //chromium/src/out/thorium/Chromium*.dmg\n" && tput sgr0 diff --git a/infra/build_polly.sh b/infra/build_polly.sh index 5ba09663..3143ece5 100755 --- a/infra/build_polly.sh +++ b/infra/build_polly.sh @@ -19,7 +19,7 @@ try() { "$@" || die "${RED}Failed $*"; } # --help displayHelp () { - cd ~/chromium/src && + cd ${CR_SRC_DIR} && python3 tools/clang/scripts/build.py --help && printf "\n" && printf "${bold}${GRE}Script to clone the latest LLVM being used by the Chromium Project, and builds a local ${c0}\n" && @@ -30,26 +30,33 @@ displayHelp () { printf "${bold}${YEL}Use the --version flag to show version, and --help to show help.${c0}\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + # --version displayVersion () { - cd ~/chromium/src && + cd ${CR_SRC_DIR} && printf "\n" && python3 tools/clang/scripts/build.py --version && printf "\n" } - case $1 in --version) displayVersion; exit 0;; esac # Build with PGO buildPollyPGO () { - cd ~/chromium/src && + cd ${CR_SRC_DIR} && printf "${GRE}Building LLVM and Polly using PGO...${c0}\n" && printf "\n" @@ -63,7 +70,6 @@ buildPollyPGO () { tput sgr0 } - case $1 in --pgo) buildPollyPGO; exit 0;; esac @@ -77,7 +83,7 @@ printf "${bold}${YEL}Use the --verbose or -v flag to make Ninja show verbose com printf "${bold}${YEL}Use the --version flag to show version, and --help to show help.${c0}\n" && printf "\n" -cd ~/chromium/src && +cd ${CR_SRC_DIR} && printf "${GRE}Building LLVM and Polly...${c0}\n" && printf "\n" diff --git a/reset_depot_tools.sh b/reset_depot_tools.sh index b875cec3..6621c876 100755 --- a/reset_depot_tools.sh +++ b/reset_depot_tools.sh @@ -28,6 +28,15 @@ case $1 in --help) displayHelp; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && printf "${YEL}Removing depot_tools, etc...${c0}\n" && tput sgr0 && diff --git a/setup.sh b/setup.sh index 8a5eee69..730b189e 100755 --- a/setup.sh +++ b/setup.sh @@ -36,7 +36,7 @@ esac # chromium/src dir env variable if [ -z "${CR_DIR}" ]; then - CR_SRC_DIR="${CR_SRC_DIR}" + CR_SRC_DIR="$HOME/chromium/src" export CR_SRC_DIR else CR_SRC_DIR="${CR_DIR}" diff --git a/thordeb.sh b/thordeb.sh index 204e586e..5cb42d62 100755 --- a/thordeb.sh +++ b/thordeb.sh @@ -18,7 +18,7 @@ try() { "$@" || die "${RED}Failed $*"; } # --help displayHelp () { printf "\n" && - printf "${bold}${GRE}Script to build Thorium .deb package on Linux.${c0}\n" && + printf "${bold}${GRE}Script to build Thorium .deb and .rpm packages on Linux.${c0}\n" && printf "${underline}${YEL}Usage: ${c0}thordeb.sh # (where # is number of jobs)\n" && printf "\n" } @@ -26,14 +26,23 @@ case $1 in --help) displayHelp; exit 0;; esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + printf "\n" && -printf "${YEL}Building Thorium .deb package...\n" && +printf "${YEL}Building Thorium .deb & .rpm packages...\n" && printf "${CYA}\n" && # Build debian package export NINJA_SUMMARIZE_BUILD=1 && -./depot_tools/autoninja -C ~/chromium/src/out/thorium "chrome/installer/linux:stable_deb" -j$@ && +./depot_tools/autoninja -C ${CR_SRC_DIR}/out/thorium "chrome/installer/linux:stable_deb" "chrome/installer/linux:stable_rpm" -j$@ && -printf "${GRE}Done! ${YEL}Installer at \'//out/thorium/thorium*.deb\'\n" && +printf "${GRE}Done! ${YEL}Installers at \'//out/thorium/thorium*.deb\' and \'//out/thorium/thorium*.rpm\'\n" && tput sgr0 diff --git a/trunk.sh b/trunk.sh index f4ed25a6..bdb03423 100755 --- a/trunk.sh +++ b/trunk.sh @@ -23,141 +23,18 @@ displayHelp () { printf "${bold}${YEL}the Chromium repo with the --no-history flag.${c0}\n" && printf "\n" } - -# --Shallow sync -gsyncShallow () { - printf "\n" && - printf "${bold}${GRE}Running with the --shallow flag.${c0}\n" && - printf "\n" && - printf "${YEL}Rebasing/Syncing (with a depth of 1) and running hooks...\n" && - tput sgr0 && - - cd $HOME/chromium/src/v8/ && - - git checkout -f origin/main && - - cd $HOME/chromium/src/third_party/devtools-frontend/src && - - git checkout -f origin/main && - - cd $HOME/chromium/src/third_party/ffmpeg && - - git checkout -f origin/master && - - cd $HOME/chromium/src && - - rm -v -f $HOME/chromium/src/components/neterror/resources/images/default_100_percent/offline/favicon-16x16.png && - - rm -v -f $HOME/chromium/src/components/neterror/resources/images/default_200_percent/offline/favicon-32x32.png && - - rm -v -f $HOME/chromium/src/content/shell/app/thorium_shell.ico && - - rm -v -f $HOME/chromium/src/chrome/browser/thorium_flag_entries.h && - - rm -v -f $HOME/chromium/src/chrome/browser/thorium_flag_choices.h && - - rm -v -r -f $HOME/chromium/src/third_party/pak && - rm -v -r -f $HOME/chromium/src/third_party/widevine/CREDITS.chromium && - - rm -r -f -v chrome/browser/bromite_flag_choices.h && - rm -r -f -v chrome/browser/bromite_flag_entries.h && - rm -r -f -v chrome/browser/ungoogled_flag_choices.h && - rm -r -f -v chrome/browser/ungoogled_flag_entries.h && - rm -r -f -v chrome/browser/ungoogled_platform_flag_choices.h && - rm -r -f -v chrome/browser/ungoogled_platform_flag_entries.h && - rm -r -f -v components/ungoogled/ && - rm -r -f -v net/url_request/trk_protocol_handler.cc && - rm -r -f -v net/url_request/trk_protocol_handler.h && - - rm -r -f -v chrome/browser/BUILD.gn.rej && - rm -r -f -v chrome/browser/browser_process.h.rej && - rm -r -f -v chrome/browser/browser_process_impl.cc.rej && - rm -r -f -v chrome/browser/browser_process_impl.h.rej && - rm -r -f -v chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc.rej && - rm -r -f -v chrome/browser/chrome_content_browser_client.cc.rej && - rm -r -f -v chrome/browser/component_updater/file_type_policies_component_installer.cc.rej && - rm -r -f -v chrome/browser/download/chrome_download_manager_delegate.cc.rej && - rm -r -f -v chrome/browser/download/download_item_model.cc.rej && - rm -r -f -v chrome/browser/download/download_prefs.cc.rej && - rm -r -f -v chrome/browser/download/download_target_determiner.cc.rej && - rm -r -f -v chrome/browser/extensions/api/downloads/downloads_api.cc.rej && - rm -r -f -v chrome/browser/extensions/api/downloads/downloads_api.h.rej && - rm -r -f -v chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc.rej && - rm -r -f -v chrome/browser/extensions/api/webstore_private/webstore_private_api.cc.rej && - rm -r -f -v chrome/browser/extensions/blocklist_state_fetcher.cc.rej && - rm -r -f -v chrome/browser/extensions/blocklist_state_fetcher.h.rej && - rm -r -f -v chrome/browser/metrics/chrome_metrics_service_client.cc.rej && - rm -r -f -v chrome/browser/net/trial_comparison_cert_verifier_controller.cc.rej && - rm -r -f -v chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc.rej && - rm -r -f -v chrome/browser/profiles/profile_impl.cc.rej && - rm -r -f -v chrome/browser/profiles/profiles_state.cc.rej && - rm -r -f -v chrome/browser/safe_browsing/BUILD.gn.rej && - rm -r -f -v chrome/browser/ssl/security_state_tab_helper.cc.rej && - rm -r -f -v chrome/browser/ui/BUILD.gn.rej && - rm -r -f -v chrome/browser/ui/tab_helpers.cc.rej && - rm -r -f -v chrome/browser/ui/webui/downloads/downloads_dom_handler.cc.rej && - rm -r -f -v chrome/browser/ui/webui/downloads/downloads_dom_handler.h.rej && - rm -r -f -v chrome/browser/ui/webui/interstitials/interstitial_ui.cc.rej && - rm -r -f -v chrome/renderer/chrome_content_renderer_client.cc.rej && - rm -r -f -v components/security_interstitials/content/cert_report_helper.cc.rej && - rm -r -f -v chrome/browser/safe_browsing/safe_browsing_dummy.cc && - - git checkout -f origin/main && - - git rebase-update --current && - - # Use our artifacts hash - cd $HOME/thorium && - cp -v src/build/vs_toolchain.py $HOME/chromium/src/build/ && - cd $HOME/chromium/src && - - gclient sync -R -D --no-history --shallow && - - gclient runhooks && - - printf "\n" && - printf "${GRE}Done! ${YEL}You can now run \'./VERSION.sh\'\n" - tput sgr0 && - - c0='\033[0m' # Reset Text - c1='\033[0m\033[36m\033[1m' # Light Cyan - c2='\033[0m\033[1;31m' # Light Red - c3='\033[0m\033[37m' # Light Grey - c4='\033[0m\033[1;34m\033[1m' # Light Blue - c5='\033[0m\033[1;37m' # White - c6='\033[0m\033[1;34m' # Dark Blue - c7='\033[1;32m' # Green - - printf "\n" && - printf "${c4} .,:loool:,. \n" && - printf "${c4} .,coooooooooooooc,. \n" && - printf "${c4} .,lllllllllllllllllllll,. \n" && - printf "${c4} ;ccccccccccccccccccccccccc; \n" && - printf "${c1} ,${c4}ccccccccccccccccccccccccccccc. \n" && - printf "${c1} ,oo${c4}c::::::::ok${c5}00000${c3}OOkkkkkkkkkkk: \n" && - printf "${c1} .ooool${c4};;;;:x${c5}K0${c6}kxxxxxk${c5}0X${c3}K0000000000. \n" && - printf "${c1} :oooool${c4};,;O${c5}K${c6}ddddddddddd${c5}KX${c3}000000000d \n" && - printf "${c1} lllllool${c4};l${c5}N${c6}dllllllllllld${c5}N${c3}K000000000 \n" && - printf "${c1} lllllllll${c4}o${c5}M${c6}dccccccccccco${c5}W${c3}K000000000 \n" && - printf "${c1} ;cllllllllX${c5}X${c6}c:::::::::c${c5}0X${c3}000000000d \n" && - printf "${c1} .ccccllllllO${c5}Nk${c6}c;,,,;cx${c5}KK${c3}0000000000. \n" && - printf "${c1} .cccccclllllxO${c5}OOOO0${c1}kx${c3}O0000000000; \n" && - printf "${c1} .:ccccccccllllllllo${c3}O0000000OOO, \n" && - printf "${c1} ,:ccccccccclllcd${c3}0000OOOOOOl. \n" && - printf "${c1} .::ccccccccc${c3}dOOOOOOOkx:. \n" && - printf "${c1} ..,::cccc${c3}xOOOkkko;. \n" && - printf "${c1} ..::${c3}dOkkxl:. \n" && - printf "\n" - printf "${c7} Long Live Chromium\041\n${c0}\n" -} - case $1 in --help) displayHelp; exit 0;; esac -case $1 in - --shallow) gsyncShallow; exit 0;; -esac +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi printf "\n" && printf "${bold}${GRE}Script to Rebase/Sync Chromium repo on Linux.${c0}\n" && @@ -165,32 +42,32 @@ printf "\n" && printf "${YEL}Rebasing/Syncing and running hooks...\n" && tput sgr0 && -cd $HOME/chromium/src/v8/ && +cd ${CR_SRC_DIR}/v8/ && git checkout -f origin/main && -cd $HOME/chromium/src/third_party/devtools-frontend/src && +cd ${CR_SRC_DIR}/third_party/devtools-frontend/src && git checkout -f origin/main && -cd $HOME/chromium/src/third_party/ffmpeg && +cd ${CR_SRC_DIR}/third_party/ffmpeg && git checkout -f origin/master && -cd $HOME/chromium/src && +cd ${CR_SRC_DIR} && -rm -v -f $HOME/chromium/src/components/neterror/resources/images/default_100_percent/offline/favicon-16x16.png && +rm -v -f ${CR_SRC_DIR}/components/neterror/resources/images/default_100_percent/offline/favicon-16x16.png && -rm -v -f $HOME/chromium/src/components/neterror/resources/images/default_200_percent/offline/favicon-32x32.png && +rm -v -f ${CR_SRC_DIR}/components/neterror/resources/images/default_200_percent/offline/favicon-32x32.png && -rm -v -f $HOME/chromium/src/content/shell/app/thorium_shell.ico && +rm -v -f ${CR_SRC_DIR}/content/shell/app/thorium_shell.ico && -rm -v -f $HOME/chromium/src/chrome/browser/thorium_flag_entries.h && +rm -v -f ${CR_SRC_DIR}/chrome/browser/thorium_flag_entries.h && -rm -v -f $HOME/chromium/src/chrome/browser/thorium_flag_choices.h && +rm -v -f ${CR_SRC_DIR}/chrome/browser/thorium_flag_choices.h && -rm -v -r -f $HOME/chromium/src/third_party/pak && -rm -v -r -f $HOME/chromium/src/third_party/widevine/CREDITS.chromium && +rm -v -r -f ${CR_SRC_DIR}/third_party/pak && +rm -v -r -f ${CR_SRC_DIR}/third_party/widevine/CREDITS.chromium && rm -r -f -v chrome/browser/bromite_flag_choices.h && rm -r -f -v chrome/browser/bromite_flag_entries.h && @@ -246,8 +123,8 @@ git fetch --tags && # Use our artifacts hash cd $HOME/thorium && -cp -v src/build/vs_toolchain.py $HOME/chromium/src/build/ && -cd $HOME/chromium/src && +cp -v src/build/vs_toolchain.py ${CR_SRC_DIR}/build/ && +cd ${CR_SRC_DIR} && gclient sync --with_branch_heads --with_tags -f -R -D &&