MSYS2 Website Documentation

repository·main·Indexed 25 days ago

https://github.com/msys2/msys2.github.io

Source files and development guides for the MSYS2 website. Includes instructions for local preview using properdocs and mkdocs-material, building msys2-fonts via npm, and detailed technical documentation on the MSYS2 automated build process, Azure Artifact Signing, keyring management, and mirror synchronization using rsync.

Tokens
28.3K
Snippets
70
Records
198
Agent score
85%

What's inside msys2-msys2.github.io

  1. Third-party communication in MSYS2 packages

    main
    Software packaged within the MSYS2 repository may communicate with third-party servers for functional, analytics, or other purposes. Users should consult the specific upstream documentation for any package to understand its external communication behavior.
  2. Understand the purpose of MSYS2

    main
    MSYS2 provides a native build environment based on open source software. It is designed to provide a Linux-like experience on Windows, specifically optimized for building native Windows programs using Windows APIs. It is not a general-purpose Linux subsystem, but a toolset for native development.
  3. Understand MSYS2 package repositories and management

    main

    MSYS2 uses the pacman package manager (from Arch Linux) and organizes software into three distinct repositories based on their purpose and target architecture:

    • msys2: Contains software that depends on the MSYS2 runtime (POSIX-emulation layer).
    • mingw64: Contains 64-bit native Windows software (compiled with the mingw-w64 x86_64 toolchain).
    • mingw32: Contains 32-bit native Windows software (compiled with the mingw-w64 i686 toolchain).

    This differs from Cygwin, which primarily provides Cygwin-dependent software via its own setup.exe manager.

  4. Understand MSYS2 Subsystems

    main

    MSYS2 is composed of three distinct subsystems, each with its own package repository and purpose:

    • mingw32 and mingw64: These are the primary focus of MSYS2. They provide native Windows programs built via the MinGW-w64 project. Programs in these subsystems are designed to cooperate seamlessly with other native Windows software.
    • msys2: Provides an emulated, mostly-POSIX-compliant environment based on Cygwin. It is used for shell scripting, package management, and building software that requires a Unix-like environment. These programs live in a virtual single-root filesystem.

    Toolchains:

    • Native toolchains are available in mingw-w64-i686-toolchain and mingw-w64-x86_64-toolchain.
    • Cross-compiler toolchains exist in mingw-w64-cross-toolchain but have limited utility due to a lack of library packages.
  5. Understand MSYS2 Package Repositories

    main

    MSYS2 uses three primary repositories. Choosing the correct one depends on whether your software requires POSIX emulation or is a native Windows application:

    • msys: Contains software that depends on msys-2.0.dll (similar to Cygwin). Use this for POSIX-like tools.
    • mingw32: Contains native Windows software targeting the 32-bit environment.
    • mingw64: Contains native Windows software targeting the 64-bit environment.

    Note: Native Windows software should link dynamically to msvcrt.dll and should not depend on msys-2.0.dll.

  6. Check supported Windows versions for MSYS2

    main

    MSYS2 support varies depending on whether you are using the GUI installer, the packages themselves, or the toolchains for building software.

    GUI Installer

    Requires 64-bit Windows 10 (1809+) or Windows Server 2019.

    Packages

    • Msys/Cygwin Packages: Requires 64-bit Windows 10 or Windows Server 2016.
    • Mingw Packages: Requires 64-bit Windows 10 or Windows Server 2016.

    Toolchains (Targeting Windows)

    • MINGW32/MINGW64 environments: Can still target Windows 7+.
    • All other environments: Allow targeting Windows 10+.
  7. Ways to contribute to the MSYS2 project

    main

    The MSYS2 project accepts various forms of contribution. You can help by:

    • Package Management: Prepare and maintain packages, or improve core packages.
    • Software Development: Fix bugs, triage bugs, report bugs, or provide upstream patches.
    • User Support: Help other users and spread the word about MSYS2.
    • Documentation: Write documentation for the project.
    • Infrastructure & Operations: Help with organization or infrastructure, or provide mirrors.
    • Adoption: Use MSYS2 for your own projects.
    • Financial Support: Donate to the project.
  8. Understand how MSYS2 package mirrors work

    main

    MSYS2 distributes packages via multiple mirror servers. By default, the package manager pacman automatically selects the best available mirror based on the order defined in specific configuration files.

    pacman checks mirrors in this order:

    • /etc/pacman.d/mirrorlist.mingw (for mingw packages)
    • /etc/pacman.d/mirrorlist.msys (for msys packages)

    Key mirror entries:

    • mirror.msys2.org: A special geo-redirector that automatically routes you to the nearest tier 1 mirror.
    • repo.msys2.org: The main package server.
    • Other entries: Third-party mirrors.
  9. Understand the difference between Terminals and Shells in MSYS2

    main

    In the MSYS2 environment, it is important to distinguish between the terminal emulator and the shell:

    • Terminal Emulator: The program that interfaces with console programs to handle input (keypresses) and output (drawing glyphs). For MSYS2, Mintty is the recommended terminal emulator as it provides the necessary POSIX interfaces.
    • Shell: The program that reads commands and executes them (e.g., bash).

    While a Mintty window typically runs a bash shell, these are distinct components. You can run a Windows shell (like cmd) inside Mintty, or an MSYS2 shell (like bash) inside a Windows console (conhost).

  10. Understand the MSYS2 Automated Build Process

    main

    The MSYS2 build pipeline automates the transition from a PKGBUILD change in the MINGW-packages git repository to a package being available in the pacman repository.

    1. Trigger: A git push to the MINGW-packages repository triggers GitHub Actions (GHA) to parse the PKGBUILDs and upload them to packages.msys2.org.
    2. Polling: packages.msys2.org fetches the parsed PKGBUILDs every 5 minutes.
    3. Build Loop: Every 2 hours, msys2-autobuild triggers a cron job in GHA. GHA fetches the TODO list from the API, fetches the PKGBUILDs from Git, fetches staging from msys2-autobuild, builds the packages, and uploads them back to msys2-autobuild.
    4. Release: Developers fetch the built packages from msys2-autobuild, sign them, and push them to the pacman repository.
  11. Launch an MSYS2 environment

    main

    You can launch specific MSYS2 environments using one of three methods:

    1. Wrapper Executables: Use the dedicated executables for the environment (e.g., ucrt64.exe).
    2. msys2_shell.cmd with parameters: Call the shell script with a matching environment flag (e.g., msys2_shell.cmd -clang64).
    3. MSYSTEM environment variable: Set the MSYSTEM environment variable before running the shell.
    msys2_shell.cmd -clang64