Skip to content

Instantly share code, notes, and snippets.

@jeeb
Created July 28, 2011 06:12
Show Gist options
  • Save jeeb/1111059 to your computer and use it in GitHub Desktop.
Save jeeb/1111059 to your computer and use it in GitHub Desktop.
Msys/mingw howto
# What you need to set up a msys/mingw environment:
# * CCCP's Nicholi's April 2010 msys/mingw package
# http://www.cccp-project.net/nichorai/msys.premade.2010.04.30.7z
# * Newest 7z file with the Msys/Mingw from xhmikosr found at:
# http://sourceforge.net/apps/trac/mpc-hc/wiki/How_to_compile_the_MPC
# * Your favourite mingw package (Komisar's or Alexis', both are fine)
# http://komisar.gin.by/mingw/ (4.5.x generally recommended)
# * Command-line SVN
# http://subversion.tigris.org/files/documents/15/47914/svn-win32-1.6.6.zip
#
# 01) Extract Nicholi's package somewhere where the path doesn't have spaces in it.
# 02) Extract xhmikosr's msys/mingw package so that it goes over nicholi's (the bin
# etc. folders in the msys/1.0 folder), but NOT the files within the msys/1.0
# folder such the launching .bat etc. This keeps the lovely rxvt shell, which, albeit
# failing unicode, is pretty nice otherwise (although you might want to replace it with
# mintty later on).
# 03) Extract your mingw package into the msys root folder that has the 1.0 folder within it.
# (example after that: C:\msys\cross-mingw.gcc453.ml.20110512\)
# 04) Extract the svn package's bin etc. folders (inside the svn-xxx folder) into msys' root.
# (it's really a mingw component, but in this case we want it to be available even if we
# switch mingw sets)
# 05) Open msys/1.0/etc/fstab with something like notepad++ that can actually edit *nix endlines.
# 06) Edit the mingw and perl lines to point at the correct places (/mingw needs to point to komisar's mingw root).
# Yes, you will use / not \.
# (example: C:/JEEB/msys/cross-mingw.gcc453.ml.20110512 /mingw )
#
# Keeping your /mingws separate, and using /etc/fstab to set them makes it easy to switch
# to a new one.
# 07) This might not be needed for ffmpeg/libav, but if you will use pkg-config, you will need
# one pkg-config.exe for each of your architectures that will need a cross-prefix (usually,
# the 64bit ones). You can either do it the right way and compile for all the cross-prefixes,
# or do it like me and just make new copies of pkg-config.exe in msys/1.0/bin with names like
# x86_64-w64-mingw32-pkg-config.exe or x86_64-pc-mingw32-pkg-config.exe in msys/1.0/bin.
# 08) Run the msys.bat file in msys/1.0.
# 09) Check that you have the /mingw mounted correctly by checking 'gcc --version'
# 10) Git clone the ffmpeg/libav project.
# 11) run configure with the needed settings and make.
# General Examples (just to give you the gist, no more no less -- may contain configure settings no longer needed):
# (32bit)
# ./configure --prefix=/mingw/i686-pc-mingw32 --enable-gpl --enable-postproc --enable-filters --enable-memalign-hack --extra-cflags='-U__STRICT_ANSI__' --enable-pthreads --extra-cflags='-DPTW32_STATIC_LIB'
# (64bit)
# ./configure --prefix=/mingw/${P64B} --cross-prefix=${P64B}- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-postproc --enable-filters --extra-cflags='-U__STRICT_ANSI__' --enable-pthreads --extra-cflags='-DPTW32_STATIC_LIB'
# You can get ${P64B} (the 64bit prefix) quite easily with `ls /mingw |grep x86_64`.
#
# You should now be able to compile stuff on mingw. Don't forget to set
# PKG_CONFIG_PATH=/mingw/<32|64bit prefix>/lib/pkgconfig/ in case of building stuff with pkg-config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment