Difference between revisions of "History:How to Build Picard for Windows"

From MusicBrainz Wiki
(Added in Category:Development)
Line 1: Line 1:
= How to build Picard for Windows =
+
This page explains the process of building the Picard installes for Windows. It only works for Picard 1.2 and newer, which no longer supports AmpliFIND.
 
 
== Disclaimer ==
 
This HowTo is work in progress and terribly incomplete. Currently it is more a collection of notes which can help you to build Picard on Windows, but it is not a real step by step instruction.
 
 
 
== About ==
 
This HowTo explains the process of building the Picard installer for Windows from source using the MinGW build environment.
 
  
 
== Requirements ==
 
== Requirements ==
=== Runtime & libraries ===
 
* [http://python.org/download/releases/2.7.2/ Python 2.7.x] (Ensure you get a 32-bit version)
 
* [http://www.riverbankcomputing.co.uk/software/pyqt/download PyQt 4] Picard 0.15 is packaged with 4.7 but Py2.7-x86-gpl-4.8.4 appears to work. Ensure you get a 32-bit/x86 version.
 
* [http://code.google.com/p/mutagen/ Mutagen] (1.20 works fine)
 
* [[libdiscid]]
 
* [http://code.google.com/p/musicip-libofa/ LibOFA]
 
 
* [http://ffmpeg.org/ FFmpeg] (Only 0.5.2-w32 currently appears to work; you may need to build it yourself using MinGW/MSYS)
 
* [http://www.mingw.org/wiki/Getting_Started MinGW & MSYS] (Can use the GUI installer to install both at once)
 
 
=== For packaging/installer ===
 
* [http://nsis.sourceforge.net/Download NSIS]
 
* [http://www.py2exe.org/ py2exe]
 
 
== Install Python, PyQt and py2exe ==
 
 
== Install NSIS ==
 
 
== Install MinGW and MSYS ==
 
Grab one of the installers from [http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/ here]. In the installer ensure you choose the following optional components:
 
* C++ compiler
 
* MSYS Basic System
 
* MinGW Developer Toolkit
 
 
Installing to C:\MinGW (MSYS will be in C:\MinGW\msys\1.0) will simplify the rest of the guide.
 
 
Add C:\MinGW\bin to your PATH.
 
 
== Build libavformat/libavcodec ==
 
Download the FFmpeg 0.5.2 [http://ffmpeg.org/download.html source code] and extract it to a directory. You are trying to build individual FFmpeg components in shared mode. Picard needs
 
* libavformat
 
* libavcodec
 
* libavutil
 
 
From inside the MSYS shell change to that directory and run:
 
 
./configure --prefix=C:/MinGW \
 
  --extra-cflags="-mno-cygwin -mms-bitfields" \
 
  --extra-ldflags="-Wl,--add-stdcall-alias" \
 
  --enable-memalign-hack \
 
  --target-os=mingw32 \
 
  --enable-shared \
 
  --disable-static \
 
  --disable-ffmpeg \
 
  --disable-ffplay \
 
  --disable-ffserver \
 
  --disable-network \
 
  --disable-muxers \
 
  --disable-demuxers \
 
  --enable-demuxer=aac \
 
  --enable-demuxer=ac3 \
 
  --enable-demuxer=ape \
 
  --enable-demuxer=flac \
 
  --enable-demuxer=mpc \
 
  --enable-demuxer=mpc8 \
 
  --enable-demuxer=ogg \
 
  --enable-demuxer=wav \
 
  --disable-bsfs \
 
  --disable-filters \
 
  --disable-parsers \
 
  --enable-parser=aac \
 
  --enable-parser=ac3 \
 
  --enable-parser=mpegaudio \
 
  --disable-protocols \
 
  --enable-protocol=file \
 
  --disable-indevs \
 
  --disable-outdevs \
 
  --disable-encoders \
 
  --disable-decoders \
 
  --enable-decoder=aac \
 
  --enable-decoder=ac3 \
 
  --enable-decoder=alac \
 
  --enable-decoder=flac \
 
  --enable-decoder=mp2 \
 
  --enable-decoder=mp3 \
 
  --enable-decoder=mpc7 \
 
  --enable-decoder=mpc8 \
 
  --enable-decoder=ape \
 
  --enable-decoder=wavpack \
 
  --enable-decoder=vorbis \
 
  --enable-decoder=wmav1 \
 
  --enable-decoder=wmav2 \
 
  --enable-decoder=tta \
 
  --enable-decoder=pcm_alaw \
 
  --enable-decoder=pcm_dvd \
 
  --enable-decoder=pcm_f32be \
 
  --enable-decoder=pcm_f32le \
 
  --enable-decoder=pcm_f64be \
 
  --enable-decoder=pcm_f64le \
 
  --enable-decoder=pcm_s16be \
 
  --enable-decoder=pcm_s16le \
 
  --enable-decoder=pcm_s16le_planar \
 
  --enable-decoder=pcm_s24be \
 
  --enable-decoder=pcm_daud \
 
  --enable-decoder=pcm_s24le \
 
  --enable-decoder=pcm_s32be \
 
  --enable-decoder=pcm_s32le \
 
  --enable-decoder=pcm_s8 \
 
  --enable-decoder=pcm_u16be \
 
  --enable-decoder=pcm_u16le \
 
  --enable-decoder=pcm_u24be \
 
  --enable-decoder=pcm_u24le
 
 
Build the libraries with
 
 
make
 
 
You may see errors from make regarding
 
 
make: lib: Command not found
 
  
Make is looking for the [http://msdn.microsoft.com/en-us/library/7ykb2k5f%28v=vs.80%29.aspx Microsoft Library Manager] from Visual Studio. You can ignore these; the DLLs should be successfully built and appear to be sufficient. However you will have to change the build.cfg before building Picard (see below).
+
* Python 2.7.x
 +
** http://www.python.org/download/
 +
** Download and install "Python 2.7.x Windows Installer"
 +
** Add C:\Python27 to %PATH%
 +
* PyQt 4.9.x
 +
** http://www.riverbankcomputing.co.uk/software/pyqt/download
 +
** Download and install "PyQt-Py2.7-x86-gpl-4.9.x-1.exe"
 +
* Visual C++ 2008 Express
 +
** https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=14597
 +
** Download and install "vcsetup.exe"
 +
* NSIS 2.46
 +
** http://nsis.sourceforge.net/Download
 +
** Download and install "nsis-2.46-setup.exe"
 +
* Mutagen 1.20
 +
** http://code.google.com/p/mutagen/downloads/list
 +
** Download and unpack "mutagen-1.20.tar.gz"
 +
** python setup.py install
 +
* MingGW
 +
** http://sourceforge.net/projects/mingw/files/
 +
** Download and install the latest "mingw-get-inst-xxxx.exe"
 +
** Uncheck the C compiler option, we need only the directory structure and mingw-get
 +
** Add C:\MinGW\bin to %PATH%
 +
* Gettext
 +
** mingw-get install gettext
  
== Download the Picard source code ==
+
== Running Picard From Sources ==
See [[Picard_Download|Picard Download]] for instructions on how to obtain the source code of Picard.
 
  
== Install libdiscid and libofa ==
+
Before you can run Picard from sources, you need to build the C extension. Start the VS console using "Visual Studio 2008 Command Prompt", go to the source directory and run this command:
  
== Install Mutagen ==
+
python setup.py build_ext -i
From a '''cmd''' shell
 
  
cd mutagen-1.20
+
After you have done this, you can run Picard directly from the sources using:
python setup.py install
 
  
== Build the Picard installer ==
+
python tagger.py
From a '''cmd''' shell, configure Picard:
 
  
python setup.py config --compiler mingw32 --library-dirs C:\MinGW\lib --include-dirs C:\MinGW\include
+
In order to have a fully functional copy of Picard, you need to get add [http://musicbrainz.org/doc/libdiscid discid.dll] and [http://acoustid.org/chromaprint fpcalc.exe] to the source directory.
  
Fix the build.cfg:
+
== Building the Installer ==
[directshow]
 
libs =  
 
cflags =  
 
 
[libofa]
 
libs =
 
cflags =
 
 
[avcodec]
 
libs = avcodec.dll avformat.dll avutil.dll
 
cflags =
 
 
[build]
 
have-make = True
 
with-directshow = False
 
with-avcodec = True
 
with-libofa = False
 
  
Build Picard and create the installer:
+
If you have done all steps necessary to run Picard from sources and it works, you can build the installer using this command:
  
  python setup.py build --compiler mingw32
+
  python setup.py bdist_nsis
python setup.py build --compiler mingw32 bdist_nsis
 
  
 
== Known issues ==
 
== Known issues ==
 
* It is possible that the resulting picard.exe does not show the proper file icon. This is probably a bug of py2exe on Vista. You can fix the icon with the tool [http://angusj.com/resourcehacker/ Resource Hacker] or any other tool, that can edit the resources in executables.
 
* It is possible that the resulting picard.exe does not show the proper file icon. This is probably a bug of py2exe on Vista. You can fix the icon with the tool [http://angusj.com/resourcehacker/ Resource Hacker] or any other tool, that can edit the resources in executables.
* If you try to build libdiscid yourself you must apply the patch from ticket [http://bugs.musicbrainz.org/ticket/5255 #5255].
 
  
 
[[Category:Development]][[Category:MusicBrainz Picard]][[Category:How To]][[Category:To Be Reviewed]]
 
[[Category:Development]][[Category:MusicBrainz Picard]][[Category:How To]][[Category:To Be Reviewed]]

Revision as of 13:17, 30 September 2012

This page explains the process of building the Picard installes for Windows. It only works for Picard 1.2 and newer, which no longer supports AmpliFIND.

Requirements

Running Picard From Sources

Before you can run Picard from sources, you need to build the C extension. Start the VS console using "Visual Studio 2008 Command Prompt", go to the source directory and run this command:

python setup.py build_ext -i

After you have done this, you can run Picard directly from the sources using:

python tagger.py

In order to have a fully functional copy of Picard, you need to get add discid.dll and fpcalc.exe to the source directory.

Building the Installer

If you have done all steps necessary to run Picard from sources and it works, you can build the installer using this command:

python setup.py bdist_nsis

Known issues

  • It is possible that the resulting picard.exe does not show the proper file icon. This is probably a bug of py2exe on Vista. You can fix the icon with the tool Resource Hacker or any other tool, that can edit the resources in executables.