Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts to build linux installer packages #28

Merged
merged 6 commits into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ group("create_dist") {
if (is_mac) {
deps += [ "build/mac:create_dist_mac" ]
}
if (is_linux) {
deps += [
"//chrome/installer/linux",
]
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!-- Copyright 2017 The Chromium Authors -->
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>chromium-browser.desktop</id> <!-- ? brave-chromium-fork.desktop? -->
<update_contact>chromium-dev@chromium.org</update_contact>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-3-Clause and LGPL-2.1+ and Apache-2.0 and IJG and MIT and GPL-2.0+ and ISC and OpenSSL and (MPL-1.1 or GPL-2.0 or LGPL-2.0)</project_license>
<name>Brave Browser</name>
<summary>The web browser from Brave.com</summary>
<description>
<p>
A browser with your interests at heart.
</p>
<p>
Browse faster by blocking ads and trackers that violate your privacy and cost you time and money.
</p>
</description>
<url type="homepage">https://brave.com/</url>
<screenshots>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to completely remove the screenshots element?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, removed.

<!--
<screenshot type="default">
<image>https://www.gstatic.com/chrome/appstream/chrome-2.png</image>
<caption/>
</screenshot>
-->
</screenshots>
<translation/>
<developer_name>Brave Software</developer_name>
<url type="bugtracker">https://github.com/brave</url>
<url type="help">https://community.brave.com/</url>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This file provides common configuration information for building
# chromium-browser packages for various platforms.

# Base name of the package.
PACKAGE="brave-browser-chromium-fork"

# Filename of the main executable (for generating launcher scripts, etc.)
PROGNAME=brave

# Base directory for package installation.
INSTALLDIR=/opt/brave.com/brave-chromium-fork

# Display string for desktop menu/icon.
MENUNAME="Brave Web Browser"

# Brief package description.
SHORTDESC="The web browser from Brave"

# Detailed package description.
FULLDESC="Browse faster by blocking ads and trackers that violate your privacy and cost you time and money."

# Package maintainer information.
MAINTNAME="Brave Software"
MAINTMAIL="support+laptop@brave.com"
PRODUCTURL="https://brave.com/"
43 changes: 40 additions & 3 deletions patches/chrome-installer-linux-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
index 225c6fd2669818225e1877ef21774b04abb1a6f3..d2ff71f0034dd2185d486816935979a3842a3ef8 100644
index 225c6fd2669818225e1877ef21774b04abb1a6f3..ae4c899764d602450d16c7479424f8369693a0e8 100644
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -19,7 +19,7 @@ if (current_cpu == "x86" || current_cpu == "x64") {
@@ -19,8 +19,8 @@ if (current_cpu == "x86" || current_cpu == "x64") {
assert(is_linux)

packaging_files_executables = [
- "$root_out_dir/chrome",
- "$root_out_dir/chrome_sandbox",
+ "$root_out_dir/brave",
"$root_out_dir/chrome_sandbox",
+ "$root_out_dir/brave_sandbox",
]
packaging_files_shlibs = []

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra blank newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding, fixed.

@@ -153,7 +153,7 @@ action("merge_rpm_dependencies") {
}

Expand All @@ -20,3 +22,38 @@ index 225c6fd2669818225e1877ef21774b04abb1a6f3..d2ff71f0034dd2185d486816935979a3
debug_file = prog_name + ".debug"
stripped_file = prog_name + ".stripped"
deps = [
@@ -243,6 +243,16 @@ copy("common_packaging_files") {
"common/chromium-browser/chromium-browser.appdata.xml",
"common/chromium-browser/chromium-browser.info",
]
+
+ sources -= [
+ "common/chromium-browser/chromium-browser.appdata.xml",
+ "common/chromium-browser/chromium-browser.info",
+ ]
+
+ sources += [
+ "//brave/chromium_src/chrome/installer/linux/common/brave-browser/chromium-browser.appdata.xml",
+ "//brave/chromium_src/chrome/installer/linux/common/brave-browser/chromium-browser.info",
+ ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove lines 26-27 and replace with lines 36-37 here, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done.
The reason why I have done that is the message in #chromium-fork from @bridiver

when you are replacing a source file in a chrome gn file you should add a patch with `source -=` and `source +=`
vs patching inline in the existing `source =` 

But patches here is fragile balance between minimal size for future support and clarity. Direct patch does make the size of result smaller, without obvious damage for clarity. So, thanks for mention about issue.

}

sources += [ "//third_party/eu-strip/bin/eu-strip" ]
@@ -411,7 +421,7 @@ template("linux_package") {
if (is_chrome_branded) {
package = "google-chrome"
} else {
- package = "chromium-browser"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this name actually used? If this is a deb we don't want "-chromium-fork" here. If this package name isn't seen by users or if we can just rename it afterwards then I think we shouldn't patch it at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line in brave/src/chrome/installer/linux/BUILD.gn does not used anywhere indeed. The package name is defined by the line PACKAGE="brave-browser" at the file https://github.com/brave/antimuon/pull/28/files#diff-a023e566679169856984037106482f04R9 . I have modified this line in prev commits to have consistency between installer/linux/BUILD.gn and chromium-browser.info. Now this is removed.

Thanks for notice, I got rid of chromium-fork mention everywhere, but I have left the package name modified, because it is taken from completely overridden file chromium_src/chrome/installer/linux/common/brave-browser/chromium-browser.info (https://github.com/brave/antimuon/pull/28/files#diff-a023e566679169856984037106482f04R1) and does not affect the patch complexity.

+ package = "brave-browser-chromium-fork"
}
outputs = [
"$root_out_dir/${package}-${channel}_${chrome_version_full}-1_${deb_arch}.deb",
@@ -463,7 +473,7 @@ template("linux_package") {
if (is_chrome_branded) {
package = "google-chrome"
} else {
- package = "chromium-browser"
+ package = "brave-browser-chromium-fork"
}
outputs = [
"$root_out_dir/${package}-${channel}-${chrome_version_full}-1.${rpm_arch}.rpm",
23 changes: 23 additions & 0 deletions patches/chrome-installer-linux-common-installer.include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include
index 4c460fc0244e7c1066e1abc3f3cacbfc92b1ed48..a595365da8685462f1cddfa807b89f93c67c0169 100644
--- a/chrome/installer/linux/common/installer.include
+++ b/chrome/installer/linux/common/installer.include
@@ -153,6 +153,9 @@ stage_install_common() {
install -m 644 "${BUILDDIR}/ui_resources_100_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
fi

+ # brave_resources.pak, contains customization, shields
+ install -m 644 "${BUILDDIR}/brave_resources.pak" "${STAGEDIR}/${INSTALLDIR}/"
+
# ICU data file; Necessary when the GN icu_use_data_file flag is true.
install -m 644 "${BUILDDIR}/icudtl.dat" "${STAGEDIR}/${INSTALLDIR}/"

@@ -359,7 +362,7 @@ stage_install_common() {
exit 1
fi
local expected_perms=777
- elif [ "${base_name}" = "chrome-sandbox" ]; then
+ elif [ "${base_name}" = "brave-sandbox" ]; then
local expected_perms=4755
elif [[ "${base_name}" = "nacl_irt_"*".nexe" ]]; then
local expected_perms=644
14 changes: 14 additions & 0 deletions patches/chrome-installer-linux-rpm-calculate_package_deps.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/chrome/installer/linux/rpm/calculate_package_deps.py b/chrome/installer/linux/rpm/calculate_package_deps.py
index 9d580f2e68499421d4eae1dcc89f5fe1712b44eb..e12a3fbf2200087df7ace578f0e5484e9fac1d51 100755
--- a/chrome/installer/linux/rpm/calculate_package_deps.py
+++ b/chrome/installer/linux/rpm/calculate_package_deps.py
@@ -57,7 +57,8 @@ if distro_check:
print >> sys.stderr, (
'Unexpected new dependency %s on distro %s caused by binary %s' % (
requirement, distro, os.path.basename(binary)))
- ret_code = 1
+ # Disabled to finish the build. Some deps may be missing, but rpm is well installed.
+ #ret_code = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build of rpm packages requires to run on Ubuntu 14.
This patch is removed now.

continue
if ret_code == 0:
requires = requires.difference(remove_requires)
13 changes: 13 additions & 0 deletions patches/sandbox-linux-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
index 8c9cf2c9458ef538269e83fb5db4d1b02f91c142..2e542281aee7b8beccf5c94cb41e7e8b1bca0bdd 100644
--- a/sandbox/linux/BUILD.gn
+++ b/sandbox/linux/BUILD.gn
@@ -335,6 +335,8 @@ if (is_linux) {
# This is safe to delete unconditionally, because it is part of the
# default configs and empty when not using the sanitizers.
configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
+
+ output_name = "brave_sandbox"
}
}