# thetorproject/tor-messenger-build architecture

> Architecture diagram of the GitHub repository thetorproject/tor-messenger-build, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thetorproject/tor-messenger-build
- Repository: https://github.com/thetorproject/tor-messenger-build

## Overview

##### Project type and purpose
- This is an open-source build orchestration tool (“Tor Messenger Build”) whose goal is to pull in many upstream components (Tor Browser, Thunderbird, libotr, Mozilla, etc.), apply patches, compile them in container environments (via runc), and produce packaged Tor Messenger binaries for multiple platforms.

##### File structure
- Top-level files:
- Makefile: central build orchestrator
- rbm(.conf): build configuration
- keyring/: GPG keys for verifying upstream sources
- projects/: each subdirectory is a component to fetch, patch, configure, build
- tools/: helper scripts (ansible playbooks, packaging tools, cleanup, response-file generators)
- docs/: build and release documentation
- The “tools/ansible” folder contains roles to bootstrap and configure build hosts and build containers.

##### README for additional insights
- The README describes build dependencies, the use of runc for container‐based builds, the Make targets (`make all`, `make fetch`, `make clean-old`, `make tor-messenger-release`), and expected outputs (`out/tor-messenger`, `release/$version`).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Host Infrastructure
    subgraph "Host Infrastructure"
        style HostEnv fill:#cccccc
        HostEnv["Host Build Environment"]:::infra
    end

    %% Provisioner
    Ansible["Ansible Provisioner"]:::orchestrator
    click Ansible "https://github.com/thetorproject/tor-messenger-build/tree/master//tools/ansible"

    %% Orchestrator & Config
    subgraph "Configuration & Orchestrator"
        style Makefile fill:#e0ffe0
        Makefile["Makefile Orchestrator\n(rbm, rbm.conf)"]:::orchestrator
    end
    click Makefile "https://github.com/thetorproject/tor-messenger-build/tree/master//Makefile"
    click Makefile "https://github.com/thetorproject/tor-messenger-build/tree/master//rbm"
    click Makefile "https://github.com/thetorproject/tor-messenger-build/blob/master//rbm.conf"

    %% External Dependencies
    subgraph "External Dependencies"
        style Fetchers fill:#ffe0b3
        Fetchers["Source Fetchers\n(git, hg)"]:::external
        style Keyring fill:#ffe0b3
        Keyring["GPG Keyring"]:::external
    end
    click Fetchers "https://github.com/thetorproject/tor-messenger-build/tree/master//tools/version-control-tools"
    click Keyring "https://github.com/thetorproject/tor-messenger-build/tree/master//keyring"

    %% Project Modules
    subgraph "Project Modules" 
        style Projects fill:#e0f0ff
        Projects["Common Build Helpers"]:::build
        TorMessenger["Tor Messenger"]:::build
        TorBrowser["Tor Browser"]:::build
        Thunderbird["Thunderbird"]:::build
        Libgcrypt["libgcrypt"]:::build
        Libotr["libotr"]:::build
        MozillaCore["Mozilla Core"]:::build
        Instantbird["Instantbird"]:::build
        ContainerTemplate["Container Image Template"]:::build
        PatchConfig["Patch & Config Layer"]:::build
    end
    click Projects "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/common"
    click TorMessenger "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/tor-messenger"
    click TorBrowser "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/tor-browser"
    click Thunderbird "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/thunderbird"
    click Libgcrypt "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/libgcrypt"
    click Libotr "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/libotr"
    click MozillaCore "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/mozilla"
    click Instantbird "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/instantbird"
    click ContainerTemplate "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/container-image"
    click PatchConfig "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/*/config"

    %% Build Containers
    subgraph "Build Containers (OCI via runc)"
        style BuildContainers fill:#e0f0ff
        BuildContainers["Ephemeral Build Container"]:::build
    end
    click BuildContainers "https://github.com/thetorproject/tor-messenger-build/tree/master//projects/container-image"

    %% Packaging Tools
    subgraph "Packaging Tools"
        style Packaging fill:#e0f0ff
        DMG2MAR["dmg2mar"]:::build
        UpdateResponses["update-responses"]:::build
        NSIS["NSIS Scripts"]:::build
    end
    click DMG2MAR "https://github.com/thetorproject/tor-messenger-build/tree/master//tools/dmg2mar"
    click UpdateResponses "https://github.com/thetorproject/tor-messenger-build/tree/master//tools/update-responses"
    click NSIS "https://github.com/thetorproject/tor-messenger-build/blob/master//projects/tor-messenger/tor-messenger.nsi"

    %% Output Repositories
    subgraph "Output Repositories"
        style Output fill:#cccccc
        OutDir["out/"]:::infra
        ReleaseDir["release/"]:::infra
    end

    %% Flows
    HostEnv -->|provisions via| Ansible
    HostEnv -->|runs| Makefile
    Makefile -->|uses| Fetchers
    Makefile -->|verifies via| Keyring
    Fetchers -->|populate| Projects
    Makefile -->|launches| BuildContainers
    Projects -->|mounts into| BuildContainers
    PatchConfig -->|applies in| BuildContainers
    BuildContainers -->|produces artifacts| Packaging
    Packaging -->|outputs installers| OutDir
    Packaging -->|publishes| ReleaseDir

    %% Styles
    classDef orchestrator fill:#e0ffe0,stroke:#333,stroke-width:1px
    classDef build fill:#e0f0ff,stroke:#333,stroke-width:1px
    classDef external fill:#ffe0b3,stroke:#333,stroke-width:1px
    classDef infra fill:#cccccc,stroke:#333,stroke-width:1px
```
