No description
Find a file
2024-12-08 21:08:58 +01:00
patches updated DoH and ui-cleanup 2024-12-08 21:08:58 +01:00
main.go updated patch system 2024-12-08 17:51:31 +01:00
pref.go fixed type pref 2024-12-08 18:22:32 +01:00
README.md added patches 2024-12-08 20:26:13 +01:00
run.sh updated patch system 2024-12-08 17:51:31 +01:00
standard.go updated patch system 2024-12-08 17:51:31 +01:00

Logo

Spitfire Patcher

This is a custom patcher for applying modifications to firefox source code. It processes patch files located in the `./patches` directory and applies them to files in a specified root path.

How to Use

  1. Place your patch files in the ./patches directory. Example of patch file:

    i:/browser/branding/official/configure.sh
    o:/browser/branding/official/configure.sh
    
    -MOZ_APP_DISPLAYNAME=Firefox
    +MOZ_APP_DISPLAYNAME=Spitfire
    
  2. Run the patcher with the --path flag:

    ./run.sh --path ./mozilla-central
    

Root path will be resolved to an absolute path, and patches will be applied relative to this path.

Parameters Explained

Here are the details of each parameter used in the patching system:

i: (Input)

  • Specifies the input file to which the patch should be applied.

  • This is the file that will be read and modified based on the patch instructions.

  • Example:

    i:/browser/branding/official/configure.sh
    
    • This means the input file is located at /browser/branding/official/configure.sh.

o: (Output)

  • Specifies the output file where the modified content will be saved.

  • If the input and output paths are the same, the original file will be overwritten.

  • Example:

    o:/browser/branding/official/configure.sh
    
    • This means the output file is /browser/branding/official/configure.sh.

t: (Type)

  • Defines the type of patch being applied. This parameter can be skipped if not applicable.
  • Common types:
    1. pref: Indicates that the patch is modifying preference settings (e.g., Firefox prefs.js).
      • When t:pref is specified, the script will search for existing preferences in the input file and replace them with the new ones provided in the patch. If not found, it will add the new preference.
      • Example:
        t:pref
        +pref("extensions.getAddons.showPane", false); // HIDDEN
        
    2. standard: Standard patching type that follows the + (add) and - (remove) syntax.
      • Used for general file modifications.
      • Example:
        -MOZ_APP_DISPLAYNAME=Firefox
        +MOZ_APP_DISPLAYNAME=Spitfire
        
  • When to Use:
    • Required for specialized processing: If the patch involves specific logic, like handling pref files, include this parameter.
    • Optional for standard patches: For simple addition or removal of lines, you can skip this parameter.

Example Patch File

t:pref
i:/browser/branding/official/configure.sh
o:/browser/branding/official/configure.sh

-pref("browser.privatebrowsing.autostart", false);
+pref("browser.privatebrowsing.autostart", true);

t:standard
i:/browser/app/profile/firefox.js
o:/browser/app/profile/firefox.js

-MOZ_APP_DISPLAYNAME=Firefox
+MOZ_APP_DISPLAYNAME=Spitfire

Summary of Parameters

Parameter Required Purpose Example
i: Yes Specifies the input file path. i:/browser/app/profile/firefox.js
o: Yes Specifies the output file path. o:/browser/app/profile/firefox.js
t: No Defines the type of patch. t:pref or t:standard
+ Yes Adds a line to the output file. +MOZ_APP_DISPLAYNAME=Spitfire
- Yes Removes a line from the input file. -MOZ_APP_DISPLAYNAME=Firefox

Workflow

  1. Define Input and Output: Use i: and o: to specify which files to read and write.
  2. Specify Patch Type: Use t: for special handling like preference modifications.
  3. Apply Modifications: Use + to add lines and - to remove lines.