|
|
|
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:
gcc-mingw-core
gcc-mingw-g++
gettext-devel
intltool
m4
patch
You'll probably also want:
diffutils
gdb
openssh
unzip
zip
And you'll need to add the following to .bash_profile
export CC='gcc -mno-cygwin -mms-bitfields'
export CXX='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
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.8.8-3_win32.zip
dependencies/cairo-dev_1.8.8-3_win32.zip
dependencies/expat_2.0.1-1_win32.zip
dependencies/expat-dev_2.0.1-1_win32.zip
dependencies/fontconfig_2.8.0-1_win32.zip
dependencies/fontconfig-dev_2.8.0-1_win32.zip
dependencies/freetype_2.3.11-1-win32.zip
dependencies/freetype-dev_2.3.11-1-win32.zip
dependencies/gettext-runtime-0.17-1.zip
dependencies/gettext-runtime-dev-0.17-1.zip
dependencies/libiconv-1.9.1.bin.woe32.zip
dependencies/libpng_1.2.39-1_win32.zip
dependencies/libpng-dev_1.2.39-1_win32.zip
dependencies/libxml2_2.7.4-1_win32.zip
dependencies/libxml2-devel_2.7.4-1_win32.zip
dependencies/pkg-config_0.23-3_win32.zip
dependencies/zlib-1.2.3.zip
dependencies/zlib-dev-1.2.3.zip
atk/1.28/atk_1.28.0-1_win32.zip
atk/1.28/atk-dev_1.28.0-1_win32.zip
glib/2.22/glib_2.22.2-1.zip
glib/2.22/glib-dev-2.22.2-1.zip
gtk+/2.18/gtk+_2.18.3.zip
gtk+/2.18/gtk+-dev-2.18.3.zip
pango/1.26/pango_1.26.0-1_win32.zip
pango/1.26/pango-dev_1.26.0-1_win32.zip
libart_lgpl/2.3/libart_lgpl-2.3.20.zip
libart_lgpl/2.3/libart_lgpl-dev-2.3.20.zip
libgnomecanvas/2.20/libgnomecanvas-2.20.1.zip
libgnomecanvas/2.20/libgnomecanvas-dev-2.20.1.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"`
- You'll need a version of make that works. The version that is currently shipped with cygwin (3.81-2) has 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. Install it in the /usr/bin/ directory of cygwin.
-
You'll also need to rename or delete /usr/lib/linbintl.la, as otherwise it'll inadvertently get picked up by the compile process.
- From the AMIDE download page, get volpack.
./configure --enable-static=no --build=mingw32
make
make install
- Get xmedcon. You'll need version >= 0.10.5
./configure --build=mingw32 --enable-static=no --prefix=/usr/local
make
make install
You'll want to edit /usr/local/bin/xmedcon-config, and make sure
there's no "^M". There may be one on line 64, and line 72.
-
Get the DCMTK
library. You'll want the "Unix" package (.tar.gz). Version 3.5.4 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 722
change "#define PATH_SEPARATOR '/'" to "#define PATH_SEPARATOR '\\'"]
./configure --disable-threads --build=mingw32
make
cd dcmdata/libsrc
[edit mkdictbi.cc - change "LPTSTR" to "WCHAR *" on line 161]
[edit Makefile - add -lnetapi32 to LOCALLIBS]
make mkdictbi
./mkdictbi.exe ./dicom.dic ./private.dic > dcdictbi.cc
make
cd ../..
make install [this will error out, ignore this]
make install-lib
- Get ffmpeg
prebuilt for win32. 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.15.0.dll | sed 's/^_//' > avutil.def
dlltool.exe --dllname ../bin/avcodec-52.20.0.dll --input-def avcodec.def \\
--output-lib libavcodec.dll.a
dlltool.exe --dllname ../bin/avutil-49.15.0.dll --input-def avutil.def \\
--output-lib libavutil.dll.a
ranlib libavcodec.dll.a
ranlib libavutil.dll.a
- Finally, get AMIDE.
./configure --build=mingw32 --enable-amide-debug=no \\
--enable-gtk-doc=no --disable-doc
There's a problem with the current version of libtool (1.311). Search
through ./libtool, and change "cmd //c" to "cmd /c" where ever you see
it.
Add -lavutil to FFMPEG_LIBS in src/Makefile.
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/lib
mkdir Desktop/amide-VERSION/share
mkdir Desktop/amide-VERSION/share/pixmaps
Copy the following from /usr/local/bin to Desktop/amide-VERSION
amide.exe
Copy the following from /usr/local/bin to Desktop/amide-VERSION/bin
xmedcon.exe
medcon.exe
avcodec-52.dll
avutil-49.dll
libgdk-win32-2.0-0.dll
libgdk_pixbuf-2.0-0.dll
libgio-2.0-0.dll
libglib-2.0-0.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libpng12-0.dll
zlib1.dll
libcairo-2.dll
libfontconfig-1.dll
libexpat-1.dll
freetype6.dll
libpango-1.0-0.dll
libpangocairo-1.0-0.dll
libpangoft2-1.0-0.dll
libpangowin32-1.0-0.dll
libgnomecanvas-2-0.dll
libatk-1.0-0.dll
libgnomecanvas-2-0.dll
libatk-1.0-0.dll
libgailutil-18.dll
libgtk-win32-2.0-0.dll
libart_lgpl_2-2.dll
intl.dll
libgsl.dll
libgslcblas.dll
libvolpack-1.dll
libxml2-2.dll
To setup things in the amide-VERSION/lib directory
cp -a /usr/local/lib/locale Desktop/amide-VERSION/lib
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 ./
- Now just compile using Inno Setup and the .iss file in the amide source directory in the etc subdir, and that should be it.....
|