--- Portfile.orig	2013-01-14 14:06:12.000000000 +0100
+++ Portfile	2013-09-30 17:56:22.000000000 +0200
@@ -1,77 +1,97 @@
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # $Id: Portfile 96038 2012-07-30 02:14:11Z dports@macports.org $
 
-PortSystem          1.0
+PortSystem              1.0
 
-name                auto-multiple-choice
-version             1.1.1
-revision        1
-categories          x11 tex education
-platforms           darwin
-license             GPL-2+
-maintainers         univ-lyon1.fr:clot
-
-description         Auto Multiple Choice - Multiple Choice Papers Management
-long_description    Utility to manage multiple choice questionnaires, \
-                    with optionally mixed questions and answers. \
-                    AMC provides automatic marking from papers' scans. \
-                    Annotated papers are produced. Marks can be exported \
-                    as an OpenOffice.org sheet file.
-homepage            http://home.gna.org/auto-qcm
-master_sites        http://download.gna.org/auto-qcm/macports/
-distfiles           ${name}_${version}_precomp${extract.suffix}
-
-checksums           sha1    98f9325bb83d15d55ee15ef5a1e2b7bf9f08d0c0 \
-                    rmd160  e31a9c79bad6a55812b5a2aa38c9e4da940f5ec0
-
-depends_lib         port:opencv
-depends_run         port:p5.12-gtk2 \
-                    port:p5.12-xml-simple \
-                    port:p5.12-xml-writer \
-                    port:p5.12-archive-zip \
-                    port:p5.12-locale-gettext \
-                    port:p5.12-digest-md5 \
-                    port:p5.12-module-load-conditional \
-                    port:GraphicsMagick \
-                    port:p5.12-openoffice-oodoc \
-                    port:p5.12-net-cups \
-                    port:p5.12-file-mimeinfo \
-                    port:p5.12-dbd-sqlite \
-                    port:p5.12-text-csv \
-                    port:p5.12-file-basedir \
-                    port:sqlite3 \
-                    port:poppler \
-                    port:netpbm \
-                    port:librsvg
-
-use_configure       no
-
-build.args          AMCCONF=macports \
-                    BASEPATH=${prefix} \
-                    LATEX_FREE=1 \
-                    GCC_PP="${configure.cc} ${configure.cc_archflags}"
+name                    auto-multiple-choice
+version                 1.2.1
+categories              x11 tex education
+platforms               darwin
+license                 GPL-2+
+maintainers             laposte.fr:joel.brogniart
+
+description             Auto Multiple Choice - Multiple Choice Papers Management
+long_description        Utility to manage multiple choice questionnaires, \
+                        with optionally mixed questions and answers. \
+                        AMC provides automatic marking from papers' scans. \
+                        Annotated papers are produced. Marks can be exported \
+                        as an OpenOffice.org sheet file. \
+                        \
+                        This version can't print directly with CUPS. User should set \
+                        "Printing method" to "file" or "command" in preferences. \
+                        "file" method produce PDF files that could be printed from OS X.
+                    
+homepage                http://home.gna.org/auto-qcm
+master_sites            http://download.gna.org/auto-qcm/macports/
+distfiles               ${name}_${version}_precomp${extract.suffix}
+
+checksums               sha256 534b1a9cd855532bd6c065a29e09dec2ba07c8ee155317e416260a9d5942420a \
+                        rmd160 760b64682e583147b9a774233b10de68513353e3
+
+conflicts               auto-multiple-choice-devel
+
+depends_build-append    port:dblatex \
+                        port:p5.12-xml-libxml
+depends_lib             port:opencv
+depends_run             port:p5.12-gtk2 \
+                        port:p5.12-xml-simple \
+                        port:p5.12-xml-writer \
+                        port:p5.12-archive-zip \
+                        port:p5.12-locale-gettext \
+                        port:p5.12-digest-md5 \
+                        port:p5.12-module-load-conditional \
+                        port:p5.12-perlmagick \
+                        port:p5.12-openoffice-oodoc \
+                        port:p5.12-file-mimeinfo \
+                        port:p5.12-dbd-sqlite \
+                        port:p5.12-text-csv \
+                        port:p5.12-file-basedir \
+                        port:p5.12-email-mime \
+                        port:p5.12-email-sender \
+                        port:sqlite3 \
+                        port:poppler \
+                        port:netpbm \
+                        port:librsvg \
+                        port:gdk-pixbuf2
+
+use_configure           no
+
+build.args              AMCCONF=macports \
+                        BASEPATH=${prefix} \
+                        LATEX_FREE=1 \
+                        GCC_PP="${configure.cc} ${configure.cc_archflags}"
+                    
+# When first installed auto-multiple-choice could fail to launch with
+# a "Format d'image non reconnu at /opt/local/lib/AMC/perl/AMC-gui.pl line 101"
+# ("Unknown image format?").
+# The following update cache command makes auto-multiple-choice happy.
+post-activate {
+  system "${prefix}/bin/gdk-pixbuf-query-loaders --update-cache 2>&1"
+}
 
-destroot.args       AMCCONF=macports \
-                    BASEPATH=${prefix}
+destroot.args           AMCCONF=macports \
+                        BASEPATH=${prefix}
 
 variant latex description "Add LaTeX support" {
-    depends_run-append  port:texlive-latex-extra \
+  depends_run-append    port:texlive-latex-extra \
                         port:texlive-latex-recommended \
-                        port:texlive-xetex
-
-    build.args-delete   LATEX_FREE=1
-
-    post-activate {
-        system "${prefix}/bin/mktexlsr 2>&1"
-    }
-
-    post-deactivate {
-        system "${prefix}/bin/mktexlsr 2>&1"
-    }
+                        port:texlive-fonts-recommended \
+                        port:texlive-xetex \
+                        port:texlive-lang-french
+
+  build.args-delete   LATEX_FREE=1
+
+  post-activate {
+    system "${prefix}/bin/mktexlsr 2>&1"
+  }
+
+  post-deactivate {
+    system "${prefix}/bin/mktexlsr 2>&1"
+  }
 }
 
-default_variants    +latex
+default_variants        +latex
 
-livecheck.type      regex
-livecheck.url       [lindex ${master_sites} 0]
-livecheck.regex     ${name}_(\[0-9.\]+)_
+livecheck.type          regex
+livecheck.url           [lindex ${master_sites} 0]
+livecheck.regex         ${name}_(\[0-9.\]+)_
