diff options
author | Hilton Chain <hako@ultrarare.space> | 2024-12-11 23:30:12 +0800 |
---|---|---|
committer | Hilton Chain <hako@ultrarare.space> | 2024-12-13 13:07:45 +0800 |
commit | 4fe0608a5cc44e3f368dab98709d0ab4392a37ed (patch) | |
tree | d1075874c835b551bdc8eafda05a62c2b94d94f4 | |
parent | 5a7e61a0a5bc191d8558a845bd724a0d41e0afbd (diff) |
nongnu: firefox-esr: Support Guix icecat browser extensions.
* nongnu/packages/patches/firefox-esr-compare-paths.patch: New file.
* nongnu/packages/patches/firefox-esr-use-system-wide-dir.patch: New file.
* nongnu/packages/mozilla.scm (firefox-esr)[source]: Add them.
[arguments]<#:configure-flags>: Allow unsigned system addons.
[native-search-paths]: Add ICECAT_SYSTEM_DIR.
-rw-r--r-- | nongnu/packages/mozilla.scm | 20 | ||||
-rw-r--r-- | nongnu/packages/patches/firefox-esr-compare-paths.patch | 23 | ||||
-rw-r--r-- | nongnu/packages/patches/firefox-esr-use-system-wide-dir.patch | 38 |
3 files changed, 80 insertions, 1 deletions
diff --git a/nongnu/packages/mozilla.scm b/nongnu/packages/mozilla.scm index e46d6d13..d6bc572e 100644 --- a/nongnu/packages/mozilla.scm +++ b/nongnu/packages/mozilla.scm @@ -98,7 +98,15 @@ (uri (string-append "https://archive.mozilla.org/pub/firefox/releases/" version "/source/firefox-" version ".source.tar.xz")) (sha256 - (base32 "1awl0yhcv693q23p6zw9rw40gicpp6pakbx616qsl5w85d2arijz")))) + (base32 "1awl0yhcv693q23p6zw9rw40gicpp6pakbx616qsl5w85d2arijz")) + (patches + (map (lambda (patch) + (search-path + (map (cut string-append <> "/nongnu/packages/patches") + %load-path) + patch)) + '("firefox-esr-compare-paths.patch" + "firefox-esr-use-system-wide-dir.patch"))))) (build-system gnu-build-system) (arguments (list @@ -130,6 +138,11 @@ "--with-distribution-id=org.nonguix" "--disable-official-branding" + ;; Do not require addons in the global app or system directories to + ;; be signed by Mozilla. + "--allow-addon-sideload" + "--with-unsigned-addon-scopes=app,system" + ;; Features "--disable-tests" "--disable-updater" @@ -482,6 +495,11 @@ rust-cbindgen-0.26 which yasm)) + (native-search-paths + (list (search-path-specification + (variable "ICECAT_SYSTEM_DIR") + (separator #f) ;single entry + (files '("lib/icecat"))))) (home-page "https://mozilla.org/firefox/") (synopsis "Trademarkless version of Firefox") (description diff --git a/nongnu/packages/patches/firefox-esr-compare-paths.patch b/nongnu/packages/patches/firefox-esr-compare-paths.patch new file mode 100644 index 00000000..dd113c79 --- /dev/null +++ b/nongnu/packages/patches/firefox-esr-compare-paths.patch @@ -0,0 +1,23 @@ +See comment in gnu/build/icecat-extension.scm. + +diff --git a/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs b/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs +index 0b885f6..0bbfbee 100644 +--- a/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs ++++ b/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs +@@ -3607,6 +3607,7 @@ export const XPIDatabaseReconcile = { + if ( + newAddon || + oldAddon.updateDate != xpiState.mtime || ++ oldAddon.path != xpiState.path || + (aUpdateCompatibility && this.isAppBundledLocation(installLocation)) + ) { + newAddon = this.updateMetadata( +@@ -3615,8 +3616,6 @@ export const XPIDatabaseReconcile = { + xpiState, + newAddon + ); +- } else if (oldAddon.path != xpiState.path) { +- newAddon = this.updatePath(installLocation, oldAddon, xpiState); + } else if (aUpdateCompatibility || aSchemaChange) { + newAddon = this.updateCompatibility( + installLocation, diff --git a/nongnu/packages/patches/firefox-esr-use-system-wide-dir.patch b/nongnu/packages/patches/firefox-esr-use-system-wide-dir.patch new file mode 100644 index 00000000..67a17096 --- /dev/null +++ b/nongnu/packages/patches/firefox-esr-use-system-wide-dir.patch @@ -0,0 +1,38 @@ +Replace "/usr/lib/mozilla" (the system-wide directory for extensions and +native manifests) with "$ICECAT_SYSTEM_DIR". + +diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp +index d3af49b495..4beef0aa7e 100644 +--- a/toolkit/xre/nsXREDirProvider.cpp ++++ b/toolkit/xre/nsXREDirProvider.cpp +@@ -296,24 +296,12 @@ nsresult nsXREDirProvider::GetBackgroundTasksProfilesRootDir( + static nsresult GetSystemParentDirectory(nsIFile** aFile) { + nsresult rv; + nsCOMPtr<nsIFile> localDir; +-# if defined(XP_MACOSX) +- rv = GetOSXFolderType(kOnSystemDisk, kApplicationSupportFolderType, +- getter_AddRefs(localDir)); +- if (NS_SUCCEEDED(rv)) { +- rv = localDir->AppendNative("Mozilla"_ns); +- } +-# else +- constexpr auto dirname = +-# ifdef HAVE_USR_LIB64_DIR +- "/usr/lib64/mozilla"_ns +-# elif defined(__OpenBSD__) || defined(__FreeBSD__) +- "/usr/local/lib/mozilla"_ns +-# else +- "/usr/lib/mozilla"_ns +-# endif +- ; +- rv = NS_NewNativeLocalFile(dirname, false, getter_AddRefs(localDir)); +-# endif ++ ++ const char* systemParentDir = getenv("ICECAT_SYSTEM_DIR"); ++ if (!systemParentDir || !*systemParentDir) return NS_ERROR_FAILURE; ++ ++ rv = NS_NewNativeLocalFile(nsDependentCString(systemParentDir), false, ++ getter_AddRefs(localDir)); + + if (NS_SUCCEEDED(rv)) { + localDir.forget(aFile); |