2

After building chromium from source, you can create a "mini installer" for Windows by running

ninja -C out\BuildFolder mini_installer

This works fine and creates a mini_installer.exe in out\BuildFolder.

see Chromium - How to make an actual installer out of mini_installer.exe for more details.

But after running mini_installer.exe, the application ignores my branding and grd resource customizations.

It is supposed to use "IDS_PRODUCT_NAME_BASE" which I have definitely customized.

Here are the files I applied my branding in:

  • chrome\app\chromium_strings.grd
  • chrome\app\settings_chromium_strings.grdp
  • chrome\app\theme\chromium\BRANDING

But it seems to be ignoring them.

  • The program is installed in C:\Program Files (x86)\Chromium instead of C:\Program Files (x86)\CustomProductName
  • The executable is still named chrome.exe instead of CustomProductName.exe

How does one customize that?

Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152
  • What version of Chromium are you working on right now? And in your ``BuildFolder``, do you see ``chrome.exe`` or ``CustomProductName.exe``? – Asesh May 12 '18 at 15:17

1 Answers1

4

Branding won't change the name of generated executable files. You should modify src\chrome\BUILD.gn to change the name from chrome.exe to CustomProductName.exe as specified below:

if (is_win) {
action("reorder_imports") {
script = "//build/win/reorder-imports.py"

# See comment in chrome_dll.gypi in the hardlink_to_output
# target for why this cannot be 'initial' like the DLL.
inputs = [
  "$root_out_dir/initialexe/CustomProductName.exe",
]
outputs = [
  "$root_out_dir/CustomProductName.exe",
]
if (symbol_level != 0) {
  outputs += [ "$root_out_dir/CustomProductName.exe.pdb" ]
}
... later in the file ...
chrome_binary("chrome_initial") {
  if (is_win) {
    output_name = "initialexe/CustomProductName"

Doing so will generate CustomProductName.exe instead of Chrome.exe in your BuildFolder. After that, you should notify mini installer too by modifying this file: src\chrome\installer\mini_installer\BUILD.gn:

action(archive_name) {
script = "//chrome/tools/build/win/create_installer_archive.py"

release_file = "chrome.release"

inputs = [
  "$chrome_dll_file",
  "$root_out_dir/CustomProductName.exe",
  "$root_out_dir/locales/en-US.pak",
  "$root_out_dir/setup.exe",
  "//chrome/tools/build/win/makecab.py",
  release_file,
]

Those changes will only change the name of executable files. You will have to modify source code to reflect those changes too.

Assign the name of your browser executable in this file: src\chrome\installer\util\util_constants.cc

const wchar_t kChromeExe[] = L"CustomProductName.exe";

The path to installation folder should be specified in this file: src\chrome\install_static\chromium_install_modes.cc

const wchar_t kCompanyPathName[] = L"CompanyName";

const wchar_t kProductPathName[] = L"CustomProductName";

Similarly, you will have to change company name and app name in this file too: src\chrome\installer\util\browser_distribution.cc. I am not sure if the current version of Chromium still uses data from BrowserDistribution class.

Let me know if it works. I just went through our repo history to find out those changes.

UPDATE:

The comments reveal a couple more places:

Open chrome_elf/BUILD.gn and change here:

$root_out_dir/CustomProductName.exe

And change here: chrome/installer/mini_installer/chrome.release

CustomProductName.exe: %(ChromeDir)s\

And change here: build/win/reorder-imports.py

input_image = os.path.join(input_dir, 'CustomProductName.exe')
output_image = os.path.join(output_dir, 'CustomProductName.exe')
... later on in the file ...
for fname in glob.iglob(os.path.join(input_dir, 'CustomProductName.exe.*')):
Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152
Asesh
  • 3,186
  • 2
  • 21
  • 31
  • This change probably requires a full clean right? I got `The file: //out/CustomProductName/initialexe/CustomProductName.exe is listed as an input or source for the target: //chrome:reorder_imports but no targets in the build generate that file.` but i'm guessing that is due to a need to clean – Nicholas DiPiazza May 13 '18 at 16:50
  • @NicholasDiPiazza You don't have to clean. ``ninja`` should automatically detect changes to ``BUILD.gn`` and then generate ``CustomProductName.exe``. Isn't that file generated when you use this command: ``ninja -C out\BuildFolder chrome``. That command should build your browser executable file w/o building mini installer – Asesh May 14 '18 at 05:54
  • Yeah even the `gn gen out/CustomProductName "--args=is_debug=false"` throws that error now. there must be a .gn file missing a change somewhere. haven't had much time to track it down but i'll dig in when i can and see if i can find it – Nicholas DiPiazza May 14 '18 at 06:12
  • You don't have to tell ``gn`` to ``gen`` again. You should have run the usual build command instead: ``ninja -C out\BuildFolder mini_installer, it will automatically detect changes and start compiling again. – Asesh May 14 '18 at 07:09
  • Yeah sorry i meant to mention - i tried that. All ninja commands stop working after making the changes here with the error `The file: //out/CustomProductName/initialexe/CustomProductName.exe is listed as an input or source for the target: //chrome:reorder_imports but no targets in the build generate that file.` – Nicholas DiPiazza May 14 '18 at 07:13
  • Looks like you will have to modify ``chrome_elf/BUILD.gn`` and change here: ``"$root_out_dir/CustomProductName.exe",`` and here too: ``chrome/installer/mini_installer/chrome.release``: ``CustomProductName.exe: %(ChromeDir)s\`` – Asesh May 14 '18 at 07:20
  • Here are the spots that still have a chrome.exe in them https://pastebin.com/1R6eUah1 `still getting error: ERROR Input to target not generated by a dependency. The file: /out/CustomProductName/initialexe/CustomProductName.exe is listed as an input or source for the target: //chrome:reorder_imports but no targets in the build generate that file.` – Nicholas DiPiazza May 14 '18 at 15:04
  • You don't have to replace all of them. ``new_chrome.exe`` is used for browser rename dancing process when browser is updated and is in-use. Omaha client will do so. I just went through that file from our repo: ``input_image = os.path.join(input_dir, 'CustomProductName.exe') output_image = os.path.join(output_dir, 'CustomProductName.exe')`` and another change in that same file: ``for fname in glob.iglob(os.path.join(input_dir, 'CustomProductName.exe.*')):`` – Asesh May 14 '18 at 15:21
  • looks like ``chrome:reorder_imports`` error message that you posted above is because ``chrome.exe`` doesn't exist or is not generated by your build system. – Asesh May 14 '18 at 15:24
  • At this point i'm trying to run a clean build. This error is happening at configuration time – Nicholas DiPiazza May 14 '18 at 15:24
  • 1
    I think i found it. `chrome_binary("chrome_initial") { if (is_win) { output_name = "initialexe/CustomProductName"` in `chrome/BUILD.gn` – Nicholas DiPiazza May 14 '18 at 16:32