Skip to content
Christopher Degawa edited this page Aug 7, 2022 · 7 revisions

Basic Informations

The media-autobuild_suite.bat script builds the msys2 environment with all needed compilers (mingw-w64) and dependencies. This is basically the "main" build script. Run it, it will prompt you for which things to build (ffmpeg, mplayer, etc.) and which options.

When you had run the script you can also use the environment to build your own tools. For that is important to know some things:

  • msys2 is a shell environment, like in Linux, you have here the same commands and many similar tools. the shell tool what gets prepare truth the script is mintty, you found the shortcut for it in your root folder from the media-autobuild_suit. It is recommend to use this shortcut, because with that you can be sure that all environment setting get loaded right.

  • There is some folders automatically mounted with this variables: /mingw32 (the compiler folder); /build32 (the place for the source code folders); /local32 (the place for the compiled tools). The same you have for the 64 bit versions to, like mingw64, build64 and local64. To navigate, or use this folders, you can do it with cd /build32 in the mintty console, or for example --prefix=/local32 for the configure command. There is also standard variables for example /usr/bin: the place from msys2 binaries.

  • The standard build environment is based on 32bit, that means you are able to build tools for 32 bit platforms. Only when you have picked by the installation process only the 64 bit environment, the standard is 64 bit.

  • When you use both compilers (32 bit and 64 bit) and you want to switch between them you can do it with: source /local32/etc/profile.local for the 32bit compiler or source /local64/etc/profile.local for the 64bit compiler.

  • The profile.local files have some very important settings for the compiler. You can open them with a editor to examine them a bit. You found there also two variables: LOCALBUILDDIR and LOCALDESTDIR this is helpful when you build your own build script for 32 and 64 bit, then you don't need to change the build and destination folders from /build32 to /build64 and from /local32 to /local64. This will change automatic by loading the profile and using this variables in you script or in the console with $LOCALBUILDDIR and $LOCALDESTDIR.

Here is a example how to build your own flac from source:

  1. Open mintty
  2. go to the build folder with: cd /build64
  3. download the source code with wget: wget http://downloads.xiph.org/releases/flac/flac-1.3.2.tar.xz
  4. unpack it with: tar xf flac-1.3.2.tar.xz
  5. delete the source code archive: rm flac-1.3.2.tar.xz
  6. change to the source code folder: cd flac-1.3.2
  7. configure flac for static build: ./configure --build=$MINGW_CHOST --host=$MINGW_CHOST --prefix=$LOCALDESTDIR --bindir=$LOCALDESTDIR/bin-audio --disable-xmms-plugin --disable-doxygen-docs --enable-shared=no --enable-static
  8. compile the source code: make -j4 (4 is the numbers of cores/threads what you using for the compiling, it is recommend to use 1 or 2 less then your system limit)
  9. install flac with: make install
  10. now you found the compiled flac.exe under /local64/bin-audio