### Example build script for quodlibet Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Distributing.md A base build script from the Quodlibet project, potentially offering insights into creating Windows installers. ```bash #!/bin/bash # # _base.sh # # Base script for building Windows installers for Quodlibet. # This script sets up common variables and functions used by other build scripts. # set -e # --- Configuration --- INSTALL_DIR="/mingw64/install/quodlibet" PACKAGE_NAME="quodlibet" VERSION="$(cat VERSION)" # --- Functions --- # Function to clean the build directory clean_build() { echo "Cleaning build directory..." rm -rf build mkdir build } # Function to install files to the installation directory install_files() { echo "Installing files to $INSTALL_DIR..." mkdir -p "$INSTALL_DIR" cp -r src/* "$INSTALL_DIR/" cp -r data/* "$INSTALL_DIR/" cp "LICENSE" "$INSTALL_DIR/" } # Function to create the installer package create_installer() { echo "Creating installer package..." local package_file="${PACKAGE_NAME}-${VERSION}-setup.exe" # This is a placeholder, actual installer creation would involve tools like NSIS echo "Placeholder: Would create installer '$package_file' here." } # --- Main Execution --- # Call clean_build function clean_build # Call install_files function install_files # Call create_installer function create_installer echo "Build process completed." ``` -------------------------------- ### Install a Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management.md Use `pacman -S` to install a package. If dependencies are missing, pacman will prompt for their installation. ```bash pacman -S ``` -------------------------------- ### Install gsudo using winget Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Sudo.md Use winget to install gsudo. A system reboot may be required. If winget is not available, manual installation instructions should be followed. ```bash winget install gsudo ``` -------------------------------- ### Example deploy.sh script Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Distributing.md A deployment script example from a SourceForge ticket, potentially useful for understanding distribution workflows. ```bash #!/bin/bash # # deploy.sh # # A simple deployment script to upload files to a remote server. # # Usage: # deploy.sh # # Example: # deploy.sh ./dist/ user@example.com /var/www/html LOCAL_DIR="$1" REMOTE_USER="$2" REMOTE_HOST="$3" REMOTE_DIR="$4" rsync -avz "$LOCAL_DIR" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR" ``` -------------------------------- ### Install a Built Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/dev/new-package.md Installs a package that has already been built, typically a *.pkg.tar.zst file generated by makepkg-mingw. ```bash pacman -U *.pkg.tar.zst ``` -------------------------------- ### Install MSYS2 GUI Installer via CLI Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/installer.md Use this command to automate the installation of the MSYS2 GUI installer to a specified root directory. ```powershell .\msys2-x86_64-latest.exe in --confirm-command --accept-messages --root C:/msys64 ``` -------------------------------- ### Install Package with Pacman Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Creating-Packages.md Install a built package using `pacman -U`. Pacman will check for filesystem conflicts. ```bash pacman -U pkgname-pkgver-arch.tar.zst ``` -------------------------------- ### Install Autotools Meta Packages Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/autotools.md Installs the necessary autotools packages for MinGW or MSYS environments. ```bash pacman -S "${MINGW_PACKAGE_PREFIX}-autotools" # for mingw ``` ```bash pacman -S autotools # for msys ``` -------------------------------- ### List Contents of a Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management-tips.md Use this command to see all files installed as part of a specific package. The output shows the package name followed by each installed file path. ```bash pacman -Ql ``` ```bash $ pacman -Ql mingw-w64-x86_64-pugixml mingw-w64-x86_64-pugixml /mingw64/ mingw-w64-x86_64-pugixml /mingw64/bin/ mingw-w64-x86_64-pugixml /mingw64/bin/libpugixml.dll mingw-w64-x86_64-pugixml /mingw64/include/ mingw-w64-x86_64-pugixml /mingw64/include/pugixml-1.8/ mingw-w64-x86_64-pugixml /mingw64/include/pugixml-1.8/pugiconfig.hpp mingw-w64-x86_64-pugixml /mingw64/include/pugixml-1.8/pugixml.hpp mingw-w64-x86_64-pugixml /mingw64/lib/ mingw-w64-x86_64-pugixml /mingw64/lib/cmake/ mingw-w64-x86_64-pugixml /mingw64/lib/cmake/pugixml/ mingw-w64-x86_64-pugixml /mingw64/lib/cmake/pugixml/pugixml-config-noconfig.cmake mingw-w64-x86_64-pugixml /mingw64/lib/cmake/pugixml/pugixml-config.cmake mingw-w64-x86_64-pugixml /mingw64/lib/pkgconfig/ mingw-w64-x86_64-pugixml /mingw64/lib/pkgconfig/pugixml.pc mingw-w64-x86_64-pugixml /mingw64/lib/pugixml-1.8/ mingw-w64-x86_64-pugixml /mingw64/lib/pugixml-1.8/libpugixml.dll.a ``` -------------------------------- ### Search Installed Packages Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management.md Use `pacman -Qs` to search only among the packages that are already installed on your system. ```bash pacman -Qs ``` -------------------------------- ### Install Base Development Packages Source: https://github.com/msys2/msys2.github.io/blob/main/web/dev/new-package.md Installs essential packages required for building other packages. Use `--needed` to avoid reinstalling if already present. ```bash pacman -S --needed base-devel ``` -------------------------------- ### Example Makefile rule for distribution Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Distributing.md A Makefile rule snippet from the GIMX project, demonstrating how to include files in a distribution package. ```makefile # Example Makefile rule for including files in a distribution DIST_FILES = \ src/main.c \ src/utils.c \ include/myheader.h \ README.md dist: $(DIST_FILES) @echo "Creating distribution package..." @tar -czvf mypackage.tar.gz $(DIST_FILES) ``` -------------------------------- ### Set Meson Prefix with MSYS2 Argument Conversion Exclusion Source: https://github.com/msys2/msys2.github.io/blob/main/web/dev/package-guidelines.md This example demonstrates how to configure the Meson build system with a specific installation prefix, using MSYS2_ARG_CONV_EXCL to prevent unintended argument conversion. ```bash MSYS2_ARG_CONV_EXCL="--prefix=" \ meson \ --prefix="${MINGW_PREFIX}" \ ... ``` -------------------------------- ### Windows to Unix Path Conversion Example Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/filesystem-paths.md Demonstrates how Windows paths passed to Cygwin tools might be handled, and how `cygpath` can ensure correct Unix path interpretation. ```shell $ /usr/bin/python3 -c "import sys, os; print(sys.argv, os.listdir(sys.argv[1]))" C:/ ['-c', 'C:/'] ['$Recycle.Bin', '$SysReset', '...'] ``` ```shell $ /usr/bin/python3 -c "import sys, os; print(sys.argv, os.listdir(sys.argv[1]))" "$(cygpath -u C:/)" ['-c', '/c/'] ['$Recycle.Bin', '$SysReset', '...'] ``` -------------------------------- ### Example make-file-list.sh script Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Distributing.md This script is part of the build process for Git for Windows and can be a useful reference for managing file lists during distribution. ```bash #!/bin/sh # # make-file-list.sh # # This script is used to generate a list of files to be included in a # package, based on a list of source files and a set of exclusion patterns. # # Usage: # make-file-list.sh ... # # Example: # make-file-list.sh src/ "$(pkgname)-files.txt" "*.c" "*.h" SOURCE_DIR="$1" OUTPUT_FILE="$2" shift 2 find "$SOURCE_DIR" -type f | grep -vE "$@" > "$OUTPUT_FILE" ``` -------------------------------- ### Install Git in MSYS2 Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/git.md Use pacman to install either the native Windows build of Git or the Cygwin-based Git within the MSYS environment. ```bash pacman -S "$MINGW_PACKAGE_PREFIX-git" # native Windows build of git ``` ```bash pacman -S git # cygwin based git ``` -------------------------------- ### Install GCC Compiler with Pacman Source: https://github.com/msys2/msys2.github.io/blob/main/web/index.md Use the pacman package manager to install the UCRT64 GCC compiler. This command resolves dependencies and prompts for confirmation before installation. ```bash $ pacman -S mingw-w64-ucrt-x86_64-gcc ``` ```text resolving dependencies... looking for conflicting packages... Packages (15) mingw-w64-ucrt-x86_64-binutils-2.41-2 mingw-w64-ucrt-x86_64-crt-git-11.0.0.r216.gffe883434-1 mingw-w64-ucrt-x86_64-gcc-libs-13.2.0-2 mingw-w64-ucrt-x86_64-gmp-6.3.0-2 mingw-w64-ucrt-x86_64-headers-git-11.0.0.r216.gffe883434-1 mingw-w64-ucrt-x86_64-isl-0.26-1 mingw-w64-ucrt-x86_64-libiconv-1.17-3 mingw-w64-ucrt-x86_64-libwinpthread-git-11.0.0.r216.gffe883434-1 mingw-w64-ucrt-x86_64-mpc-1.3.1-2 mingw-w64-ucrt-x86_64-mpfr-4.2.1-2 mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-4 mingw-w64-ucrt-x86_64-winpthreads-git-11.0.0.r216.gffe883434-1 mingw-w64-ucrt-x86_64-zlib-1.3-1 mingw-w64-ucrt-x86_64-zstd-1.5.5-1 mingw-w64-ucrt-x86_64-gcc-13.2.0-2 Total Download Size: 49.38 MiB Total Installed Size: 418.82 MiB :: Proceed with installation? [Y/n] ``` -------------------------------- ### Install Package for i686 Environment using Pacboy Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-naming.md Installs the `x265` package specifically for the `i686` (MINGW32) environment using the `:i` suffix with `pacboy`. ```bash $ pacboy -S x265:i resolving dependencies... looking for conflicting packages... Packages (1) mingw-w64-i686-x265-2.3-1 Total Download Size: 0.97 MiB Total Installed Size: 11.37 MiB :: Proceed with installation? [Y/n] ``` -------------------------------- ### Install Package for Both i686 and x86_64 Environments using Pacboy Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-naming.md Installs the `x265` package for both the `i686` (MINGW32) and `x86_64` (MINGW64) environments using the `:m` suffix with `pacboy`. ```bash $ pacboy -S x265:m resolving dependencies... looking for conflicting packages... Packages (2) mingw-w64-i686-x265-2.3-1 mingw-w64-x86_64-x265-2.3-1 Total Download Size: 0.97 MiB Total Installed Size: 32.09 MiB :: Proceed with installation? [Y/n] ``` -------------------------------- ### Example newer Makefile rule for distribution Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Distributing.md A more recent Makefile rule from the GIMX project, showing an updated approach to managing distribution files. ```makefile # Newer Makefile rule for distribution PACKAGE_NAME = mypackage VERSION = 1.0.0 SOURCE_FILES = \ src/main.c \ src/utils.c \ include/myheader.h \ README.md # Define the files to be included in the distribution archive DIST_FILES = $(SOURCE_FILES) # Target to create the distribution archive dist: clean @echo "Creating $(PACKAGE_NAME)-$(VERSION).tar.gz..." @mkdir -p $(PACKAGE_NAME)-$(VERSION) @cp $(DIST_FILES) $(PACKAGE_NAME)-$(VERSION)/ @tar -czvf $(PACKAGE_NAME)-$(VERSION).tar.gz $(PACKAGE_NAME)-$(VERSION) @rm -rf $(PACKAGE_NAME)-$(VERSION) clean: @rm -f $(PACKAGE_NAME)-*.tar.gz ``` -------------------------------- ### Install Package for x86_64 Environment using Pacboy Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-naming.md Installs the `x265` package specifically for the `x86_64` (MINGW64) environment using the `:x` suffix with `pacboy`. ```bash $ pacboy -S x265:x resolving dependencies... looking for conflicting packages... Packages (1) mingw-w64-x86_64-x265-2.3-1 Total Download Size: 0.97 MiB Total Installed Size: 20.72 MiB :: Proceed with installation? [Y/n] ``` -------------------------------- ### Install clang for ARM64 Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/arm64.md Install the clang compiler for AArch64 architecture using pacman. This is a prerequisite for building native ARM64 applications. ```bash pacman -S mingw-w64-clang-aarch64-clang ``` -------------------------------- ### Install Specific Package Version Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management.md Install older or pre-release versions of packages directly from their archive files (`.tar.zst` or `.tar.xz`). Ensure all necessary dependencies are also available. ```bash pacman -U ``` ```bash pacman -U ``` -------------------------------- ### Show Package License Information Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management-tips.md Use this command to display the license of an installed package. For packages in the sync database, use the -S flag instead of -Q. ```bash $ pacman -Qi meson | grep '^Licenses' Licenses : Apache 2 ``` ```bash $ pacman -Si meson | grep '^Licenses' Licenses : Apache 2 ``` -------------------------------- ### Search for a Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management.md Use `pacman -Ss` to search for packages in the repositories by name or part of the name. This command shows available packages and their installation status. ```bash pacman -Ss ``` ```bash $ pacman -Ss openjp ``` ```text mingw32/mingw-w64-i686-openjpeg 1.5.2-7 An open source JPEG 2000 codec (mingw-w64) mingw32/mingw-w64-i686-openjpeg2 2.1.0-7 An open source JPEG 2000 codec (mingw-w64) mingw64/mingw-w64-x86_64-openjpeg 1.5.2-7 An open source JPEG 2000 codec (mingw-w64) mingw64/mingw-w64-x86_64-openjpeg2 2.1.0-7 [installed] An open source JPEG 2000 codec (mingw-w64) ``` -------------------------------- ### List License Files of a Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management-tips.md This command lists all license files installed by a package in the recommended location. Note that not all packages include license files or place them here. ```bash $ pacman -Ql meson | grep -E "/share/licenses/.+/.+" meson /usr/share/licenses/meson/COPYING ``` -------------------------------- ### Install MSYS2 in Docker Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/ci.md This Dockerfile installs MSYS2 into a Windows Server Core image, updates it, and configures bash for interactive use. ```docker # select as base image matching your host to get process isolation FROM mcr.microsoft.com/windows/servercore:2004 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; \ .\msys2.exe -y -oC:\; \ Remove-Item msys2.exe ; \ function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } \ msys ' '; \ msys 'pacman --noconfirm -Syuu'; \ msys 'pacman --noconfirm -Syuu'; \ msys 'pacman --noconfirm -Scc'; ``` -------------------------------- ### Verify GCC Version Source: https://github.com/msys2/msys2.github.io/blob/main/web/index.md After installation, check the GCC compiler version to confirm it is set up correctly. ```bash $ gcc --version ``` ```text gcc.exe (Rev2, Built by MSYS2 project) 13.2.0 ``` -------------------------------- ### Rebuild Mingw Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Creating-Packages.md Clone the MINGW-packages repository, navigate to a specific package directory, build it using makepkg-mingw, and install the resulting package. ```bash git clone "https://github.com/msys2/MINGW-packages" cd MINGW-packages/mingw-w64-python3 makepkg-mingw -sCLf pacman -U mingw-w64-*-python3-*-any.pkg.tar.zst ``` -------------------------------- ### GitHub Actions Workflow for MSYS2 Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/ci.md This workflow configures GitHub Actions to use MSYS2, installing specified packages and running a build script. Ensure 'msys2/setup-msys2@v2' is compatible with your needs. ```yaml name: MSYS2 on: [push, pull_request] jobs: msys2-ucrt64: runs-on: windows-latest defaults: run: shell: msys2 {0} steps: - uses: actions/checkout@v5 - uses: msys2/setup-msys2@v2 with: msystem: UCRT64 update: true install: mingw-w64-ucrt-x86_64-git mingw-w64-ucrt-x86_64-gcc - name: CI-Build run: | echo 'Running in MSYS2!' ./ci-build.sh ``` -------------------------------- ### Downgrade MSYS2 Runtime Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md Steps to downgrade the MSYS2 runtime if an update prevents MSYS2 from starting. This involves extracting an older installer and copying the necessary DLL. ```bash * Get the [last MSYS2 installer release](https://github.com/msys2/msys2-installer/releases/download/2024-01-13/msys2-base-x86_64-20240113.sfx.exe) and extract it * Copy the "msys64\usr\bin\msys-2.0.dll" from there to the same location in your existing MSYS2 installation * Start a MSYS2 terminal and switch to the legacy runtime using the command above ``` -------------------------------- ### Pacman Dependency Error Example Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md This output from pacman indicates a dependency conflict, often occurring when updating GCC packages. It shows that a new GCC version requires a specific older version of its Ada or ObjC components, which are not installed. ```text looking for conflicting packages... error: failed to prepare transaction (could not satisfy dependencies) :: installing mingw-w64-x86_64-gcc (9.1.0-1) breaks dependency 'mingw-w64-x86_64-gcc=8.3.0-2' required by mingw-w64-x86_64-gcc-ada :: installing mingw-w64-x86_64-gcc (9.1.0-1) breaks dependency 'mingw-w64-x86_64-gcc=8.3.0-2' required by mingw-w64-x86_64-gcc-objc :: installing mingw-w64-x86_64-gcc (9.1.0-1) breaks dependency 'mingw-w64-i686-gcc=8.3.0-2' required by mingw-w64-i686-gcc-ada :: installing mingw-w64-x86_64-gcc (9.1.0-1) breaks dependency 'mingw-w64-i686-gcc=8.3.0-2' required by mingw-w64-i686-gcc-objc ``` -------------------------------- ### Initial MSYS2 Run and Update Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/ci.md Executes MSYS2 for the first time to set up the environment and then updates MSYS2 core packages and other packages. ```powershell # Run for the first time C:\msys64\usr\bin\bash -lc ' ' ``` ```powershell # Update MSYS2 C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Core update (in case any core packages are outdated) C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Normal update ``` -------------------------------- ### Handle Package Installation Errors Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md Errors like 'missing required signature' can occur on very old MSYS2 installations when installing new packages due to database format changes. Updating your installation resolves this. ```bash error: mingw-w64-ucrt-x86_64-shared-mime-info: missing required signature error: mingw-w64-ucrt-x86_64-gtk3: missing required signature error: failed to commit transaction (package missing required signature) Errors occurred, no packages were upgraded. ``` -------------------------------- ### Serve MSYS2 Website Locally Source: https://github.com/msys2/msys2.github.io/blob/main/README.md Run this command to serve the website locally for development. Changes are reflected immediately in the browser. ```bash uv run properdocs serve ``` -------------------------------- ### Uninstall MSYS2 Installation via CLI Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/installer.md Automate the uninstallation of an existing MSYS2 installation from the specified directory. ```powershell C:\msys64\uninstall.exe pr --confirm-command ``` -------------------------------- ### Manually Install New MSYS2 Keyring Package Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md If you encounter PGP signature errors, you can manually download and install the new MSYS2 keyring package. This involves using curl to download the package and its signature, then verifying and installing it with pacman-key and pacman. ```bash $ curl -O https://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz $ curl -O https://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig $ pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig ==> Checking msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig... (detached) gpg: Signature made Mon Jun 29 07:36:14 2020 CEST gpg: using DSA key AD351C50AE085775EB59333B5F92EFC1A47D45A1 gpg: Good signature from "Alexey Pavlov (Alexpux) " [full] # pacman -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz ``` -------------------------------- ### Import GPG Backup and Trust Key Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Signing-packages.md Import a GPG key backup file and then edit the key to set its trust level to ultimate. Replace `` and `` accordingly. ```bash gpg --import ``` ```bash gpg --edit-key ``` ```bash trust ``` -------------------------------- ### Build a Package with makepkg-mingw Source: https://github.com/msys2/msys2.github.io/blob/main/web/dev/new-package.md Builds a package from a PKGBUILD file in the current directory. It automatically synchronizes dependencies, cleans the build environment, and forces a rebuild if necessary. Use `--syncdeps` to install build dependencies and `--force` to overwrite existing build artifacts. ```bash makepkg-mingw --cleanbuild --syncdeps --force --noconfirm ``` -------------------------------- ### Pacboy Help Output Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-naming.md Displays the help information for the `pacboy` utility, outlining its usage and the available suffixes for specifying target environments. ```bash $ pacboy help Pacboy 2016.6.24 Copyright (C) 2015, 2016 Renato Silva Licensed under BSD This is a pacman wrapper for MSYS2 which handles the package prefixes automatically, and provides human-friendly commands for common tasks. Usage: pacboy [command] [arguments] Arguments will be passed to pacman after translation: For 64-bit MSYS2 shell: name:i means i686-only name:x means x86_64-only name:z means clang-i686-only name:c means clang-x86_64-only name:u means ucrt-x86_64-only name:a means clang-aarch64-only name:p means MINGW_PACKAGE_PREFIX-only For MSYS shell: name:m means mingw-w64 name:l means mingw-w64-clang For all shells: name: disables any translation for name repository::name means repository/name ``` -------------------------------- ### Install MSYS2 Self-Extracting Archive via CLI Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/installer.md Use this command to install MSYS2 from a self-extracting archive to a specified drive. ```powershell .\msys2-base-x86_64-latest.sfx.exe -y -oC:\ ``` -------------------------------- ### GitLab CI/CD Configuration for MSYS2 Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/ci.md This GitLab CI/CD configuration sets up an MSYS2 environment on Windows runners, installs necessary packages, and builds an autotools-based project. It includes steps for downloading, installing, and updating MSYS2, followed by package installation and build commands. ```yaml Windows-MSYS2-UCRT64: # https://docs.gitlab.com/ci/runners/hosted_runners/windows/ tags: [ saas-windows-medium-amd64 ] script: # https://www.msys2.org/docs/ci/#gitlab - wget.exe -nv -O msys2.exe https://github.com/msys2/msys2-installer/releases/download/2025-02-21/msys2-base-x86_64-20250221.sfx.exe # https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe - Get-FileHash ./msys2.exe -Algorithm SHA256 | Format-List - ./msys2.exe -y -oC:\ - Remove-Item msys2.exe - $env:CHERE_INVOKING = 'yes' - $env:MSYSTEM = 'UCRT64' # https://www.msys2.org/docs/environments/ - C:\msys64\usr\bin\bash -lc ' ' - C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' - C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' - | C:\msys64\usr\bin\bash -lcx ' pacman --noconfirm -Syu mingw-w64-ucrt-x86_64-git mingw-w64-ucrt-x86_64-autotools mingw-w64-ucrt-x86_64-gcc ./bootstrap ./configure make V=1 check VERBOSE=t' - C:\msys64\usr\bin\bash -lc 'grep ^PASS tests/basic.log' ``` -------------------------------- ### Configure GitHub Actions for MSYS2 CLANGARM64 Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md Use this configuration in your GitHub Actions workflow to set up an MSYS2 environment for CLANGARM64 builds. Ensure you have checked out your code and are using the msys2/setup-msys2 action with the correct `msystem` and `update` options. ```yaml jobs: msys2-clangarm64: runs-on: windows-11-arm steps: - uses: actions/checkout@v4 - uses: msys2/setup-msys2@v2 with: msystem: CLANGARM64 update: true - name: CI-Build shell: msys2 {0} run: | ./ci-build.sh ``` -------------------------------- ### Backup Installed Packages in MSYS2 Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/MSYS2-reinstallation.md Use this command to list all installed packages and save them to a file for later re-installation. The `exit` command ensures the MSYS2 shell is closed after the command. ```bash pacman -Qqe | xargs echo > /c/packages.txt ; exit ``` -------------------------------- ### Find Package Owning a File Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/package-management.md Use this command to determine which installed package a specific file belongs to. Ensure the full file path is provided, and note that this only works for installed packages. ```bash pacman -Qo ``` -------------------------------- ### Build MSYS package with makepkg Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Creating-Packages.md Performs a full build, including download, preparation, build, package, and cleanup phases for MSYS packages. ```bash makepkg -sCLf ``` -------------------------------- ### Rebuild Package with Clean Build Products Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Creating-Packages.md Use the `-C` flag with `makepkg` to ensure you are not using stale build products or source files from a previous build. ```bash makepkg -C ``` -------------------------------- ### Install Base Metapackage in MSYS2 Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md After a certain date, the 'base' group was replaced by a 'base' metapackage in MSYS2. If your MSYS2 installation is older, run 'pacman -S base' to ensure you have the latest essential packages, including pacman-contrib. ```bash pacman -S base ``` -------------------------------- ### Verify GPG Signature of Downloaded File Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/installer.md Verify the digital signature of a downloaded MSYS2 installer file using GPG to ensure authenticity. This involves importing the public key, listing the signature file, and then verifying the signature against the installer file. ```console $ gpg --keyserver keyserver.ubuntu.com --recv "0EBF 782C 5D53 F7E5 FB02 A667 46BD 761F 7A49 B0EC" gpg: key 46BD761F7A49B0EC: public key "Christoph Reiter " imported gpg: Total number processed: 1 gpg: imported: 1 $ ls msys2-x86_64-20230526.exe msys2-x86_64-20230526.exe.sig $ gpg --verify msys2-x86_64-20230526.exe.sig gpg: assuming signed data in 'msys2-x86_64-20230526.exe' gpg: Signature made Fr 26 Mai 2023 11:46:54 CEST gpg: using RSA key E0AA0F031DBD80FFBA57B06D5A62D0CAB6264964 gpg: Good signature from "Christoph Reiter " [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner! Primary key fingerprint: 0EBF 782C 5D53 F7E5 FB02 A667 46BD 761F 7A49 B0EC Subkey fingerprint: E0AA 0F03 1DBD 80FF BA57 B06D 5A62 D0CA B626 4964 ``` -------------------------------- ### Python Argument Wildcard Expansion Behavior Source: https://github.com/msys2/msys2.github.io/blob/main/web/news.md Compares the behavior of wildcard argument expansion in Python sys.argv before and after the change to disable mingw-w64 wildcard support by default. The 'before' example shows automatic expansion of '*a.txt', while the 'after' example shows the literal string being passed. ```console $ python -c 'import sys; print(sys.argv)' '*a.txt' # before ['-c', 'a.txt', 'aaaa.txt', 'bla.txt'] ``` ```console $ python -c 'import sys; print(sys.argv)' '*a.txt' # after ['-c', '*a.txt'] ``` -------------------------------- ### Default .pc File Prefix Configuration Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/pkgconfig.md Illustrates the typical structure of a .pc file where 'prefix' is set to a MSYS2 environment directory. This configuration is usually handled automatically by pkgconf based on the .pc file's location. ```bash prefix=/ucrt64 includedir=${prefix}/include libdir=${prefix}/lib ``` -------------------------------- ### JIT Debugging Native Windows Processes Started from MSYS2 Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/jit-debugging.md Set the MSYS environment variable to 'winjitdebug' in the parent MSYS2 process (e.g., bash) before starting native Windows processes. This prevents the inheritance of error mode flags that would otherwise block JIT debugging. ```bash export MSYS=winjitdebug exec bash ./crashy.exe ``` -------------------------------- ### Absolute Paths in .pc Files Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/pkgconfig.md Shows an alternative .pc file structure using absolute paths for 'prefix', 'includedir', and 'libdir'. pkg-config and pkgconf include a hack to replace these absolute paths with `${prefix}` for better relocation. ```bash prefix=/ucrt64 includedir=/ucrt64/include libdir=/ucrt64/lib ``` -------------------------------- ### Remove Package with Pacman Source: https://github.com/msys2/msys2.github.io/blob/main/web/wiki/Creating-Packages.md Remove an installed package using `pacman -R`. ```bash pacman -R pkgname ``` -------------------------------- ### Check for Broken Links Source: https://github.com/msys2/msys2.github.io/blob/main/README.md Execute this script to check for broken links on the website. Requires Docker to be installed. ```bash ./linkcheck.sh ``` -------------------------------- ### Create Directory Symlink with mklink Source: https://github.com/msys2/msys2.github.io/blob/main/web/docs/symlinks.md Use `mklink /d` in cmd to create a symlink to a directory. The target must exist. ```bash mklink /d link target ```