From: Marius Bakke <marius@gnu.org>
To: 44335@debbugs.gnu.org
Subject: [bug#44335] [PATCH v2 1/3] gnu: ungoogled-chromium: Add search path for installed extensions.
Date: Mon, 2 Nov 2020 01:22:26 +0100 [thread overview]
Message-ID: <20201102002228.5971-2-marius@gnu.org> (raw)
In-Reply-To: <20201102002228.5971-1-marius@gnu.org>
* gnu/packages/patches/ungoogled-chromium-search-path.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/chromium.scm (%guix-patches): New variable.
(ungoogled-chromium-snippet): Apply %GUIX-PATCHES.
(ungoogled-chromium)[arguments]: Don't hard-code extensions directory.
[native-search-paths]: New field.
---
gnu/local.mk | 1 +
gnu/packages/chromium.scm | 18 ++++++------
.../ungoogled-chromium-search-path.patch | 28 +++++++++++++++++++
3 files changed, 39 insertions(+), 8 deletions(-)
create mode 100644 gnu/packages/patches/ungoogled-chromium-search-path.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index d4d04c01b8..51550e80cb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1642,6 +1642,7 @@ dist_patch_DATA = \
%D%/packages/patches/u-boot-riscv64-fix-extlinux.patch \
%D%/packages/patches/ucx-tcp-iface-ioctl.patch \
%D%/packages/patches/udiskie-no-appindicator.patch \
+ %D%/packages/patches/ungoogled-chromium-search-path.patch \
%D%/packages/patches/ungoogled-chromium-system-nspr.patch \
%D%/packages/patches/unison-fix-ocaml-4.08.patch \
%D%/packages/patches/unknown-horizons-python-3.8-distro.patch \
diff --git a/gnu/packages/chromium.scm b/gnu/packages/chromium.scm
index f32a779805..06c57acd28 100644
--- a/gnu/packages/chromium.scm
+++ b/gnu/packages/chromium.scm
@@ -334,6 +334,10 @@
(base32
"18p9a7qffmy8m03nqva7maalgil13lj2mn0s56v3crbs4wk4lalj"))))
+(define %guix-patches
+ (list (local-file (search-patch "ungoogled-chromium-system-nspr.patch"))
+ (local-file (search-patch "ungoogled-chromium-search-path.patch"))))
+
;; This is a source 'snippet' that does the following:
;; *) Applies various patches for unbundling purposes and libstdc++ compatibility.
;; *) Runs the ungoogled patch-, domain substitution-, and scrubbing scripts.
@@ -356,9 +360,7 @@
(invoke "patch" "-p1" "--force" "--input"
patch "--no-backup-if-mismatch"))
(append '#+%debian-patches '#+%arch-patches
- '#+(list (local-file
- (search-patch
- "ungoogled-chromium-system-nspr.patch")))))
+ '#+%guix-patches))
(with-directory-excursion #+%ungoogled-origin
(format #t "Ungooglifying...~%")
@@ -571,11 +573,6 @@
(find-files (string-append "third_party/webrtc/modules"
"/audio_coding/codecs/opus")))
- (substitute* "chrome/common/chrome_paths.cc"
- (("/usr/share/chromium/extensions")
- ;; TODO: Add ~/.guix-profile.
- "/run/current-system/profile/share/chromium/extensions"))
-
;; Many files try to include ICU headers from "third_party/icu/...".
;; Remove the "third_party/" prefix to use system headers instead.
(substitute* (find-files "chrome" "\\.cc$")
@@ -840,6 +837,11 @@
("udev" ,eudev)
("valgrind" ,valgrind)
("vulkan-headers" ,vulkan-headers)))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CHROMIUM_EXTENSION_DIRECTORY")
+ (separator #f) ;single entry
+ (files '("share/chromium/extensions")))))
;; Building Chromium takes ... a very long time. On a single core, a busy
;; mid-end x86 system may need more than 24 hours to complete the build.
diff --git a/gnu/packages/patches/ungoogled-chromium-search-path.patch b/gnu/packages/patches/ungoogled-chromium-search-path.patch
new file mode 100644
index 0000000000..5ef9c56b52
--- /dev/null
+++ b/gnu/packages/patches/ungoogled-chromium-search-path.patch
@@ -0,0 +1,28 @@
+Look for system-installed extensions in CHROMIUM_EXTENSION_DIRECTORY instead
+of the hard-coded /usr/share/chromium/extensions.
+
+--- a/chrome/common/chrome_paths.cc
++++ b/chrome/common/chrome_paths.cc
+@@ -4,6 +4,7 @@
+
+ #include "chrome/common/chrome_paths.h"
+
++#include "base/environment.h"
+ #include "base/files/file_util.h"
+ #include "base/logging.h"
+ #include "base/native_library.h"
+@@ -511,7 +512,13 @@
+ #endif
+ #if defined(OS_LINUX) || defined(OS_CHROMEOS)
+ case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: {
+- cur = base::FilePath(kFilepathSinglePrefExtensions);
++ std::unique_ptr<base::Environment> environment(base::Environment::Create());
++ std::string extension_dir;
++ if (environment->GetVar("CHROMIUM_EXTENSION_DIRECTORY", &extension_dir)) {
++ cur = base::FilePath(extension_dir);
++ } else {
++ cur = base::FilePath(kFilepathSinglePrefExtensions);
++ }
+ break;
+ }
+ #endif
--
2.28.0
next prev parent reply other threads:[~2020-11-02 0:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 18:29 [bug#44335] [PATCH 0/2] Install Chromium extensions with Guix! Marius Bakke
2020-10-30 18:32 ` [bug#44335] [PATCH 1/2] gnu: ungoogled-chromium: Add search path for installed extensions Marius Bakke
2020-10-30 18:32 ` [bug#44335] [PATCH 2/2] gnu: Add ublock-origin-chromium Marius Bakke
2020-11-02 0:22 ` [bug#44335] [PATCH v2 0/3] Install Chromium extensions with Guix! Marius Bakke
2020-11-02 0:22 ` Marius Bakke [this message]
2020-11-02 0:22 ` [bug#44335] [PATCH v2 2/3] Add (gnu build chromium-extension) Marius Bakke
2020-11-02 0:28 ` Marius Bakke
2020-11-02 0:22 ` [bug#44335] [PATCH v2 3/3] gnu: Add ublock-origin-chromium Marius Bakke
2020-11-02 0:55 ` [bug#44335] [PATCH v2 0/3] Install Chromium extensions with Guix! Leo Famulari
2020-11-08 17:38 ` bug#44335: " Marius Bakke
2020-11-08 17:46 ` [bug#44335] " Leo Famulari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201102002228.5971-2-marius@gnu.org \
--to=marius@gnu.org \
--cc=44335@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).