Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
504 views
in Technique[技术] by (71.8m points)

windows installer - Chromium - mini_installer ignores branding

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

ninja -C outBuildFolder mini_installer

This works fine and creates a mini_installer.exe in outBuildFolder.

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:

  • chromeappchromium_strings.grd
  • chromeappsettings_chromium_strings.grdp
  • chromeapphemechromiumBRANDING

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Branding won't change the name of generated executable files. You should modify srcchromeBUILD.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: srcchromeinstallermini_installerBUILD.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: srcchromeinstallerutilutil_constants.cc

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

The path to installation folder should be specified in this file: srcchromeinstall_staticchromium_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: srcchromeinstallerutilrowser_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.*')):

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...