|
|
Notes on compiling AMIDE and associated programs on Microsoft Windows
This is a long, involved process, and assumes a good command of
standard GNU build environments. Be aware that these notes are
fragmentary and may contain bugs and omissions.
The first step of the process involves setting up a build system to
compile AMIDE for windows. There are three basic options. 1) Setup a
cross-compilation setup under Linux - I've never tried this
approach. 2) Use MinGW/MSYS on Windows - I've tried this approach, but
have found it overly complex due to these packages being poorly
maintained and differences between unix and dos file paths. 3) Use
Cygwin with the MinGW libraries - this is the process I've been using.
As I've essentially only been using the Cygwin + MinGW build system,
the following text will be only directly relevant to this build
system. Cygwin+MinGW means setting up cygwin such that compilation of
applications inside of cygwin only depend on microsoft DLL's and don't
depend on cygwin.dll.
Helpful Hints:
Instructions
- Install cygwin. In addition to the default packages, you'll definitely need:
mingw64-i686-gcc-g++
m4
patch
intltool
libtool
autoconf
automake
You'll probably also want:
diffutils
gdb
openssh
unzip
zip
And you'll need to add the following to .bashrc
export CC='i686-w64-mingw32-gcc -mno-cygwin -mms-bitfields'
export CXX='i686-w64-mingw32-g++ -mno-cygwin -mms-bitfields'
export CPPFLAGS='-I/usr/local/include'
export LDFLAGS='-L/usr/local/lib'
export PKG_CONFIG_PATH=C:/cygwin/usr/local/lib/pkgconfig
export PATH=/usr/i686-w64-mingw32/bin:/usr/i686-w64-mingw32/sys-root-/mingw/bin:$PATH
The "mms-bitfields" is essential for making your gcc compiled
executable be compatible with previously compiled DLL's as they are
generally compiled with Visual C. The "mno-cygwin" tells gcc to not
link to any of cygwin's DLL's. This means what will get produced will
be a pure Windows application not dependent on anything from cygwin.
- You'll need an editor. You're welcome to use notepad if you want, but I like emacs. If you want to use emacs, you can install it as one of the cygwin packages, or install a windows version of emacs and make it so that you can run it from within cygwin. To do the later:
goto http://ftp.gnu.org/pub/gnu/emacs/windows/ and download emacs
unpack into c:/
run bin/addpm.exe
add "export PATH=$PATH:/cygdrive/c/emacs-23.1/bin" to the end of .bash_profile
- You'll need a small application
called png2ico
for compiling amide. Place the executable in /usr/local/bin.
- From the gnome ftp site (or mirror) download the following win32 builds and install in /usr/local/
dependencies/cairo_1.10.2-2_win32.zip
dependencies/cairo-dev_1.10.2-2_win32.zip
dependencies/expat_2.0.1-1_win32.zip
dependencies/expat-dev_2.0.1-1_win32.zip
dependencies/fontconfig_2.8.0-2_win32.zip
dependencies/fontconfig-dev_2.8.0-2_win32.zip
dependencies/freetype_2.4.4-1_win32.zip
dependencies/freetype-dev_2.4.4-1_win32.zip
dependencies/gettext-runtime-0.18.1.1-2_win32.zip
dependencies/gettext-runtime-dev-0.18.1.1-2_win32.zip
dependencies/libpng_1.4.3-1_win32.zip
dependencies/libpng-dev_1.4.3-1_win32.zip
dependencies/libxml2_2.7.7-1_win32.zip
dependencies/libxml2-devel_2.7.7-1_win32.zip
dependencies/pkg-config_0.25-1_win32.zip
dependencies/pkg-config-dev_0.25-1_win32.zip
dependencies/zlib-1.2.5-2_win32.zip
dependencies/zlib-dev-1.2.5-2_win32.zip
atk/1.32/atk_1.32.0-2_win32.zip
atk/1.32/atk-dev_1.32.0-2_win32.zip
gdk-pixbuf/2.24/gdk-pixbuf_2.24.0-1_win32.zip
gdk-pixbuf/2.24/gdk-pixbuf-dev_2.24.0-1_win32.zip
glib/2.28/glib_2.28.8-1_win32.zip
glib/2.28/glib-dev-2.28.8-1_win32.zip
gtk+/2.24/gtk+_2.24.10-1_win32.zip
gtk+/2.24/gtk+-dev-2.24.10-1_win32.zip
libart_lgpl/2.3/libart_lgpl-2.3.21-1_win32.zip
libart_lgpl/2.3/libart_lgpl-dev-2.3.21-1_win32.zip
pango/1.28/pango_1.28.3-1_win32.zip
pango/1.28/pango-dev_1.28.3-1_win32.zip
[not sure if needed]
dependencies/libiconv-1.9.1.bin.woe32.zip
One easy way to do this, is to put all these zips in the same directory, and then:
cd /usr/local
unzip [directory where zips are]/\*.zip
-
From GnuWin32, download the
following
packages. You'll want
the complete packages (binary and developer) if possible, and install
them in C:\cygwin\usr\local\
gsl (1.8) [use .exe]
The gsl win32 packages don't include gsl-config. We'll need this for
autodetecting gsl later. So download the gsl sources zip from
gnuwin32, unpack, and then:
./configure --build=mingw32
chmod a+x gsl-config
cp gsl-config /usr/local/bin
- After completing the above two steps, you'll need to modify the permissions of the DLL's along with some of the EXE's to get things to work. To modify these permissions:
cd /usr/local
chmod a+x `find ./ -name "*.dll"` `find ./ -name "*.exe"`
chmod a+x bin/glib-mkenums
- You'll need a version of make that works. The versions currently shipped with cygwin (3.81-2, 3.82.90) have issues with DOS path files (manifested as "multiple target patterns" error messages). You can either use version 3.80, or a patched version of 3.81 here (make.exe-cygwin1.7). Install it in the /usr/local/bin/ directory of cygwin as make.exe.
-
You also need to rename or delete /usr/lib/libintl.la, as otherwise it'll inadvertently get picked up by the compile process.
- You'll need to compile your own libgnomecanvas. There is a
windows binary available, but it's currently 2.30.1, and we need
2.30.3 for scroll wheel support.
Download libgnomecanvas
(2.30.3 as of this writing), and run the following.
[edit configure, comment out XML::Parser test]
./configure --host=mingw32
make
make install
- From the AMIDE download page, get volpack.
./configure --host=mingw32 --enable-static=no
make
make install
- Get xmedcon. You'll need version >= 0.10.7.
./configure --host=mingw32 --enable-static=no --prefix=/usr/local
Now edit source/Makefile: change "windres" to "i686-w64-mingw32-windres.exe"
make
make install
You'll want to edit /usr/local/bin/xmedcon-config, and make sure
there's no "^M^M"'s.
-
Get the DCMTK
library. You'll want the "Unix" package (.tar.gz). Version 3.6.0 is
known to work. I've been unable to figure out any reasonable way of
building this package as DLL's under cygwin/mingw, so we'll just have
to build static libraries and live with it. To compile:
[edit config/include/dcmtk/config/cfunix.h.in, on line 809
change "#define PATH_SEPARATOR '/'" to "#define PATH_SEPARATOR '\\'"]
./configure --disable-threads --host=mingw32 --disable-lfs
[edit ofstd/include/dcmtk/ofstd/offile.h
comment out lines 199,200,201,203, 261, 262, 263, 265
to get rid of non-mingw win32 stuff]
make
cd dcmdata/libsrc
[edit mkdictbi.cc - add to the top of the file:
#define _POSIX
#include <io.h>
make mkdictbi
./mkdictbi.exe ../data/dicom.dic ../data/private.dic > dcdictbi.cc
make
cd ../..
make install
make install-lib
- Get ffmpeg
prebuilt for win32 (currently using 16537 version). You'll want the gpl shared libraries. Extract the files into a temporary directory, and then copy the following files:
cp bin/*.dll /usr/local/bin
cp lib/pkgconfig/* /usr/local/lib/pkgconfig
cp -a include/libavcodec /usr/local/include/
cp -a include/libavutil /usr/local/include/
ln -s /usr/local/include /usr/local/include/ffmpeg
- We'll need to generate dll import libraries for
avcodec. Download pexports,
unzip the package, chmod a+x the binary (pexports) and move it to
someplace in your path. Then run:
cd /usr/local/lib
pexports.exe ../bin/avcodec-52.dll | sed 's/^_//' > avcodec.def
pexports.exe ../bin/avutil-49.dll | sed 's/^_//' > avutil.def
dlltool.exe --dllname ../bin/avcodec-52.dll --input-def avcodec.def \\
--output-lib libavcodec.dll.a
[this takes a while, ignore the syntax error message]
dlltool.exe --dllname ../bin/avutil-49.dll --input-def avutil.def \\
--output-lib libavutil.dll.a
ranlib libavcodec.dll.a
ranlib libavutil.dll.a
- Finally, get AMIDE.
First, we'll need to edit the configure file. Currently, for some reason, dcmtk isn't being found correctly even though we know they're there.
change each instance of FOUND_DCMDATA=no to FOUND_DCMDATA=yes
To configure the amide source package:
./configure --host=mingw32 --enable-amide-debug=no \\
--enable-gtk-doc=no --disable-doc
Make sure the order for AMIDE_LIBDCMDATA_LIBS in src/Makefile is: -ldcmdata -loflog -lofstd. Also, make sure "XMEDCON_LIBS = -lmdc" is present.
And edit win32/Makefile, change "windres" to "i686-w64-mingw32-windres.exe".
make
make install
- Now for generating amide_setup.exe. In the amide's sources win32
directory, there's a file amide-VERSION.iss. This file is used by Inno Setup, a neat
little program for generating windows application install programs.
We first need to setup the directory for Inno Setup to use. We need
to create an amide folder, several subdirectories inside of it, and
copy several files into the folders. Do the following (where Desktop
is the path to your Desktop directory):
mkdir Desktop/amide-VERSION/bin
mkdir Desktop/amide-VERSION/share
mkdir Desktop/amide-VERSION/share/pixmaps
Copy the following from /usr/local/bin to Desktop/amide-VERSION/bin/
amide.exe
Copy the following from /usr/local/bin to Desktop/amide-VERSION/bin
xmedcon.exe
medcon.exe
libmdc-2.dll
libglib-2.0-0.dll
intl.dll
libpng14-14.dll
zlib1.dll
libgdk-win32-2.0-0.dll
libcairo-2.dll
libfontconfig-1.dll
libexpat-1.dll
freetype6.dll
libgdk_pixbuf-2.0-0.dll
libgio-2.0-0.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgthread-2.0-0.dll
libpango-1.0-0.dll
libpangocairo-1.0-0.dll
libpangoft2-1.0-0dll
libpangowin32-1.0-0.dll
libgtk-win32-2.0-0.dll
libatk-1.0-0.dll
avcodec-52.dll
avcodec-52.dll
avutil-49.dll
libgnomecanvas-2-0.dll
libgailutil-18.dll
libart_lgpl_2-2.dll
libgsl.dll
libgslcblas.dll
libvolpack-1.dll
libxml2-2.dll
Copy the following from /usr/i686-w64-mingw32/sys-root/mingw/bin to Desktop/amide-VERSION/bin
libgcc_s_sjlj-1.dll
libstdc++-6.dll
Then to reduce the size of the package:
strip bin/amide.exe bin/*.dll bin/*.exe
To setup things in the amide-VERSION/share directory
cp -a /usr/local/share/locale Desktop/amide-VERSION/share
From the amide source directory, do:
cp COPYING amide-VERSION/
cp pixmaps/amide_logo.png amide-VERSION/share/pixmaps
cp pixmaps/amide_file_logo.png amide-VERSION/share/pixmaps
And to create .html files for the windows help browser, on a box with
xsltproc installed (like a linux box), run the following and copy the
resulting help directory into Desktop/amide-VERSION/share/gnome/help
mkdir amide amide/C amide/es
cd amide/C
xsltproc /usr/share/sgml/docbook/xsl-stylesheets/xhtml/chunk.xsl \
/usr/share/gnome/help/amide/C/amide.xml
cp index.html amide.html
cp -a /usr/share/gnome/help/amide/C/figures ./
cd ../es
xsltproc /usr/share/sgml/docbook/xsl-stylesheets/xhtml/chunk.xsl \
/usr/share/gnome/help/amide/es/amide.xml
cp index.html amide.html
cp -a /usr/share/gnome/help/amide/C/figures ./
And put the results of that into: amide-VERSION/share/gnome/help/amide
- Now to create a nice looking theme.
From gtk-win.sourceforge.net,
get a gtk themes package (currently gtk2-themes-2009-09-09-07-win32_bin.zip).
mkdir -p etc/gtk-2.0
cp ~/Desktop/gtk2-themes-2009-09-07-win32_bin/share/themes/Xfce-4.4/gtk-2.0/gtkrc etc/gtk-2.0
mkdir -p lib/gtk-2.0/2.10.0/engines
cp ~/Desktop/gtk2-themes-2009-09-07-win32_bin/lib/gtk-2.0/2.10.0/engines/libxfce.dll lib/gtk-2.0/2.10.0/engines
- Now just compile using Inno Setup and the .iss file in the amide source directory in the etc subdir, and that should be it.....
|