diff --git a/.github/LICENSE b/.github/LICENSE new file mode 100644 index 0000000000000..fa0086a952236 --- /dev/null +++ b/.github/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. \ No newline at end of file diff --git a/.github/assets/installer/7zSD.ARM64.sfx b/.github/assets/installer/7zSD.ARM64.sfx new file mode 100644 index 0000000000000..9a07955b0c2f8 Binary files /dev/null and b/.github/assets/installer/7zSD.ARM64.sfx differ diff --git a/.github/assets/installer/7zSD.Win32.sfx b/.github/assets/installer/7zSD.Win32.sfx new file mode 100644 index 0000000000000..7af68708030ab Binary files /dev/null and b/.github/assets/installer/7zSD.Win32.sfx differ diff --git a/.github/assets/installer/setup.ico b/.github/assets/installer/setup.ico new file mode 100644 index 0000000000000..ec454b8bed590 Binary files /dev/null and b/.github/assets/installer/setup.ico differ diff --git a/.github/assets/readme/Link2MainRepo.svg b/.github/assets/readme/Link2MainRepo.svg new file mode 100644 index 0000000000000..7a96dd72bb311 --- /dev/null +++ b/.github/assets/readme/Link2MainRepo.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.github/assets/readme/Link2RuntimeRepo.svg b/.github/assets/readme/Link2RuntimeRepo.svg new file mode 100644 index 0000000000000..9a30a387f1721 --- /dev/null +++ b/.github/assets/readme/Link2RuntimeRepo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.github/patches/README.md b/.github/patches/README.md new file mode 100644 index 0000000000000..b8503926ce9b2 --- /dev/null +++ b/.github/patches/README.md @@ -0,0 +1,5 @@ +# Useful diff command + +```bash +git diff HEAD -- . :^.github :^browser/branding/noraneko :^noraneko > .github/patches/[dir]/[filename].patch +``` diff --git a/.github/patches/dev/CDP.patch b/.github/patches/dev/CDP.patch new file mode 100644 index 0000000000000..a77f45d6ad6f7 --- /dev/null +++ b/.github/patches/dev/CDP.patch @@ -0,0 +1,22 @@ +diff --git a/remote/cdp/CDP.sys.mjs b/remote/cdp/CDP.sys.mjs +index 1715e8a54b..bcf4c379e8 100644 +--- a/remote/cdp/CDP.sys.mjs ++++ b/remote/cdp/CDP.sys.mjs +@@ -77,7 +77,7 @@ export class CDP { + // avoid potential race conditions. + this._running = true; + +- lazy.RecommendedPreferences.applyPreferences(RECOMMENDED_PREFS); ++ //lazy.RecommendedPreferences.applyPreferences(RECOMMENDED_PREFS); + + // Starting CDP too early can cause issues with clients in not being able + // to find any available target. Also when closing the application while +@@ -137,7 +137,7 @@ export class CDP { + this.targetList?.destructor(); + this.targetList = null; + +- lazy.RecommendedPreferences.restorePreferences(RECOMMENDED_PREFS); ++ //lazy.RecommendedPreferences.restorePreferences(RECOMMENDED_PREFS); + } catch (e) { + lazy.logger.error("Failed to stop protocol", e); + } finally { diff --git a/.github/patches/dev/Marionette.patch b/.github/patches/dev/Marionette.patch new file mode 100644 index 0000000000000..9105a929da7dd --- /dev/null +++ b/.github/patches/dev/Marionette.patch @@ -0,0 +1,13 @@ +diff --git a/remote/components/Marionette.sys.mjs b/remote/components/Marionette.sys.mjs +index 87a53679e4..8c1552d21d 100644 +--- a/remote/components/Marionette.sys.mjs ++++ b/remote/components/Marionette.sys.mjs +@@ -140,7 +140,7 @@ class MarionetteParentProcess { + Services.obs.addObserver(this, "domwindowopened"); + } + +- lazy.RecommendedPreferences.applyPreferences(); ++ //lazy.RecommendedPreferences.applyPreferences(); + + // Only set preferences to preserve in a new profile + // when Marionette is enabled. diff --git a/.github/patches/dev/RemoteAgent.patch b/.github/patches/dev/RemoteAgent.patch new file mode 100644 index 0000000000000..8ceffc7b4a861 --- /dev/null +++ b/.github/patches/dev/RemoteAgent.patch @@ -0,0 +1,13 @@ +diff --git a/remote/components/RemoteAgent.sys.mjs b/remote/components/RemoteAgent.sys.mjs +index 1b2ad4649b..43d7dd3154 100644 +--- a/remote/components/RemoteAgent.sys.mjs ++++ b/remote/components/RemoteAgent.sys.mjs +@@ -395,7 +395,7 @@ class RemoteAgentParentProcess { + Services.obs.addObserver(this, "quit-application"); + + // Apply the common set of preferences for all supported protocols +- lazy.RecommendedPreferences.applyPreferences(); ++ //lazy.RecommendedPreferences.applyPreferences(); + + // With Bug 1717899 we will extend the lifetime of the Remote Agent to + // the whole Firefox session, which will be identical to Marionette. For diff --git a/.github/patches/dev/WebDriverBiDi.patch b/.github/patches/dev/WebDriverBiDi.patch new file mode 100644 index 0000000000000..f69f0e8a0c34e --- /dev/null +++ b/.github/patches/dev/WebDriverBiDi.patch @@ -0,0 +1,13 @@ +diff --git a/remote/webdriver-bidi/WebDriverBiDi.sys.mjs b/remote/webdriver-bidi/WebDriverBiDi.sys.mjs +index 639c5f6080..fe00523f03 100644 +--- a/remote/webdriver-bidi/WebDriverBiDi.sys.mjs ++++ b/remote/webdriver-bidi/WebDriverBiDi.sys.mjs +@@ -209,7 +209,7 @@ export class WebDriverBiDi { + + this.#running = true; + +- lazy.RecommendedPreferences.applyPreferences(RECOMMENDED_PREFS); ++ //lazy.RecommendedPreferences.applyPreferences(RECOMMENDED_PREFS); + + // Install a HTTP handler for direct WebDriver BiDi connection requests. + this.#agent.server.registerPathHandler( diff --git a/.github/patches/packaging/moz.build.patch b/.github/patches/packaging/moz.build.patch new file mode 100644 index 0000000000000..faa4951f99a5e --- /dev/null +++ b/.github/patches/packaging/moz.build.patch @@ -0,0 +1,12 @@ +diff --git a/moz.build b/moz.build +index 37e12e4c99..4ee3ec1af0 100644 +--- a/moz.build ++++ b/moz.build +@@ -154,6 +154,7 @@ DIRS += [ + "python", + "testing", + "third_party/python", ++ "noraneko" + ] + + if not CONFIG["JS_STANDALONE"]: diff --git a/.github/patches/packaging/package-manifest.in.patch b/.github/patches/packaging/package-manifest.in.patch new file mode 100644 index 0000000000000..0ed33ff251ff3 --- /dev/null +++ b/.github/patches/packaging/package-manifest.in.patch @@ -0,0 +1,16 @@ +diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in +index 861ba1c484..83f8d4cf87 100644 +--- a/browser/installer/package-manifest.in ++++ b/browser/installer/package-manifest.in +@@ -196,6 +196,11 @@ + @RESPATH@/chrome/remote.manifest + #endif + ++; [Noraneko Files] ++@RESPATH@/chrome/noraneko.manifest ++@RESPATH@/chrome/noraneko@JAREXT@ ++@RESPATH@/browser/buildid2 ++ + ; [Extensions] + @RESPATH@/components/extensions-toolkit.manifest + @RESPATH@/browser/components/extensions-browser.manifest diff --git a/.github/patches/upstream/SplitViewCpp.patch b/.github/patches/upstream/SplitViewCpp.patch new file mode 100644 index 0000000000000..c3c594f1a6833 --- /dev/null +++ b/.github/patches/upstream/SplitViewCpp.patch @@ -0,0 +1,41 @@ +ο»Ώdiff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp +index 27fb1239db..43e6b876d8 100644 +--- a/dom/ipc/BrowserChild.cpp ++++ b/dom/ipc/BrowserChild.cpp +@@ -2542,7 +2542,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvRenderLayers(const bool& aEnabled) { + ProcessHangMonitor::MaybeStartPaintWhileInterruptingJS(); + } + +- mRenderLayers = aEnabled; ++ bool splitViewIsEnabled = Preferences::GetBool("floorp.browser.splitView.working", false); ++ mRenderLayers = splitViewIsEnabled ? true : aEnabled; + const bool wasVisible = IsVisible(); + + UpdateVisibility(); +diff --git a/dom/ipc/BrowserHost.cpp b/dom/ipc/BrowserHost.cpp +index 489f07a612..032b87e537 100644 +--- a/dom/ipc/BrowserHost.cpp ++++ b/dom/ipc/BrowserHost.cpp +@@ -106,7 +106,7 @@ void BrowserHost::UpdateEffects(EffectsInfo aEffects) { + /* attribute boolean renderLayers; */ + NS_IMETHODIMP + BrowserHost::GetRenderLayers(bool* aRenderLayers) { +- if (!mRoot) { ++ if (!mRoot && !Preferences::GetBool("floorp.browser.splitView.working", false)) { + *aRenderLayers = false; + return NS_OK; + } +diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp +index b37d6838d9..48acddae31 100644 +--- a/dom/ipc/BrowserParent.cpp ++++ b/dom/ipc/BrowserParent.cpp +@@ -3584,7 +3584,8 @@ void BrowserParent::SetRenderLayers(bool aEnabled) { + return; + } + +- mRenderLayers = aEnabled; ++ bool splitViewIsEnabled = Preferences::GetBool("floorp.browser.splitView.working", false); ++ mRenderLayers = splitViewIsEnabled ? true : aEnabled; + + SetRenderLayersInternal(aEnabled); + } diff --git a/.github/patches/upstream/UpdateService.sys.mjs.patch b/.github/patches/upstream/UpdateService.sys.mjs.patch new file mode 100644 index 0000000000000..3df03d566acb6 --- /dev/null +++ b/.github/patches/upstream/UpdateService.sys.mjs.patch @@ -0,0 +1,448 @@ +diff --git a/toolkit/mozapps/update/UpdateService.sys.mjs b/toolkit/mozapps/update/UpdateService.sys.mjs +index 7ec86b4f5f..fc532cc07c 100644 +--- a/toolkit/mozapps/update/UpdateService.sys.mjs ++++ b/toolkit/mozapps/update/UpdateService.sys.mjs +@@ -16,6 +16,21 @@ import { + import { FileUtils } from "resource://gre/modules/FileUtils.sys.mjs"; + import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; + ++/** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++import { NoranekoConstants } from "resource://noraneko/modules/NoranekoConstants.sys.mjs" ++/** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ ++ ++// MARK: defines ++ + const lazy = {}; + + ChromeUtils.defineESModuleGetters(lazy, { +@@ -300,6 +315,10 @@ let gOnlyDownloadUpdatesThisSession = false; + // This will be the backing for `nsIApplicationUpdateService.currentState` + var gUpdateState = Ci.nsIApplicationUpdateService.STATE_IDLE; + ++ ++ ++// MARK: utilities ++ + /** + * Simple container and constructor for a Promise and its resolve function. + */ +@@ -1899,15 +1918,150 @@ function pingStateAndStatusCodes(aUpdate, aStartup, aStatus) { + AUSTLMY.pingStateCode(suffix, stateCode); + } + ++/** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ ++/** ++ * @typedef {[number, number, number]} NRVersion2 ++ */ ++ ++/** ++ * check version2 for compare ++ * @param {string} A ++ * @returns {NRVersion2 | null} ++ */ ++function parseVersion2(A) { ++ try { ++ let semverA = /^([0-9]+)\.([0-9]+)\.([0-9]+)$/.exec(A).slice(1).map((p)=>parseInt(p,10)); ++ return semverA; ++ } catch {} ++ return null; ++} ++ ++/** ++ * compare version2 that is added for noraneko ++ * - 0 A=B ++ * - 1 AB ++ * - null A.length !== 3 || B.length !== 3 ++ * @param {NRVersion2} A ++ * @param {NRVersion2} B ++ * @param {"<" | "==" | ">" | "<=" | ">="} mode ++ */ ++function compareVersion2(A, B, mode) { ++ ++ /** ++ * @type {"A==B" | "no_value" | "A>B" | "A{ ++ if (lastStatus == "A==B") { ++ if (A[index] == B[index]) { ++ lastStatus = "A==B"; ++ } else if (A[index] > B[index]) { ++ lastStatus = "A>B"; ++ } else if (A[index] < B[index]) { ++ lastStatus = "A": ++ return lastStatus === "A>B"; ++ case ">=": ++ return lastStatus === "A==B" || lastStatus === "A>B"; ++ } ++} ++ ++/** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ ++ + /** + * This returns true if the passed update is the same version or older than the + * version and build ID values passed. Otherwise it returns false. ++ * ++ * *#####* ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ * *#####* ++ * @param {nsIUpdate} update ++ * @param {NRVersion2 | null} version2 ++ * *#####* ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ * *#####* + */ +-function updateIsAtLeastAsOldAs(update, version, buildID) { ++function updateIsAtLeastAsOldAs(update, version, buildID ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ , version2 = null ++ , buildID2 = null ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ ++) { + if (!update || !update.appVersion || !update.buildID) { + return false; + } + let versionComparison = Services.vc.compare(update.appVersion, version); ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ let update_appVersion2 = parseVersion2(update.appVersion2) ++ let self_version2 = parseVersion2(version2); ++ ++ if (update_appVersion2 && self_version2) { ++ if (versionComparison == 0) { ++ if (compareVersion2(update_appVersion2, self_version2, ">")) { ++ return false; ++ } ++ if (compareVersion2(update_appVersion2,self_version2,"<")) { ++ return true; ++ } ++ if (update.buildID == buildID) { ++ if (buildID2 != null && update.buildID2 != null && update.buildID2 != buildID2) { ++ return false ++ } ++ } ++ } ++ } ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + return ( + versionComparison < 0 || + (versionComparison == 0 && update.buildID == buildID) +@@ -1917,12 +2071,26 @@ function updateIsAtLeastAsOldAs(update, version, buildID) { + /** + * This returns true if the passed update is the same version or older than + * currently installed Firefox version. ++ * @param {nsIUpdate} update + */ + function updateIsAtLeastAsOldAsCurrentVersion(update) { + return updateIsAtLeastAsOldAs( + update, + Services.appinfo.version, + Services.appinfo.appBuildID ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ , NoranekoConstants.version2 ++ , NoranekoConstants.buildID2 ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + ); + } + +@@ -1943,6 +2111,19 @@ function updateIsAtLeastAsOldAsReadyUpdate(update) { + update, + lazy.UM.internal.readyUpdate.appVersion, + lazy.UM.internal.readyUpdate.buildID ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ , lazy.UM.internal.readyUpdate.appVersion2 ++ , lazy.UM.internal.readyUpdate.buildID2 ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + ); + } + +@@ -2049,6 +2230,10 @@ function pollForStagingEnd() { + lazy.setTimeout(pollingFn, pollingIntervalMs); + } + ++ ++ ++// MARK: UpdatePatch ++ + class UpdatePatch { + // nsIUpdatePatch attribute names used to prevent nsIWritablePropertyBag from + // over writing nsIUpdatePatch attributes. +@@ -2249,6 +2434,10 @@ class UpdatePatch { + ]); + } + ++ ++ ++// MARK: Update ++ + class Update { + // nsIUpdate attribute names used to prevent nsIWritablePropertyBag from over + // writing nsIUpdate attributes. +@@ -2271,6 +2460,19 @@ class Update { + "type", + "unsupported", + "platformVersion", ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ "appVersion2", ++ "buildID2", ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + ]; + + /** +@@ -2368,6 +2570,19 @@ class Update { + case "statusText": + case "type": + case "platformVersion": ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ case "appVersion2": ++ case "buildID2": ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + this[attr.name] = attr.value; + break; + default: +@@ -2512,6 +2727,23 @@ class Update { + if (this.elevationFailure) { + update.setAttribute("elevationFailure", this.elevationFailure); + } ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ if (this.appVersion2) { ++ update.setAttribute("appVersion2",this.appVersion2); ++ } ++ if (this.buildID2) { ++ update.setAttribute("buildID2",this.buildID2) ++ } ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + + for (let [name, value] of Object.entries(this._properties)) { + if (value.present && !this._attrNames.includes(name)) { +@@ -2621,6 +2853,10 @@ class Update { + ]); + } + ++ ++ ++// MARK: UpdateService ++ + export class UpdateService { + #initPromise; + +@@ -3616,11 +3852,13 @@ export class UpdateService { + return true; + } + ++ ++ + /** + * Determine the update from the specified updates that should be offered. + * If both valid major and minor updates are available the minor update will + * be offered. +- * @param updates ++ * @param {nsIUpdate[]} updates + * An array of available nsIUpdate items + * @return The nsIUpdate to offer. + */ +@@ -3641,6 +3879,8 @@ export class UpdateService { + var vc = Services.vc; + let lastCheckCode = AUSTLMY.CHK_NO_COMPAT_UPDATE_FOUND; + ++ ++ + for (const update of updates) { + // Ignore updates for older versions of the application and updates for + // the same version of the application with the same build ID. +@@ -3673,6 +3913,8 @@ export class UpdateService { + continue; + } + ++ ++ + switch (update.type) { + case "major": + if (!majorUpdate || majorUpdate.unsupported) { +@@ -3680,6 +3922,18 @@ export class UpdateService { + } else if ( + !update.unsupported && + vc.compare(majorUpdate.appVersion, update.appVersion) <= 0 ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ && vc.compare(majorUpdate.appVersion, update.appVersion) == 0 ? compareVersion2(parseVersion2(majorUpdate.appVersion2),parseVersion2(update.appVersion2), "<=") : true ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + ) { + majorUpdate = update; + } +@@ -3690,6 +3944,18 @@ export class UpdateService { + } else if ( + !update.unsupported && + vc.compare(minorUpdate.appVersion, update.appVersion) <= 0 ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ && vc.compare(majorUpdate.appVersion, update.appVersion) == 0 ? compareVersion2(parseVersion2(majorUpdate.appVersion2),parseVersion2(update.appVersion2), "<=") : true ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + ) { + minorUpdate = update; + } +@@ -4460,6 +4726,10 @@ export class UpdateService { + ]); + } + ++ ++ ++// MARK: UpdateManager ++ + export class UpdateManager { + /** + * The nsIUpdate object for the update that has been downloaded. +@@ -5178,6 +5448,10 @@ export class UpdateManager { + QueryInterface = ChromeUtils.generateQI([Ci.nsIUpdateManager]); + } + ++ ++ ++// MARK: CheckerService ++ + /** + * CheckerService + * Provides an interface for checking for new updates. When more checks are +@@ -5756,6 +6030,10 @@ export class CheckerService { + QueryInterface = ChromeUtils.generateQI([Ci.nsIUpdateChecker]); + } + ++ ++ ++// MARK: Downloader ++ + class Downloader { + /** + * The nsIUpdatePatch that we are downloading +@@ -7138,6 +7416,10 @@ class Downloader { + ]); + } + ++ ++ ++// MARK: RestartOnLastWindowClosed ++ + // On macOS, all browser windows can be closed without Firefox exiting. If it + // is left in this state for a while and an update is pending, we should restart + // Firefox on our own to apply the update. This class will do that diff --git a/.github/patches/upstream/artifacts.py.patch b/.github/patches/upstream/artifacts.py.patch new file mode 100644 index 0000000000000..abc1d1b4c522c --- /dev/null +++ b/.github/patches/upstream/artifacts.py.patch @@ -0,0 +1,31 @@ +diff --git a/python/mozbuild/mozbuild/artifacts.py b/python/mozbuild/mozbuild/artifacts.py +index 6e46664f20..0a0d893ed0 100644 +--- a/python/mozbuild/mozbuild/artifacts.py ++++ b/python/mozbuild/mozbuild/artifacts.py +@@ -553,7 +553,7 @@ class AndroidArtifactJob(ArtifactJob): + + class LinuxArtifactJob(ArtifactJob): + package_re = r"public/build/target\.tar\.bz2$" +- product = "firefox" ++ product = "noraneko" + + _package_artifact_patterns = { + "{product}/crashreporter", +@@ -648,7 +648,7 @@ class ResignJarWriter(JarWriter): + + class MacArtifactJob(ArtifactJob): + package_re = r"public/build/target\.dmg$" +- product = "firefox" ++ product = "noraneko" + + # These get copied into dist/bin without the path, so "root/a/b/c" -> "dist/bin/c". + _paths_no_keep_path = ( +@@ -792,7 +792,7 @@ class MacArtifactJob(ArtifactJob): + + class WinArtifactJob(ArtifactJob): + package_re = r"public/build/target\.(zip|tar\.gz)$" +- product = "firefox" ++ product = "noraneko" + + _package_artifact_patterns = { + "{product}/dependentlibs.list", diff --git a/.github/patches/upstream/bootstrap.py.patch b/.github/patches/upstream/bootstrap.py.patch new file mode 100644 index 0000000000000..bc8255fd1c99e --- /dev/null +++ b/.github/patches/upstream/bootstrap.py.patch @@ -0,0 +1,45 @@ +diff --git a/python/mozboot/mozboot/bootstrap.py b/python/mozboot/mozboot/bootstrap.py +index df3f39f548..c31455f9e1 100644 +--- a/python/mozboot/mozboot/bootstrap.py ++++ b/python/mozboot/mozboot/bootstrap.py +@@ -45,27 +45,14 @@ from mozboot.void import VoidBootstrapper + from mozboot.windows import WindowsBootstrapper + + APPLICATION_CHOICE = """ +-Note on Artifact Mode: +- +-Artifact builds download prebuilt C++ components rather than building +-them locally. Artifact builds are faster! +- +-Artifact builds are recommended for people working on Firefox or +-Firefox for Android frontends, or the GeckoView Java API. They are unsuitable +-for those working on C++ code. For more information see: +-https://firefox-source-docs.mozilla.org/contributing/build/artifact_builds.html. +- +-Please choose the version of Firefox you want to build (see note above): ++Please choose the version of Noraneko you want to build: + %s + Your choice: """ + + APPLICATIONS = OrderedDict( + [ +- ("Firefox for Desktop Artifact Mode", "browser_artifact_mode"), +- ("Firefox for Desktop", "browser"), +- ("GeckoView/Firefox for Android Artifact Mode", "mobile_android_artifact_mode"), +- ("GeckoView/Firefox for Android", "mobile_android"), +- ("SpiderMonkey JavaScript engine", "js"), ++ ("Noraneko for Desktop Artifact Mode", "browser_artifact_mode"), ++ ("Noraneko for Desktop", "browser"), + ] + ) + +@@ -474,7 +461,8 @@ class Bootstrapper(object): + elif git and checkout_type == "git": + should_configure_git = False + if not self.instance.no_interactive: +- should_configure_git = self.instance.prompt_yesno(prompt=CONFIGURE_GIT) ++ # ! No need to configure git-cinnabar because of noraneko repo cannot be merged to mozilla-central by compartibility. ++ should_configure_git = False + else: + # Assuming default configuration setting applies to all VCS. + should_configure_git = self.hg_configure diff --git a/.github/patches/upstream/common.nsh.patch b/.github/patches/upstream/common.nsh.patch new file mode 100644 index 0000000000000..f525220c1d876 --- /dev/null +++ b/.github/patches/upstream/common.nsh.patch @@ -0,0 +1,13 @@ +diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh +index a5e3977fb0..d270753bb4 100755 +--- a/toolkit/mozapps/installer/windows/nsis/common.nsh ++++ b/toolkit/mozapps/installer/windows/nsis/common.nsh +@@ -538,7 +538,7 @@ + + ; Add our subdirectory, this is hardcoded as grandparent of the update directory in + ; several other places. +- StrCpy $0 "$0\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38" ++ StrCpy $0 "$0\Noraneko-1de4eec8-1241-4177-a864-e594e8d1fb38" + + Exch $0 ; Restore original $0 and put our $0 on the stack. + FunctionEnd diff --git a/.github/patches/upstream/commonupdatedir.cpp.patch b/.github/patches/upstream/commonupdatedir.cpp.patch new file mode 100644 index 0000000000000..930753785b765 --- /dev/null +++ b/.github/patches/upstream/commonupdatedir.cpp.patch @@ -0,0 +1,13 @@ +diff --git a/toolkit/mozapps/update/common/commonupdatedir.cpp b/toolkit/mozapps/update/common/commonupdatedir.cpp +index 0ba9fcef94..fa5de48e8b 100644 +--- a/toolkit/mozapps/update/common/commonupdatedir.cpp ++++ b/toolkit/mozapps/update/common/commonupdatedir.cpp +@@ -43,7 +43,7 @@ + // this problem in the future, we are including a UUID in the root update + // directory name to attempt to ensure that it will be created by this code and + // won't already exist with the wrong permissions. +-# define ROOT_UPDATE_DIR_NAME "Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38" ++# define ROOT_UPDATE_DIR_NAME "Noraneko-1de4eec8-1241-4177-a864-e594e8d1fb38" + // This describes the directory between the "Mozilla" directory and the install + // path hash (i.e. C:\ProgramData\Mozilla\\) + # define UPDATE_PATH_MID_DIR_NAME "updates" diff --git a/.github/patches/upstream/googleBreakpadGitignore.patch b/.github/patches/upstream/googleBreakpadGitignore.patch new file mode 100644 index 0000000000000..d070e73329a47 --- /dev/null +++ b/.github/patches/upstream/googleBreakpadGitignore.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/crashreporter/google-breakpad/.gitignore b/toolkit/crashreporter/google-breakpad/.gitignore +index 058e18361b..f1ac232767 100644 +--- a/toolkit/crashreporter/google-breakpad/.gitignore ++++ b/toolkit/crashreporter/google-breakpad/.gitignore +@@ -85,6 +85,6 @@ src/Makefile + + # Ignore directories gclient syncs. + src/testing +-src/third_party/lss ++# src/third_party/lss + src/third_party/protobuf + src/tools/gyp diff --git a/.github/patches/upstream/matchPattern.patch b/.github/patches/upstream/matchPattern.patch new file mode 100644 index 0000000000000..b85faeb66fb13 --- /dev/null +++ b/.github/patches/upstream/matchPattern.patch @@ -0,0 +1,13 @@ +diff --git a/toolkit/components/extensions/MatchPattern.cpp b/toolkit/components/extensions/MatchPattern.cpp +index 6a627650d675f..14fbcb8d80209 100644 +--- a/toolkit/components/extensions/MatchPattern.cpp ++++ b/toolkit/components/extensions/MatchPattern.cpp +@@ -80,7 +80,7 @@ bool AtomSet::Intersects(const AtomSet& aOther) const { + return atomSet.forget(); \ + } + +-DEFINE_STATIC_ATOM_SET(PermittedSchemes, nsGkAtoms::http, nsGkAtoms::https, ++DEFINE_STATIC_ATOM_SET(PermittedSchemes, nsGkAtoms::http, nsGkAtoms::https, nsGkAtoms::about, + nsGkAtoms::ws, nsGkAtoms::wss, nsGkAtoms::file, + nsGkAtoms::ftp, nsGkAtoms::data); + diff --git a/.github/patches/upstream/moz.configure.patch b/.github/patches/upstream/moz.configure.patch new file mode 100644 index 0000000000000..c8ad6011b2418 --- /dev/null +++ b/.github/patches/upstream/moz.configure.patch @@ -0,0 +1,13 @@ +diff --git a/browser/moz.configure b/browser/moz.configure +index e605019172..782e1ca956 100644 +--- a/browser/moz.configure ++++ b/browser/moz.configure +@@ -13,7 +13,7 @@ imply_option("MOZ_NORMANDY", True) + imply_option("MOZ_PROFILE_MIGRATOR", True) + + +-imply_option("MOZ_APP_VENDOR", "Mozilla") ++imply_option("MOZ_APP_VENDOR", "Noraneko Community") + imply_option("MOZ_APP_ID", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") + # Include the DevTools client, not just the server (which is the default) + imply_option("MOZ_DEVTOOLS", "all") diff --git a/.github/patches/upstream/nsAppRunner.cpp.patch b/.github/patches/upstream/nsAppRunner.cpp.patch new file mode 100644 index 0000000000000..09959f1a4386d --- /dev/null +++ b/.github/patches/upstream/nsAppRunner.cpp.patch @@ -0,0 +1,73 @@ +diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp +index b088f4abae..c620b56657 100644 +--- a/toolkit/xre/nsAppRunner.cpp ++++ b/toolkit/xre/nsAppRunner.cpp +@@ -266,6 +266,19 @@ + # include "DBusService.h" + #endif + ++/* ++* NORANEKO PATCH ++* [updater] ++* START ++*/ ++#include "mozilla/Try.h" ++#include "mozilla/URLPreloader.h" ++/* ++* NORANEKO PATCH ++* [updater] ++* END ++*/ ++ + extern uint32_t gRestartMode; + extern void InstallSignalHandlers(const char* ProgramName); + +@@ -3426,6 +3439,48 @@ static bool CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, + return false; + } + ++ /* ++ * NORANEKO PATCH ++ * [updater] ++ * START ++ */ ++ { ++ auto _NRReadString = [](nsIFile* aFile, nsACString& buildid) -> nsresult { ++ MOZ_TRY_VAR(buildid, URLPreloader::ReadFile(aFile)); ++ return NS_OK; ++ }; ++ nsCOMPtr buildid2_profile; ++ aProfileDir->Clone(getter_AddRefs(buildid2_profile)); ++ if (!buildid2_profile) return false; ++ buildid2_profile->AppendNative("buildid2"_ns); ++ ++ nsCString buildid2_profile_string; ++ rv = _NRReadString(buildid2_profile,buildid2_profile_string); ++ if (NS_FAILED(rv)) { ++ return false; ++ } ++ ++ nsCOMPtr buildid2_appDir; ++ aAppDir->Clone(getter_AddRefs(buildid2_appDir)); ++ if (!buildid2_appDir) return false; ++ buildid2_appDir->AppendNative("buildid2"_ns); ++ ++ nsCString buildid2_appDir_string; ++ rv = _NRReadString(buildid2_appDir,buildid2_appDir_string); ++ if (NS_FAILED(rv)) { ++ return false; ++ } ++ ++ if (!buildid2_profile_string.Equals(buildid2_appDir_string)) { ++ return false; ++ } ++ } ++ /* ++ * NORANEKO PATCH ++ * [updater] ++ * END ++ */ ++ + // If we get here, the version matched, but there may still be other + // differences between us and the build that the profile last ran under. + diff --git a/.github/patches/upstream/nsIUpdateService.idl.patch b/.github/patches/upstream/nsIUpdateService.idl.patch new file mode 100644 index 0000000000000..342122c5b8fad --- /dev/null +++ b/.github/patches/upstream/nsIUpdateService.idl.patch @@ -0,0 +1,31 @@ +diff --git a/toolkit/mozapps/update/nsIUpdateService.idl b/toolkit/mozapps/update/nsIUpdateService.idl +index 984542db48..f5b2b08671 100644 +--- a/toolkit/mozapps/update/nsIUpdateService.idl ++++ b/toolkit/mozapps/update/nsIUpdateService.idl +@@ -228,6 +228,26 @@ interface nsIUpdate : nsISupports + * @returns The DOM Element created by the serialization process + */ + Element serialize(in Document updates); ++ ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * (add version2 for updating source without rebuilding binary) ++ * * START ++ */ ++ /** ++ * The Noraneko version of this update. ++ */ ++ readonly attribute AString appVersion2; ++ /** ++ * The Noraneko buildid of this update. ++ */ ++ readonly attribute AString buildID2; ++ /** ++ * * NORANEKO PATCH - 0.1.0 ++ * * [UPDATER] ++ * * END ++ */ + }; + + /** diff --git a/.github/patches/upstream/removed-files.in.patch b/.github/patches/upstream/removed-files.in.patch new file mode 100644 index 0000000000000..a9ed2b8ffa71e --- /dev/null +++ b/.github/patches/upstream/removed-files.in.patch @@ -0,0 +1,28 @@ +diff --git a/browser/installer/removed-files.in b/browser/installer/removed-files.in +index ec9b6b075a..4ff09bf86e 100644 +--- a/browser/installer/removed-files.in ++++ b/browser/installer/removed-files.in +@@ -65,13 +65,16 @@ + # support. This made it possible to delete all of the removal instructions in + # this file. + +-# Remove the toplevel chrome.manifest added by bug 1295542. +-#ifndef MOZ_GTK +- @DIR_MACOS@chrome.manifest +- #ifdef XP_MACOSX +- @DIR_RESOURCES@chrome.manifest +- #endif +-#endif ++# --- Noraneko Patch Start --- ++# This blocks to package with `ac_add_options --enable-chrome-format=flat` ++# # Remove the toplevel chrome.manifest added by bug 1295542. ++# #ifndef MOZ_GTK ++# @DIR_MACOS@chrome.manifest ++# #ifdef XP_MACOSX ++# @DIR_RESOURCES@chrome.manifest ++# #endif ++# #endif ++# --- Noraneko Patch End --- + + # channel-prefs.js has been removed on macOS. + #ifdef XP_MACOSX diff --git a/.github/patches/upstream/shared.nsh.patch b/.github/patches/upstream/shared.nsh.patch new file mode 100644 index 0000000000000..6c3336104996b --- /dev/null +++ b/.github/patches/upstream/shared.nsh.patch @@ -0,0 +1,13 @@ +diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh +index 32b4ff5586..203f61ed6d 100755 +--- a/browser/installer/windows/nsis/shared.nsh ++++ b/browser/installer/windows/nsis/shared.nsh +@@ -869,7 +869,7 @@ ${RemoveDefaultBrowserAgentShortcut} + ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 + ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0 + ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 +- ${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0 ++ ${WriteRegStr2} $1 "$0" "Publisher" "Noraneko Community" 0 + ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 + DeleteRegValue SHCTX "$0" "URLInfoAbout" + ; Don't add URLUpdateInfo which is the release notes url except for the release diff --git a/.github/workflows/README b/.github/workflows/README deleted file mode 100644 index 4e5f9713c7eca..0000000000000 --- a/.github/workflows/README +++ /dev/null @@ -1,7 +0,0 @@ -IMPORTANT - -All changes and/or additions to GitHub Workflows MUST be approved by the -Mozilla GitHub Enterprise Administrators Team. - -See https://mozilla-hub.atlassian.net/l/cp/f5ypVsa7 for contact information, or -reach out on Matrix: https://chat.mozilla.org/#/room/#github-admin:mozilla.org diff --git a/.github/workflows/build/dmg-floorp-base.zip b/.github/workflows/build/dmg-floorp-base.zip new file mode 100644 index 0000000000000..b98b4192ba875 Binary files /dev/null and b/.github/workflows/build/dmg-floorp-base.zip differ diff --git a/.github/workflows/close-pr.yml b/.github/workflows/close-pr.yml deleted file mode 100644 index a881cde247f6c..0000000000000 --- a/.github/workflows/close-pr.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: close pull request -on: - pull_request_target: - types: [opened, reopened] -jobs: - run: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - with: - sparse-checkout: "README.txt" - sparse-checkout-cone-mode: false - - name: close - env: - GH_TOKEN: ${{ github.token }} - PR: ${{ github.event.number }} - run: | - gh pr close ${{ env.PR }} --comment "(Automated Close) Please do not file pull requests here, see https://firefox-source-docs.mozilla.org/contributing/how_to_submit_a_patch.html" - gh pr lock ${{ env.PR }} diff --git a/.github/workflows/linux_aarch64_build.yml b/.github/workflows/linux_aarch64_build.yml new file mode 100644 index 0000000000000..83b3096294431 --- /dev/null +++ b/.github/workflows/linux_aarch64_build.yml @@ -0,0 +1,121 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +on: + workflow_call: + inputs: + debug: + type: boolean + default: true + +jobs: + linux-build: + runs-on: ubuntu-latest + steps: + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "latest" + + - name: Clone 🧬 + uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Configure sccache + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + # - name: Setup Rust πŸ¦€ + # run: | + # rustup default nightly + # rustup target add aarch64-unknown-linux-gnu + # export CARGO_INCREMENTAL=0 + + - name: Setup Rust πŸ¦€ + run: | + rustup default stable + rustup target add aarch64-unknown-linux-gnu + export CARGO_INCREMENTAL=0 + + - name: Allocate swap + run: | + echo "Before:" + free -h + df -h + + sudo swapoff /mnt/swapfile || true + sudo rm /mnt/swapfile || true + sudo fallocate -l 20G /mnt/swapfile + sudo chmod 600 /mnt/swapfile + sudo mkswap /mnt/swapfile + sudo swapon /mnt/swapfile + + sudo apt autoremove -y + sudo apt clean + sudo rm -rf ./git /home/linuxbrew /usr/share/dotnet /usr/local/lib/android /usr/local/graalvm + sudo rm -rf /usr/local/share/powershell /usr/local/share/chromium /opt/ghc /usr/local/share/boost + sudo rm -rf /etc/apache2 /etc/nginx /usr/local/share/chrome_driver /usr/local/share/edge_driver + sudo rm -rf /usr/local/share/gecko_driver /usr/share/java /usr/share/miniconda /usr/local/share/vcpkg + + echo "After:" + free -h + df -h + + - name: Setup πŸͺ› + run: | + cd $GITHUB_WORKSPACE + git submodule update --remote + cp ./.github/workflows/mozconfigs/linux64-aarch64.mozconfig mozconfig + cp -r ./noraneko/gecko/branding/* ./browser/branding/ + sudo apt install msitools -y + + echo "mk_add_options 'export RUSTC_WRAPPER=/home/runner/.mozbuild/sccache/sccache'" >> mozconfig + echo "mk_add_options 'export CCACHE_CPP2=yes'" >> mozconfig + echo "ac_add_options --with-ccache=/home/runner/.mozbuild/sccache/sccache" >> mozconfig + echo "mk_add_options 'export SCCACHE_GHA_ENABLED=on'" >> mozconfig + + if [[ $GHA_debug == 'true' ]]; then + echo "ac_add_options --enable-debug" >> mozconfig + git apply --ignore-space-change --reject --ignore-whitespace .github/patches/dev/*.patch + fi + + ./mach --no-interactive bootstrap --application-choice browser + env: + GHA_debug: ${{ inputs.debug }} + + - name: Mach Configure + run: | + ./mach configure + + - name: Build πŸ”¨ + run: | + ./mach build + ./mach package + rm -rf ~/.cargo + + # Publish START + - name: Extract Package πŸ“¦ + run: | + cd obj-aarch64-unknown-linux-gnu/dist/ + mkdir ~/output + cp noraneko-*.tar.bz2 ~/output + + - name: Publish Package Mozilla Artifact🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-linux-amd64-moz-artifact + path: obj-aarch64-unknown-linux-gnu/dist/noraneko-*.tar.bz2 + + - name: Publish Package 🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-linux-amd64-dev + path: ~/output/ + # Publish END diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml new file mode 100644 index 0000000000000..feaa28b810f7b --- /dev/null +++ b/.github/workflows/linux_build.yml @@ -0,0 +1,121 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +on: + workflow_call: + inputs: + debug: + type: boolean + default: true + +jobs: + linux-build: + runs-on: ubuntu-latest + steps: + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "latest" + + - name: Clone 🧬 + uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Configure sccache + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + # - name: Setup Rust πŸ¦€ + # run: | + # rustup default nightly + # rustup target add x86_64-unknown-linux-gnu + # export CARGO_INCREMENTAL=0 + + - name: Setup Rust πŸ¦€ + run: | + rustup default stable + rustup target add x86_64-unknown-linux-gnu + export CARGO_INCREMENTAL=0 + + - name: Allocate swap + run: | + echo "Before:" + free -h + df -h + + sudo swapoff /mnt/swapfile || true + sudo rm /mnt/swapfile || true + sudo fallocate -l 20G /mnt/swapfile + sudo chmod 600 /mnt/swapfile + sudo mkswap /mnt/swapfile + sudo swapon /mnt/swapfile + + sudo apt autoremove -y + sudo apt clean + sudo rm -rf ./git /home/linuxbrew /usr/share/dotnet /usr/local/lib/android /usr/local/graalvm + sudo rm -rf /usr/local/share/powershell /usr/local/share/chromium /opt/ghc /usr/local/share/boost + sudo rm -rf /etc/apache2 /etc/nginx /usr/local/share/chrome_driver /usr/local/share/edge_driver + sudo rm -rf /usr/local/share/gecko_driver /usr/share/java /usr/share/miniconda /usr/local/share/vcpkg + + echo "After:" + free -h + df -h + + - name: Setup πŸͺ› + run: | + cd $GITHUB_WORKSPACE + git submodule update --remote + cp ./.github/workflows/mozconfigs/linux64.mozconfig mozconfig + cp -r ./noraneko/gecko/branding/* ./browser/branding/ + sudo apt install msitools -y + + echo "mk_add_options 'export RUSTC_WRAPPER=/home/runner/.mozbuild/sccache/sccache'" >> mozconfig + echo "mk_add_options 'export CCACHE_CPP2=yes'" >> mozconfig + echo "ac_add_options --with-ccache=/home/runner/.mozbuild/sccache/sccache" >> mozconfig + echo "mk_add_options 'export SCCACHE_GHA_ENABLED=on'" >> mozconfig + + if [[ $GHA_debug == 'true' ]]; then + echo "ac_add_options --enable-debug" >> mozconfig + git apply --ignore-space-change --reject --ignore-whitespace .github/patches/dev/*.patch + fi + + ./mach --no-interactive bootstrap --application-choice browser + env: + GHA_debug: ${{ inputs.debug }} + + - name: Mach Configure + run: | + ./mach configure + + - name: Build πŸ”¨ + run: | + ./mach build + ./mach package + rm -rf ~/.cargo + + # Publish START + - name: Extract Package πŸ“¦ + run: | + cd obj-x86_64-pc-linux-gnu/dist/ + mkdir ~/output + cp noraneko-*.tar.bz2 ~/output + + - name: Publish Package Mozilla Artifact🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-linux-amd64-moz-artifact + path: obj-x86_64-pc-linux-gnu/dist/noraneko-*.tar.bz2 + + - name: Publish Package 🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-linux-amd64-dev + path: ~/output/ + # Publish END diff --git a/.github/workflows/mac_build.yml b/.github/workflows/mac_build.yml new file mode 100644 index 0000000000000..2f0df03f416ce --- /dev/null +++ b/.github/workflows/mac_build.yml @@ -0,0 +1,226 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +on: + workflow_call: + inputs: + release: + type: boolean + default: true + beta: + type: boolean + default: false + debug: + type: boolean + default: true + code-coverage: + type: boolean + default: false + profile-generate-mode: + type: boolean + default: false + build-with-profdata-and-jarlog: + type: boolean + required: false + MOZ_BUILD_DATE: + type: string + required: true + default: "" + +jobs: + mac-build: + runs-on: ${{ matrix.runs-on }} + strategy: + matrix: + runs-on: ["ubuntu-latest"] + arch: [x86_64, aarch64] + steps: + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "latest" + + - name: Clone 🧬 + uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Configure sccache + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: setup Rust πŸ¦€ + run: | + # Install Rust if pgo_artifact_name is not empty + if [[ -n $GHA_pgo_artifact_name ]]; then + rustup toolchain install 1.81.0 + rustup default 1.81.0 + fi + + if [[ $GHA_ARCH == 'x86_64' ]];then + rustup target add x86_64-apple-darwin + else + rustup target add aarch64-apple-darwin + fi + + #? https://github.com/mozilla/sccache#known-caveats + export CARGO_INCREMENTAL=0 + env: + GHA_ARCH: ${{matrix.arch}} + GHA_pgo_artifact_name: ${{inputs.build-with-profdata-and-jarlog}} + + - name: Allocate swap + run: | + echo Before: + free -h + df -h + + echo + echo + + sudo swapoff /mnt/swapfile + sudo rm /mnt/swapfile + sudo fallocate -l 10G /mnt/swapfile + sudo chmod 600 /mnt/swapfile + sudo mkswap /mnt/swapfile + sudo swapon /mnt/swapfile + + sudo apt autoremove -y + sudo apt clean + sudo rm -rf ./git + sudo rm -rf /home/linuxbrew + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/local/graalvm + sudo rm -rf /usr/local/share/powershell + sudo rm -rf /usr/local/share/chromium + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /etc/apache2 + sudo rm -rf /etc/nginx + sudo rm -rf /usr/local/share/chrome_driver + sudo rm -rf /usr/local/share/edge_driver + sudo rm -rf /usr/local/share/gecko_driver + sudo rm -rf /usr/share/java + sudo rm -rf /usr/share/miniconda + sudo rm -rf /usr/local/share/vcpkg + + echo + echo + + echo After: + free -h + df -h + + - name: Download PGO Artifact if exists + if: inputs.build-with-profdata-and-jarlog + uses: actions/download-artifact@v4 + with: + name: firefox-${{ matrix.arch }}-apple-darwin-profdata-and-jarlog + path: ~/artifacts + + - name: Setup πŸͺ› + run: | + if [[ -n ${{ inputs.MOZ_BUILD_DATE }} ]];then + export MOZ_BUILD_DATE=${{ inputs.MOZ_BUILD_DATE }} + fi + + cd $GITHUB_WORKSPACE + + if [[ $GHA_ARCH == 'x86_64' ]];then + cp ./.github/workflows/mozconfigs/macosx64-x86_64.mozconfig mozconfig + else + cp ./.github/workflows/mozconfigs/macosx64-aarch64.mozconfig mozconfig + fi + + # Set Branding + echo "ac_add_options --with-branding=browser/branding/official" >> mozconfig + + sudo apt install msitools -y + + # SCCACHE START + echo "mk_add_options 'export RUSTC_WRAPPER=/home/runner/.mozbuild/sccache/sccache'" >> mozconfig + echo "mk_add_options 'export CCACHE_CPP2=yes'" >> mozconfig + echo "ac_add_options --with-ccache=/home/runner/.mozbuild/sccache/sccache" >> mozconfig + echo "mk_add_options 'export SCCACHE_GHA_ENABLED=on'" >> mozconfig + # SCCACHE END + + # Chrome Format + echo "ac_add_options --enable-chrome-format=flat" >> mozconfig + # Enable Flat Package + + # Debug + if [[ $GHA_debug == 'true' ]]; then + echo "ac_add_options --enable-debug" >> mozconfig + fi + + if [[ $GHA_profgen == 'true' ]]; then + echo 'ac_add_options --enable-profile-generate=cross' >> mozconfig + elif [[ $GHA_profdata_jarlog_artifact_name == 'true' ]]; then + echo 'export MOZ_LTO=cross' >> mozconfig + echo 'ac_add_options --enable-profile-use=cross' >> mozconfig + echo 'ac_add_options --with-pgo-profile-path=$(echo ~)/artifacts/merged.profdata' >> mozconfig + echo 'ac_add_options --with-pgo-jarlog=$(echo ~)/artifacts/en-US.log' >> mozconfig + fi + + ./mach --no-interactive bootstrap --application-choice browser + env: + GHA_ARCH: ${{matrix.arch}} + GHA_debug: ${{inputs.debug}} + GHA_release: ${{inputs.release}} + GHA_codecov: ${{inputs.code-coverage}} + GHA_profgen: ${{ inputs.profile-generate-mode }} + GHA_profdata_jarlog_artifact_name : ${{inputs.build-with-profdata-and-jarlog}} + GHA_BETA: ${{ inputs.beta }} + + - name: Mach Configure + run: | + if [[ -n ${{ inputs.MOZ_BUILD_DATE }} ]];then + export MOZ_BUILD_DATE=${{ inputs.MOZ_BUILD_DATE }} + fi + + ./mach configure + + - name: Build πŸ”¨ + run: | + if [[ -n ${{ inputs.MOZ_BUILD_DATE }} ]];then + export MOZ_BUILD_DATE=${{ inputs.MOZ_BUILD_DATE }} + fi + + ./mach build + ./mach package + + - name: Copy & Compress Artifacts πŸ“ + run: | + mkdir ~/output + if [[ $GHA_ARCH == 'aarch64' ]];then + arch="aarch64" + else + arch="x86_64" + fi + + if [[ $GHA_profgen = 'true' ]];then + tar zcvf ${arch}-apple-darwin-output.tar.xz ./obj-${arch}-apple-darwin/dist/*.dmg + mv ${arch}-apple-darwin-output.tar.xz ~/output/ + else + tar -czf firefox-${arch}-apple-darwin-with-pgo.tar.gz ./obj-${arch}-apple-darwin/dist/ + mv firefox-${arch}-apple-darwin-with-pgo.tar.gz ~/output/ + fi + env: + GHA_profgen: ${{ inputs.profile-generate-mode }} + GHA_ARCH: ${{ matrix.arch }} + + # Publish START + - name: Publish Package🎁 + uses: actions/upload-artifact@v4 + with: + name: firefox-mac-${{ matrix.arch }}-${{fromJson('["package","build-with-profgen"]')[inputs.profile-generate-mode]}} + compression-level: 9 + path: ~/output/ + # Publish END diff --git a/.github/workflows/mac_integration.yml b/.github/workflows/mac_integration.yml new file mode 100644 index 0000000000000..8ad32cca1774c --- /dev/null +++ b/.github/workflows/mac_integration.yml @@ -0,0 +1,180 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Please write our copyright if you use this file. +# Β© 2023 Floorp Projects & Contributors + +#! SELF HOST DOES NOT SUPPORTED +#TODO: separate Publish to other workflow + +on: + workflow_call: + inputs: + x86_64_artifact_name: + type: string + default: "" + aarch64_artifact_name: + type: string + default: "" + beta: + type: boolean + default: false + MOZ_BUILD_DATE: + type: string + default: "" + secrets: + APPLE_DEVELOPER_P12_BASE64: + description: "macOS CERTIFICATES P12 For App BASE64" + required: true + APPLE_DEVELOPER_P12_PASSWORD: + description: "macOS CERTIFICATES P12 PASSWORD" + required: true + APPLE_DEVELOPER_ID: + description: "macOS AppleDeveloperId" + required: true + APPLE_DEVELOPER_ACCOUNT_EMAIL: + description: "macOS AppleAccountId" + required: true + APPLE_DEVELOPER_TEAM_ID: + description: "macOS AppleTeamId" + required: true + APPLE_DEVELOPER_ACCOUNT_APP_SPESIFIC_PASSWORD: + description: "macOS AppleAccountAppSpecificPassword" + required: true + +jobs: + Integration: + runs-on: macos-latest + steps: + - name: Delete SDK artifact + uses: geekyeggo/delete-artifact@v5 + with: + name: macos-sdk-package + + - name: Clone πŸ“₯ + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: download AArch64 build artifact πŸ“₯ + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.aarch64_artifact_name }} + path: ./ + + - name: download x86_64 build artifact πŸ“₯ + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.x86_64_artifact_name }} + path: ./ + + - name: Extract πŸ“¦ + run: | + brew install gnu-tar + export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH + tar -xf ./firefox-x86_64-apple-darwin-with-pgo.tar.gz + tar -xf ./firefox-aarch64-apple-darwin-with-pgo.tar.gz + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Check Branding Type + shell: bash + run: | + if [[ $GHA_BETA == 'true' ]]; then + export APP_NAME=`echo "Firefox"` + echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV + else + export APP_NAME=`echo "Firefox"` + echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV + fi + env: + GHA_BETA: ${{ inputs.beta }} + + - name: Create environment 🌲 + shell: bash + run: | + ./mach --no-interactive bootstrap --application-choice browser + echo -e "ac_add_options --enable-bootstrap" >> mozconfig + ./mach configure + + - name: Install apple-codesign 🍎 + run: | + cargo install apple-codesign + + - name: Extract .app from dmg πŸ“¦ + run: | + rm -rf "./obj-x86_64-apple-darwin/dist/firefox/*.app" + rm -rf "./obj-aarch64-apple-darwin/dist/firefox/*.app" + + hdiutil attach ./obj-x86_64-apple-darwin/dist/firefox*.mac.dmg + cp -r "/Volumes/Firefox/${{ env.APP_NAME }}.app" ./obj-x86_64-apple-darwin/dist/firefox/ + + hdiutil detach /Volumes/Firefox/ + + hdiutil attach ./obj-aarch64-apple-darwin/dist/firefox*.mac.dmg + cp -r "/Volumes/Firefox/${{ env.APP_NAME }}.app" ./obj-aarch64-apple-darwin/dist/firefox/ + + hdiutil detach /Volumes/Firefox/ + + - name: Integration πŸ—ƒ + run: | + ./mach python "./toolkit/mozapps/installer/unify.py" "./obj-x86_64-apple-darwin/dist/firefox/${{ env.APP_NAME }}.app" "./obj-aarch64-apple-darwin/dist/firefox/${{ env.APP_NAME }}.app" + + - name: create .p12 for codesign πŸ–ŠοΈ + run: | + echo ${{ secrets.APPLE_DEVELOPER_P12_BASE64 }} > floorp-cert.txt + base64 --decode -i floorp-cert.txt -o floorpCert.p12 + echo ${{ secrets.APPLE_DEVELOPER_P12_PASSWORD }} > floorpCertPassword.passwd + + - name: Sign to .app πŸ–‹οΈ + run: | + ./mach macos-sign -v -r -c "release" -a "./obj-x86_64-apple-darwin/dist/firefox/${{ env.APP_NAME }}.app" --rcodesign-p12-file floorpCert.p12 --rcodesign-p12-password-file floorpCertPassword.passwd + + - name: Create DMG πŸ“¦ + run: | + ./mach python -m mozbuild.action.make_dmg ./obj-x86_64-apple-darwin/dist/firefox firefox-macOS-universal-temp.dmg + unzip "./.github/workflows/build/dmg-floorp-base.zip" + hdiutil attach ./firefox-macOS-universal-temp.dmg + hdiutil attach ./base.dmg + + cp -r "/Volumes/Firefox/${{ env.APP_NAME }}.app" /Volumes/Floorp\ Installer/ + hdiutil detach /Volumes/Floorp\ Installer/ + hdiutil convert ./base.dmg -format UDZO -imagekey zlib-level=9 -o firefox-macOS-universal.dmg + + - name: import APPLE DEVELOPER ID CERTIFICATE for .dmg πŸ”‘ + uses: apple-actions/import-codesign-certs@v3 + with: + p12-file-base64: ${{ secrets.APPLE_DEVELOPER_P12_BASE64 }} + p12-password: ${{ secrets.APPLE_DEVELOPER_P12_PASSWORD }} + + - name: Sign to .dmg πŸ–‹οΈ + run: | + codesign -s "${{ secrets.APPLE_DEVELOPER_ID }}" Firefox-macOS-universal.dmg + + xcrun notarytool submit "Firefox-macOS-universal.dmg" \ + --apple-id "${{ secrets.APPLE_DEVELOPER_ACCOUNT_EMAIL }}" \ + --team-id "${{ secrets.APPLE_DEVELOPER_TEAM_ID }}" \ + --password "${{ secrets.APPLE_DEVELOPER_ACCOUNT_APP_SPESIFIC_PASSWORD }}" \ + --wait + + mkdir -p ./output + mv ./Firefox-macOS-universal.dmg ./output/Firefox-macOS-universal.dmg + + - name: Publish 🎁 + uses: actions/upload-artifact@v4 + with: + name: macOS-universal-integrated-signed-dmg + if-no-files-found: ignore + path: | + ./output/ + + - name: Publish + uses: actions/upload-artifact@v4 + with: + name: macOS-universal-integrated-signed-package + if-no-files-found: ignore + path: | + ./obj-x86_64-apple-darwin/ diff --git a/.github/workflows/mac_pgo.yml b/.github/workflows/mac_pgo.yml new file mode 100644 index 0000000000000..109a81092d52b --- /dev/null +++ b/.github/workflows/mac_pgo.yml @@ -0,0 +1,108 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Please write our copyright if you use this file. +# Β© 2023 Floorp Projects & Contributors + +on: + workflow_call: + +jobs: + macOS-Universal-gen-profdata-and-jarlog: + runs-on: ${{ matrix.runs-on }} + strategy: + matrix: + runs-on: [macos-13, macos-14] + # macos-latest-large is x86_64 and macos-latest is arm64 + + steps: + - name: Init + run: | + sysctl machdep.cpu + export RUNNER_USERDIR=`echo ~` + echo "RUNNER_USERDIR=$RUNNER_USERDIR" >> $GITHUB_ENV + mkdir -p ~/downloads/artifacts + + - uses: actions/checkout@v4 + name: Clone 🧬 + with: + submodules: 'recursive' + + - name: Check Arch type + shell: bash + run: | + if [[ $GHA_BUILD_MACHINE != 'macos-13' ]]; then + export ARCH_TYPE=`echo "aarch64"` + echo "ARCH_TYPE=$ARCH_TYPE" >> $GITHUB_ENV + else + export ARCH_TYPE=`echo "x86_64"` + echo "ARCH_TYPE=$ARCH_TYPE" >> $GITHUB_ENV + fi + env: + GHA_BUILD_MACHINE: ${{ matrix.runs-on }} + + - uses: actions/download-artifact@v4 + id: download-artifacts-mac-enable-profgen + name: Download artifact πŸ“₯ + with: + name: firefox-mac-${{ env.ARCH_TYPE }}-build-with-profgen + path: ~/downloads/artifacts + + - name: force install python3.12 + continue-on-error: true + run: | + brew install python@3.12 + + - name: force link python3.12 + continue-on-error: true + run: | + # due to "Error: The `brew link` step did not complete successfully" we need to force link python3.12 + brew link --force --overwrite python@3.12 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: setup environment 🌲 + run: | + echo -e "ac_add_options --enable-bootstrap" >> mozconfig + + echo 'mozconfig: **********************' + cat ./mozconfig + echo '*********************************' + + ./mach bootstrap --application-choice browser + - name: Install setup tool via PIP πŸ“¦ + run: | + pip install setuptools + + - name: Extract artifact πŸ“‚ + run: | + mkdir -p ./firefox + cp ${{ steps.download-artifacts-mac-enable-profgen.outputs.download-path }}/${ARCH_TYPE}-apple-darwin-output.tar.xz ./ + tar xf ${ARCH_TYPE}-apple-darwin-output.tar.xz + +## ./mach python python/mozbuild/mozbuild/action/install.py $MOZ_FETCHES_DIR/target.dmg $MOZ_FETCHES_DIR + - name: Generate Profdata πŸ“Š + run: | + export LLVM_PROFDATA=$RUNNER_USERDIR/.mozbuild/clang/bin/llvm-profdata + export JARLOG_FILE="en-US.log" + sudo hdiutil attach ./obj-*/dist/*.dmg + ls /Volumes/Firefox + mkdir temptemp + sudo cp -rP /Volumes/Firefox/* ./temptemp + ls ./temptemp + sudo hdiutil unmount /Volumes/Firefox + + # chmod u+x ./temptemp/Firefox.app/Contents/MacOS/firefox + ./mach python build/pgo/profileserver.py --binary ./temptemp/Firefox.app/Contents/MacOS/firefox + env: + GHA_BUILD_MACHINE: ${{ matrix.runs-on }} + + - name: Publish 🎁 + uses: actions/upload-artifact@v4 + with: + name: firefox-${{ env.ARCH_TYPE }}-apple-darwin-profdata-and-jarlog + path: | + merged.profdata + en-US.log diff --git a/.github/workflows/mozconfigs/linux64-aarch64.mozconfig b/.github/workflows/mozconfigs/linux64-aarch64.mozconfig new file mode 100644 index 0000000000000..6cf958d5f5bf8 --- /dev/null +++ b/.github/workflows/mozconfigs/linux64-aarch64.mozconfig @@ -0,0 +1,32 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +ac_add_options --with-app-name=noraneko +ac_add_options --with-app-basename=Noraneko +ac_add_options --disable-updater +# this implies disable geckodriver, and puppeteer seems using the geckodriver impl. +# so you should not disable test +# ac_add_options --disable-tests +ac_add_options --disable-crashreporter +ac_add_options --enable-bootstrap +ac_add_options --enable-rust-simd +#? https://bugzilla.mozilla.org/show_bug.cgi?id=1617793 +#? https://phabricator.services.mozilla.com/D170170 +ac_add_options --target=aarch64-unknown-linux-gnu +#sccache +#mk_add_options 'export RUSTC_WRAPPER=sccache' +#mk_add_options 'export CCACHE_CPP2=yes' +#ac_add_options --with-ccache +#mk_add_options 'export SCCACHE_GHA_ENABLED=on' +mk_add_options AUTOCLOBBER=1 +#Telemetry +#https://searchfox.org/mozilla-central/rev/893f350260faac2ee6bf2b14c627d55eb2babfb0/toolkit/components/telemetry/docs/internals/preferences.rst +# Disable telemetry +ac_add_options MOZ_TELEMETRY_REPORTING= +# Set branding +ac_add_options --with-branding=browser/branding/noraneko-unofficial +# Package js shell. +export MOZ_PACKAGE_JSSHELL=1 +# Use Flat package for dev +ac_add_options --enable-chrome-format=flat diff --git a/.github/workflows/mozconfigs/linux64.mozconfig b/.github/workflows/mozconfigs/linux64.mozconfig new file mode 100644 index 0000000000000..dc2c595bff912 --- /dev/null +++ b/.github/workflows/mozconfigs/linux64.mozconfig @@ -0,0 +1,32 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +ac_add_options --with-app-name=noraneko +ac_add_options --with-app-basename=Noraneko +ac_add_options --disable-updater +# this implies disable geckodriver, and puppeteer seems using the geckodriver impl. +# so you should not disable test +# ac_add_options --disable-tests +ac_add_options --disable-crashreporter +ac_add_options --enable-bootstrap +ac_add_options --enable-rust-simd +#? https://bugzilla.mozilla.org/show_bug.cgi?id=1617793 +#? https://phabricator.services.mozilla.com/D170170 +ac_add_options --target=x86_64-pc-linux-gnu +#sccache +#mk_add_options 'export RUSTC_WRAPPER=sccache' +#mk_add_options 'export CCACHE_CPP2=yes' +#ac_add_options --with-ccache +#mk_add_options 'export SCCACHE_GHA_ENABLED=on' +mk_add_options AUTOCLOBBER=1 +#Telemetry +#https://searchfox.org/mozilla-central/rev/893f350260faac2ee6bf2b14c627d55eb2babfb0/toolkit/components/telemetry/docs/internals/preferences.rst +# Disable telemetry +ac_add_options MOZ_TELEMETRY_REPORTING= +# Set branding +ac_add_options --with-branding=browser/branding/noraneko-unofficial +# Package js shell. +export MOZ_PACKAGE_JSSHELL=1 +# Use Flat package for dev +ac_add_options --enable-chrome-format=flat diff --git a/.github/workflows/mozconfigs/macosx64-aarch64.mozconfig b/.github/workflows/mozconfigs/macosx64-aarch64.mozconfig new file mode 100644 index 0000000000000..7e0e176e11903 --- /dev/null +++ b/.github/workflows/mozconfigs/macosx64-aarch64.mozconfig @@ -0,0 +1,26 @@ +ac_add_options --with-app-name=floorp +ac_add_options --with-app-basename=Floorp + +ac_add_options --target=aarch64-apple-darwin + +ac_add_options --disable-crashreporter +ac_add_options --enable-proxy-bypass-protection +ac_add_options --enable-unverified-updates +ac_add_options --enable-update-channel=release +ac_add_options --disable-tests +ac_add_options --enable-rust-simd +ac_add_options --enable-release +ac_add_options --enable-bootstrap +ac_add_options --enable-lto +ac_add_options --enable-updater + +ac_add_options RUSTC_OPT_LEVEL=3 + +MOZ_REQUIRE_SIGNING= +MOZ_DATA_REPORTING= +MOZ_TELEMETRY_REPORTING= + +export HOST_CXXFLAGS=-g +export HOST_CFLAGS=-g +export HOST_LDFLAGS=-g + diff --git a/.github/workflows/mozconfigs/macosx64-x86_64.mozconfig b/.github/workflows/mozconfigs/macosx64-x86_64.mozconfig new file mode 100644 index 0000000000000..a25c71649ece4 --- /dev/null +++ b/.github/workflows/mozconfigs/macosx64-x86_64.mozconfig @@ -0,0 +1,26 @@ +ac_add_options --with-app-name=floorp +ac_add_options --with-app-basename=Floorp + +ac_add_options --target=x86_64-apple-darwin + +ac_add_options --disable-crashreporter +ac_add_options --enable-proxy-bypass-protection +ac_add_options --enable-unverified-updates +ac_add_options --enable-update-channel=release +ac_add_options --disable-tests +ac_add_options --enable-rust-simd +ac_add_options --enable-release +ac_add_options --enable-bootstrap +ac_add_options --enable-lto +ac_add_options --enable-updater + +ac_add_options RUSTC_OPT_LEVEL=3 + +MOZ_REQUIRE_SIGNING= +MOZ_DATA_REPORTING= +MOZ_TELEMETRY_REPORTING= + +export HOST_CXXFLAGS=-g +export HOST_CFLAGS=-g +export HOST_LDFLAGS=-g + diff --git a/.github/workflows/mozconfigs/win64.mozconfig b/.github/workflows/mozconfigs/win64.mozconfig new file mode 100644 index 0000000000000..a19d8afe8eb02 --- /dev/null +++ b/.github/workflows/mozconfigs/win64.mozconfig @@ -0,0 +1,31 @@ +ac_add_options --with-app-name=noraneko +ac_add_options --with-app-basename=Noraneko +ac_add_options --disable-maintenance-service +# ac_add_options --disable-updater +## this implies disable geckodriver, and puppeteer seems using the geckodriver impl. +## so you should not disable test +ac_add_options --disable-tests +ac_add_options --disable-crashreporter +ac_add_options --enable-bootstrap +ac_add_options --enable-rust-simd +#? https://bugzilla.mozilla.org/show_bug.cgi?id=1617793 +#? https://phabricator.services.mozilla.com/D170170 +ac_add_options --target=x86_64-pc-windows-msvc +#sccache +#mk_add_options 'export RUSTC_WRAPPER=sccache' +#mk_add_options 'export CCACHE_CPP2=yes' +#ac_add_options --with-ccache +#mk_add_options 'export SCCACHE_GHA_ENABLED=on' +mk_add_options AUTOCLOBBER=1 +#Telemetry +#https://searchfox.org/mozilla-central/rev/893f350260faac2ee6bf2b14c627d55eb2babfb0/toolkit/components/telemetry/docs/internals/preferences.rst +# Disable telemetry +ac_add_options MOZ_TELEMETRY_REPORTING= +# Set branding +ac_add_options --with-branding=browser/branding/noraneko-unofficial +# Package js shell. +export MOZ_PACKAGE_JSSHELL=1 +ac_add_options --enable-unverified-updates +ac_add_options --enable-update-channel=release +# Use Flat package for dev +ac_add_options --enable-chrome-format=flat diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000000000..b917efb3be737 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,106 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +name: "(A) πŸ“¦οΈ Package" + +on: + workflow_dispatch: + inputs: + platform: + type: choice + options: + - win-x64 + - linux-x64 + artifact_workflow_run_id: + type: string + required: true + +run-name: πŸ“¦οΈ Package ${{inputs.platform == 'win-x64' && 'Windows x64' || 'Linux x64'}} +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: "recursive" + - name: Configure sccache + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: setup Rust πŸ¦€ + run: | + rustup default nightly + rustup target add x86_64-pc-windows-msvc + + #? https://github.com/mozilla/sccache#known-caveats + export CARGO_INCREMENTAL=0 + - name: Setup πŸͺ› + run: | + cd $GITHUB_WORKSPACE + + # update noraneko to latest + git submodule update --remote + + cp ./.github/workflows/mozconfigs/win64.mozconfig mozconfig + + # Copy Noraneko Branding + cp -r ./noraneko/gecko/branding/* ./browser/branding/ + + sudo apt install msitools -y + + #if [[ $GHA_debug == 'true' ]]; then + # echo "ac_add_options --enable-debug" >> mozconfig + #fi + + ./mach --no-interactive bootstrap --application-choice browser + - name: Mach configure + run: | + echo "ac_add_options --enable-artifact-builds" >> mozconfig + ./mach configure + git apply --ignore-space-change --ignore-whitespace .github/patches/packaging/*.patch + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{inputs.platform == 'win-x64' && 'noraneko-win-amd64-moz-artifact'}} + run-id: ${{inputs.artifact_workflow_run_id}} + github-token: ${{github.token}} + path: ~/ + + - uses: pnpm/action-setup@v4 + with: + version: 9 + run_install: false + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Build noraneko + run: | + cd ./noraneko + pnpm install + NODE_ENV='production' pnpm build --release-build-before + cd .. + + - name: build + run: | + MOZ_ARTIFACT_FILE=$(echo ~/noraneko-*.win64.zip) ./mach build + - name: Inject noraneko + run: | + cd ./noraneko + pnpm build --release-build-after + cd .. + - name: Package noraneko + run: | + ./mach package + - name: Publish Package 🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-win-amd64-moz-artifact + path: obj-x86_64-pc-windows-msvc/dist/noraneko-*.zip + - name: Publish Installer 🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-win-amd64-installer + path: obj-x86_64-pc-windows-msvc/dist/install/sea/* diff --git a/.github/workflows/pull-upstream.yml b/.github/workflows/pull-upstream.yml new file mode 100644 index 0000000000000..ac79ca000cdac --- /dev/null +++ b/.github/workflows/pull-upstream.yml @@ -0,0 +1,53 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +name: Pull Upstream +on: + workflow_dispatch: +permissions: + contents: write +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + path: "nyanrus_release" + fetch-depth: 0 + - name: clone upstream + run: | + git clone -b release --single-branch https://github.com/mozilla/gecko-dev --depth 1 upstream_release + rm -rf ./upstream_release/.git ./upstream_release/.github + mv ./upstream_release/README.txt ./upstream_release/MOZ_README.txt + - name: copy upstream to this_repo + run: | + rsync -aq --progress upstream_release/ temp_release + cp -r ./nyanrus_release/.git temp_release + cp -r ./nyanrus_release/.github temp_release + cp ./nyanrus_release/.gitmodules temp_release + cp -r ./nyanrus_release/noraneko temp_release + cp ./nyanrus_release/README.md temp_release + - id: apply-git-patches + name: apply git patches + continue-on-error: true + run: | + cd temp_release + git apply --ignore-space-change --reject --ignore-whitespace .github/patches/upstream/*.patch + cp -f .github/assets/installer/setup.ico other-licenses/7zstub/firefox/setup.ico + cp -f .github/assets/installer/7zSD.ARM64.sfx other-licenses/7zstub/firefox/7zSD.ARM64.sfx + cp -f .github/assets/installer/7zSD.Win32.sfx other-licenses/7zstub/firefox/7zSD.Win32.sfx + - name: detect patch error + if: ${{ steps.apply-git-patches.outcome == 'failure' }} + run: | + echo "Patch Error!" + exit 1 + - name: push + run: | + cd temp_release + export FF_VERSION=$(cat browser/config/version.txt) + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "sync upstream gecko-dev $FF_VERSION" + git push diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml new file mode 100644 index 0000000000000..25117b75fce20 --- /dev/null +++ b/.github/workflows/windows_build.yml @@ -0,0 +1,228 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +on: + workflow_call: + inputs: + release: + type: boolean + default: false + debug: + type: boolean + default: true + package-moz-artifact: + type: boolean + default: false + code-coverage: + type: boolean + default: false + profile-generate-mode: + type: boolean + default: false + pgo_artifact_name: + type: string + required: false + +jobs: + win-build: + runs-on: ubuntu-latest + steps: + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "latest" + - uses: actions/checkout@v4 + name: Clone 🧬 + with: + submodules: "recursive" + + - name: Configure sccache + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: setup Rust πŸ¦€ + run: | + # Install Rust if pgo_artifact_name is not empty + if [[ -n $GHA_pgo_artifact_name ]]; then + rustup toolchain install 1.81.0 + rustup default 1.81.0 + fi + + rustup target add x86_64-pc-windows-msvc + rustc --version --verbose + #? https://github.com/mozilla/sccache#known-caveats + export CARGO_INCREMENTAL=0 + env: + GHA_pgo_artifact_name: ${{inputs.pgo_artifact_name}} + + - name: Allocate swap + run: | + echo Before: + free -h + df -h + + echo + echo + + sudo swapoff /mnt/swapfile + sudo rm /mnt/swapfile + sudo fallocate -l 30G /mnt/swapfile + sudo chmod 600 /mnt/swapfile + sudo mkswap /mnt/swapfile + sudo swapon /mnt/swapfile + + sudo apt autoremove -y + sudo apt clean + sudo rm -rf ./git + sudo rm -rf /home/linuxbrew + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/local/graalvm + sudo rm -rf /usr/local/share/powershell + sudo rm -rf /usr/local/share/chromium + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /etc/apache2 + sudo rm -rf /etc/nginx + sudo rm -rf /usr/local/share/chrome_driver + sudo rm -rf /usr/local/share/edge_driver + sudo rm -rf /usr/local/share/gecko_driver + sudo rm -rf /usr/share/java + sudo rm -rf /usr/share/miniconda + sudo rm -rf /usr/local/share/vcpkg + + + echo + echo + + echo After: + free -h + df -h + + - name: Download PGO Artifact if exists + if: inputs.pgo_artifact_name + uses: actions/download-artifact@v4 + with: + name: ${{inputs.pgo_artifact_name}} + path: ~/artifacts + + - name: Setup πŸͺ› + run: | + cd $GITHUB_WORKSPACE + + # update noraneko to latest + git submodule update --remote + + cp ./.github/workflows/mozconfigs/win64.mozconfig mozconfig + + # Copy Noraneko Branding + cp -r ./noraneko/gecko/branding/* ./browser/branding/ + + sudo apt install msitools -y + + # SCCACHE START + echo "mk_add_options 'export RUSTC_WRAPPER=/home/runner/.mozbuild/sccache/sccache'" >> mozconfig + echo "mk_add_options 'export CCACHE_CPP2=yes'" >> mozconfig + echo "ac_add_options --with-ccache=/home/runner/.mozbuild/sccache/sccache" >> mozconfig + echo "mk_add_options 'export SCCACHE_GHA_ENABLED=on'" >> mozconfig + # SCCACHE END + + + if [[ $GHA_debug == 'true' ]]; then + echo "ac_add_options --enable-debug" >> mozconfig + echo "ac_add_options RUSTC_OPT_LEVEL=3" >> mozconfig + git apply --ignore-space-change --reject --ignore-whitespace .github/patches/dev/*.patch + fi + if [[ $GHA_release == 'true' ]]; then + echo "ac_add_options --enable-release" >> mozconfig + # https://searchfox.org/mozilla-central/rev/c169f7d0287c1a6a5dd7469864135e605eed765f/docs/setup/configuring_build_options.rst#259 + fi + if [[ $GHA_codecov == 'true' ]]; then + echo "ac_add_options --enable-coverage" >> mozconfig + #https://searchfox.org/mozilla-central/rev/abeb2aa5df6f02de3c12c54ff7b0865c34c3fde9/browser/config/mozconfigs/win64/code-coverage#10 + echo "export LIB=\"$(cd ~/.mozbuild/clang/lib/clang/* && cd lib/windows && pwd)\"" >> mozconfig + echo 'export LDFLAGS="clang_rt.profile-x86_64.lib"' >> mozconfig + + echo 'export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Cpanic=abort -Zpanic_abort_tests -Coverflow-checks=off"' >> mozconfig + echo 'export RUSTDOCFLAGS="-Cpanic=abort"' >> mozconfig + fi + + # PGO START + if [[ $GHA_profgen == 'true' ]]; then + echo 'ac_add_options --enable-profile-generate=cross' >> mozconfig + elif [[ -n $GHA_pgo_artifact_name ]]; then + # https://searchfox.org/mozilla-central/source/build/mozconfig.common#26 + echo 'export MOZ_LTO=cross' >> mozconfig + echo 'ac_add_options --enable-profile-use=cross' >> mozconfig + echo 'ac_add_options --with-pgo-profile-path=$(echo ~)/artifacts/merged.profdata' >> mozconfig + echo 'ac_add_options --with-pgo-jarlog=$(echo ~)/artifacts/en-US.log' >> mozconfig + fi + # PGO END + + echo "ac_add_options --enable-update-channel=alpha" >> mozconfig + # echo "ac_add_options --with-version-file-path=noraneko/gecko/config" >> mozconfig + sed -i 's|https://@MOZ_APPUPDATE_HOST@/update/6/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%SYSTEM_CAPABILITIES%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml|https://github.com/nyanrus/noraneko/releases/download/%CHANNEL%/%BUILD_TARGET%.update.xml|g' ./build/application.ini.in + + ./mach --no-interactive bootstrap --application-choice browser + env: + GHA_debug: ${{inputs.debug}} + GHA_release: ${{inputs.release}} + GHA_codecov: ${{inputs.code-coverage}} + GHA_profgen: ${{inputs.profile-generate-mode}} + GHA_pgo_artifact_name: ${{inputs.pgo_artifact_name}} + + - name: Mach Configure + run: | + ./mach configure + + - name: Build πŸ”¨ + run: | + + ./mach build + + ./mach package + rm -rf ~/.cargo + + # Publish START + # Remove same name uploaded artifacts + - name: Remove same name uploaded artifacts + uses: geekyeggo/delete-artifact@v5 + with: + name: | + noraneko-win-amd64-dev + noraneko-win-amd64-moz-artifact + noraneko-win-amd64-profile-generate-mode + noraneko-dist-host + + - name: Publish Package🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-win-amd64-dev + path: obj-x86_64-pc-windows-msvc/dist/noraneko-*.zip + + - name: Publish Package Mozilla Artifact🎁 + if: inputs.package-moz-artifact + uses: actions/upload-artifact@v4 + with: + name: noraneko-win-amd64-moz-artifact + path: obj-x86_64-pc-windows-msvc/dist/noraneko-*.zip + + - name: Publish dist/* for generate profile + if: inputs.profile-generate-mode + uses: actions/upload-artifact@v4 + with: + name: noraneko-win-amd64-profile-generate-mode + path: obj-x86_64-pc-windows-msvc/dist/ + + - name: Publish dist/host for MAR + uses: actions/upload-artifact@v4 + with: + name: noraneko-dist-host + path: obj-x86_64-pc-windows-msvc/dist/host/ + # Publish END diff --git a/.github/workflows/windows_pgo.yml b/.github/workflows/windows_pgo.yml new file mode 100644 index 0000000000000..ddb62f74e86c2 --- /dev/null +++ b/.github/workflows/windows_pgo.yml @@ -0,0 +1,55 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Please write our copyright if you use this file. +# Β© 2023 Floorp Projects & Contributors + +on: + workflow_call: + inputs: + browser-artifact-name: + description: 'Artifact to download' + required: true + default: 'noraneko-win-amd64-profile-generate-mode' + type: string + +jobs: + Generate-Profile-data-and-jarlog: + runs-on: windows-latest + steps: + - uses: actions/download-artifact@v4 + name: Download artifact πŸ“₯ + with: + name: ${{ inputs.browser-artifact-name }} + path: C:\artifact + + - uses: actions/checkout@v4 + name: Clone 🧬 + with: + submodules: 'recursive' + + - name: Setup πŸͺ› + run: | + (New-Object System.Net.WebClient).DownloadFile("https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe","C:\MozillaBuildSetup-Latest.exe") + C:\MozillaBuildSetup-Latest.exe /S | out-null + + - name: Generate πŸ”„ + run: | + $Env:USE_MINTTY = "0" + + $workspace_dir = [regex]::replace($env:GITHUB_WORKSPACE, "^([A-Z]):", { "/" + $args.value.Substring(0, 1).toLower() }) -replace "\\","/" + + echo "cd $workspace_dir" '' >> mozilla-build-run.sh + echo 'export PATH=/c/mozilla-build/msys2/usr/bin:$PATH' '' >> mozilla-build-run.sh + echo './mach --no-interactive bootstrap --application-choice browser' '' >> mozilla-build-run.sh + echo 'LLVM_PROFDATA=/c/Users/runneradmin/.mozbuild/clang/bin/llvm-profdata.exe JARLOG_FILE=en-US.log ./mach python build/pgo/profileserver.py --binary /c/artifact/noraneko/noraneko.exe' '' >> mozilla-build-run.sh + C:\mozilla-build\start-shell.bat $workspace_dir\mozilla-build-run.sh + + - name: Publish 🎁 + uses: actions/upload-artifact@v4 + with: + name: noraneko-win-amd64-profile-generate-output + path: | + merged.profdata + en-US.log diff --git a/.github/workflows/wrapper_linux_aarch64_build.yml b/.github/workflows/wrapper_linux_aarch64_build.yml new file mode 100644 index 0000000000000..9922deae05614 --- /dev/null +++ b/.github/workflows/wrapper_linux_aarch64_build.yml @@ -0,0 +1,22 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +name: "(A) βš’ Linux AArch build" + +on: + workflow_dispatch: + inputs: + debug: + type: boolean + required: true + +run-name: Linux AArch64 build +jobs: + run-main: + name: Linux-AArch64 + uses: ./.github/workflows/linux_aarch64_build.yml + with: + debug: ${{inputs.debug}} diff --git a/.github/workflows/wrapper_linux_build.yml b/.github/workflows/wrapper_linux_build.yml new file mode 100644 index 0000000000000..16934463f2852 --- /dev/null +++ b/.github/workflows/wrapper_linux_build.yml @@ -0,0 +1,22 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +name: "(A) βš’ Linux build" + +on: + workflow_dispatch: + inputs: + debug: + type: boolean + required: true + +run-name: Linux x64 build +jobs: + run-main: + name: Linux-x64 + uses: ./.github/workflows/linux_build.yml + with: + debug: ${{inputs.debug}} diff --git a/.github/workflows/wrapper_mac_build.yml b/.github/workflows/wrapper_mac_build.yml new file mode 100644 index 0000000000000..dcc7d5cf998a4 --- /dev/null +++ b/.github/workflows/wrapper_mac_build.yml @@ -0,0 +1,62 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +name: "(A) βš’ Mac build" + +on: + workflow_dispatch: + inputs: + debug: + type: boolean + required: true + beta: + type: boolean + required: true + +run-name: Mac build +jobs: + get-buildid: + runs-on: ubuntu-latest + outputs: + buildids: ${{ steps.get.outputs.bid }} + steps: + - id: get + shell: bash -xe {0} + run: | + bdat=`date +"%Y%m%d%I%M%S"` + echo "bid=${bdat}" >> $GITHUB_OUTPUT + + part1: + needs: [get-buildid] + uses: ./.github/workflows/mac_build.yml + with: + debug: ${{inputs.debug}} + MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}} + profile-generate-mode: true + + part2: + needs: [get-buildid, part1] + uses: ./.github/workflows/mac_pgo.yml + + part3: + needs: [get-buildid, part1, part2] + uses: ./.github/workflows/mac_build.yml + with: + debug: ${{inputs.debug}} + MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}} + build-with-profdata-and-jarlog: true + beta: ${{inputs.beta}} + + part4: + needs: [get-buildid, part1, part2, part3] + uses: ./.github/workflows/mac_integration.yml + secrets: inherit + with: + x86_64_artifact_name: floorp-mac-x86_64-package + aarch64_artifact_name: floorp-mac-aarch64-package + MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}} + beta: ${{inputs.beta}} + diff --git a/.github/workflows/wrapper_windows_build.yml b/.github/workflows/wrapper_windows_build.yml new file mode 100644 index 0000000000000..1e430314500fb --- /dev/null +++ b/.github/workflows/wrapper_windows_build.yml @@ -0,0 +1,62 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Β© 2023 Floorp Projects & Contributors + +name: "(A) βš’ Windows build" + +on: + workflow_dispatch: + inputs: + release: + type: boolean + required: true + debug: + type: boolean + required: true + package-moz-artifact: + type: boolean + required: true + code-coverage: + type: boolean + required: true + profile-generate-mode: + type: boolean + default: false + required: true + +run-name: ${{toJSON(inputs.profile-generate-mode) == 'true' && '[PGO] ' || ''}}Windows x64 build${{toJSON(inputs.debug) == 'true' && ' Debug' || ''}}${{toJSON(inputs.release) == 'true' && ' Release' || ''}}${{toJSON(inputs.package-moz-artifact) == 'true' && ' Moz-Artifact' || ''}}${{toJSON(inputs.code-coverage)=='true'&&' codecov'||''}} +jobs: + part-1: + name: Windows x64 build${{toJSON(inputs.debug) == 'true' && ' Debug' || ''}}${{toJSON(inputs.release) == 'true' && ' Release' || ''}}${{toJSON(inputs.package-moz-artifact) == 'true' && ' Moz-Artifact' || ''}}${{toJSON(inputs.code-coverage)=='true'&&' codecov'||''}} + uses: ./.github/workflows/windows_build.yml + secrets: inherit + with: + debug: ${{inputs.debug}} + package-moz-artifact: ${{ inputs.profile-generate-mode == 'true' && '' || inputs.package-moz-artifact }} + release: ${{inputs.release}} + code-coverage: ${{inputs.code-coverage}} + profile-generate-mode: ${{inputs.profile-generate-mode}} + + part-2: + name: Windows x64 Generate Profile for Guided Optimazation + if: inputs.profile-generate-mode + needs: part-1 + uses: ./.github/workflows/windows_pgo.yml + secrets: inherit + with: + browser-artifact-name: noraneko-win-amd64-profile-generate-mode + + part-3: + name: Windows x64 build${{toJSON(inputs.debug) == 'true' && ' Debug' || ''}}${{toJSON(inputs.release) == 'true' && ' Release' || ''}}${{toJSON(inputs.package-moz-artifact) == 'true' && ' Moz-Artifact' || ''}}${{toJSON(inputs.code-coverage)=='true'&&' codecov'||''}} + if: inputs.profile-generate-mode + needs: part-2 + uses: ./.github/workflows/windows_build.yml + secrets: inherit + with: + debug: ${{inputs.debug}} + package-moz-artifact: ${{inputs.package-moz-artifact}} + release: ${{inputs.release}} + code-coverage: ${{inputs.code-coverage}} + pgo_artifact_name: noraneko-win-amd64-profile-generate-output