file_logo

AMIDE: Amide's a Medical Imaging Data Examiner

.


Notes on compiling AMIDE and associated programs on Mac OS X and creating an app bundle

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.

At present, (amide 1.0.5) I'm building on OS X 10.9. The generated binaries should work on 64-bit OS 10.7-10.9 systems. There's also instructions below for generating a 32-bit build if that's needed.

General notes. Not currently using a common framework for gtk, as this is not ready for distribution yet per the gtk-osx.sf.net site. As such, all libraries (including GTK) will be included in the AMIDE app bundle.

  1. XCode: Need to have XCode installed.

  2. GTK-OSX install:

    • Goto http://www.gtk.org/download/macos.php
    • Follow the "Building GTK-OSX" directions.
    • You will need to add the following in .bashrc:
          export PATH=~/.local/bin:$PATH
        
    • Run "source .bashrc" to load this into the shell.
    • GIT: If your version of OS X/X Code does not include GIT, will need to install it.
    • Setup jhbuild for either 32bit or 64bit building. Will need to edit .jhbuildrc-custom with the moduleset and setup_sdk edits suggested under the "Snow Leopard and Lion" portion of the building page. Use the following for the setup_sdk line for 32-bit support:
            setup_sdk(target="10.7", sdk_version="10.7", architectures=["i386"])
          

      Or if building a 64-bit binary:

            setup_sdk(target="10.7", sdk_version="10.7", architectures=["x86_64"])
          
    • Also should probably add the following to the end of .jhbuildrc-custom to prevent rebuilding dependencies that have already been built:
            build_policy = "updated-deps"
          
    • In the following build step, if you get an error about missing libxml2 module, use option "2" (ignore errors and continue).
    • need to build:
            jhbuild bootstrap
            jhbuild build meta-gtk-osx-bootstrap
            jhbuild build meta-gtk-osx-core
          
    • GTK-OSX additional modules:
            jhbuild build libart_lgpl
          
    • Probably need to build freetype and fontconfig
            jhbuild build freetype
            jhbuild build fontconfig
          
  3. Patches for gtk. The first patch is for a change in gdk_quartz_gc_update_cg_context made after gtk 2.24.1 that broke the pixbuf support in libgnomecanvas. This seems to only be problem if nonantialised canvases were used (prior to amide version 1.0.3) and this patch now appears to be skippable. The second patch is for the case where the directory that recently-used.xbel is located have not yet been created, this causes a crash when the amide_log_handler sets of this error as g_log is called leading to recursion.

    Get this patch: gtk+-2.24.6_libgnomecanvas_fix.patch

    Get this patch: gtk+-2.24.21_mkdir_for_recently_used.patch

      jhbuild shell
      cd gtk/source/gtk+-2.24.21 [or whatever the current version of gtk+ is]
      patch -p1 < gtk+-2.24.6_libgnomecanvas_fix.patch [No longer needed for amide version > 1.0.2]
      patch -p1 < gtk+-2.24.21_mkdir_for_recently_used.patch
      make
      make install	      
      exit
    
  4. Get the following file: amide.modules. This file contains instructions for jhbuild to build AMIDE and various other needed packages.

  5. GTK-OSX libgnomecanvas:

    When used in antialiased mode, libgnomecanvas utilizes freetype to draw its fonts. This creates a problem when packaging AMIDE, as the freetype/fontconfig libraries don't like to be relocated. To get around this, the following patch makes libgnomecanvas draw its fonts through a more generic gdk/pango interface - this will end up being the atsui pango module on current OS X builds.

    Get this patch: libgnomecanvas_ft2_dep_removed2.patch

      jhbuild -m amide.modules build libgnomecanvas
     
  6. DCMTK: to get dcmtk running:

      CFLAGS=-D_DARWIN_C_SOURCE CXXFLAGS=-D_DARWIN_C_SOURCE jhbuild -m amide.modules buildone dcmtk
    

    Recently, configure doesn't seem to run automatically when doing this above. If you get an error initially after the jhbuild command, try choosing option "7" (configure).

    Then do the following to get the dictionary built into the library.

      jhbuild shell
      cd ~/gtk/source/dcmtk-3.6.1
      cd dcmdata/libsrc
      make mkdictbi
      ./mkdictbi ../data/dicom.dic ../data/private.dic > dcdictbi.cc
      make
      cd ../..
      make install
      make install-lib
      exit
    

    notes/todo: dcmtk is currently built as static library. ideal would be a shared lib.

  7. XMedCon:

        jhbuild -m amide.modules buildone xmedcon
      

    notes/todo: xmedcon binary errors out, appears to be a problem with gtk_style_get_font in fancy.c. It's okay for now, as all we really need for amide is the library.

  8. Volpack:

        jhbuild -m amide.modules buildone volpack
      
  9. GSL:

        jhbuild -m amide.modules buildone gsl
      
  10. FFMPEG:

    Currently building with ffmpeg-2.1.3, available from the website.

    For 32-bit binaries:

        ./configure --prefix=/Users/loening/gtk/inst --enable-shared --disable-static --arch=x86_32
        [ edit config.mak, add "-arch i386" to the end of CFLAGS and LDFLAGS]
      

    For 64-bit binaries:

        ./configure --prefix=/Users/loening/gtk/inst --enable-shared --disable-yasm \\
                                                     --disable-static --arch=x86_64
      

    I disable yasm so I don't have to install it. Also note, the configure script doesn't recognize ~ as the home directory, so have to specify the full path.

        make
        make install
        cd ~/gtk/inst/include
        ln -s ./ ffmpeg
      
  11. AMIDE:

        jhbuild -m amide.modules buildone amide
      

    When building amide, it'll give you errors about being unable to import libxml2. I haven't gotten around to fixing this, it's only a problem with the help files so I'm skipping it for now. Just use option 2 (ignore errors and continue).

  12. BUNDLING:

    • Currently using gtk-mac-bundler-0.7.0.tar.gz - obtained via GIT. Unpack the tarball, cd into the directory, and perform the following:
            make install
          
    • Grab the amide.bundle, amide.icns, amide.plist, gtkrc, and launcher.sh file from the gtk/source/amide-XYZ/macosx directory.
    • Edit launcher.sh, and insert the current [VERSION] where specified near the top.
    • then:
            jhbuild shell
            export PATH=$PREFIX/bin:~/.local/bin:$PATH
            gtk-mac-bundler amide.bundle
          
    • To get the gdkpixbuf loaders working correctly (needed to export JPEG's)
            gdk-pixbuf-query-loaders | \
            sed 's#/Users/.*loaders/#@executable_path/../Resources/lib/gdk-pixbuf-2.0/loaders/#' \
            > ~/Desktop/AMIDE.app/Contents/Resources/etc/gtk-2.0/gdk-pixbuf.loaders
          
    • And finally:
            zip -r amide-[VERSION]-1_osx_[32 or 64]bit.zip AMIDE.app
          




last modified AML 2014-02-20 Validate: CSS & HTML Project hosted by: SourceForge.net Logo