Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Creating a new Package

A package consists of a package recipe in the form of aPKGBUILD file. See thePKGBUILD file forglibas an example. To have your package included in the official repository it hasto end up in the package git repository via a pull request →https://github.com/msys2/MINGW-packages/pulls

Things to consider before creating a PKGBUILD file

  • Does the project you'd like to package support Windows and does it support other compilers than MSVC?
  • Is the project you'd like to package already in the repo?
  • Are all the runtime and build dependencies of that project already in the repo?
  • Does building the project work in an MSYS2 environment?
  • Is the project packaged inArch Linux or in theAUR, to help you as a reference for both the build process and finding a package name?

Creating a new PKGBUILD file

Many projects are similar to build and package, so it's easiest to just copy anexisting PKGBUILD file as a starting point. You can either look for a packagewith a similar build system and dependencies in our repository or use one of ourPKGBUILD templates:

After you have decided on a good starting point:

  1. Decide on a package name. If the project is already packaged in Arch Linux or the AUR then we prefer the same name.
  2. Create a directory calledmingw-w64-<package-name>
  3. Move yourPKGBUILD file into that directory.
  4. Fill out yourPKGBUILD file
  5. Runupdpkgsums to update the source checksums in thePKGBUILD file.
  6. Build the package...

Building the package

Building a package requires a base set of build related packages to be installedfirst. This only needs to be done once:

pacman-S--neededbase-devel

To build the package, start a shell in an environment you want to build for,change the working directory to the directory of thePKGBUILD, and run:

makepkg-mingw--cleanbuild--syncdeps--force--noconfirm

This will download all required build dependencies, build your package, and willresult in a*.pkg.tar.zst package in the same directory, if nothing goeswrong.

To install the package you can run:

pacman-U*.pkg.tar.zst

makepkg-mingw has various other helpful options you can add:

  • --install - to install the built package right away
  • --rmdeps - to remove all packages again that it installed for building
  • --help - to see more options

Proposing the package to be included in our official repository

Once you are pleased with your package and have tested it sufficiently you cancreate a pull request against our package repository →https://github.com/msys2/MINGW-packages/pulls

Once the PR is opened, our CI system will try to build your package in a freshand clean build environment and will also try to build it for all our supportedtarget environments (mingw64, clang64, etc).

There is a chance that this will uncover some issues in your package, such asunspecified build dependencies, or uncover errors in projects that build withgcc but not with clang for example. If that is the case you can try to fix thefound issues or ask us for assistance.

Differences compared to Arch Linux

If you are already accustomed to building packages for Arch Linux, you mightnotice some differences despite us using the same tools:

  • OurPKGBUILD files use environment variables such asMINGW_PACKAGE_PREFIX andMINGW_PREFIX in various places so they can be used to build packages for difference environments using the samePKGBUILD file.
  • We usemakepkg-mingw instead ofmakepkg.makepkg-mingw is just a small wrapper aroundmakepkg which sets up the right environment and also allows building the same package multiple times for different environments in one go.

[8]ページ先頭

©2009-2025 Movatter.jp