« Previous - Version 4/46 (diff) - Next » - Current version
Joël Brogniart, 03/23/2024 09:13 am


Building AMC for MAC OSX

This is a translation of the original wiki entry by Joël Brogniart. Any spelling or translation errors are either mine or Google translate's.

(This installation is running OS X 10.7.5 and OS X 10.8.3 with Xcode 4.6.2 and MacPorts 2.1.3)

Auto Multiple Choice (AMC) is a software to manage questionnaires and multiple choice exams. It allows, from the definition of the multiple choice questions to generate sheets of questionnaires.
The question types can be one only choice, multiple choices, question, right / wrong answers etc.
Once the completed questionnaires are digitized, AMC automatically corrects the questionnaires. This software runs in a graphical environment X Window System on Linux and OS X.
Linux is used as the develop environment, so it probably runs best there. Your mileage may vary.

It is possible to install the pre-compiled version 1.1.1 , but you would miss the newest developments happening in this active project. You can also install from the source, directly from the development
repository. This will give you the bleeding edge version.

For the moment, this installation guide is quite technical and involves only OS X 10.8 (and 10.7.5 with the latest version of XCode).

You will need MacPorts, a little understanding of the dependencies between different tools (Subversion, MacPorts, PERL, X11, port ...) and the OS X-architecture.

You should also have administrative rights on the computer. This manual is therefore unfortunately not for everyone. There is a little problem for communication with the printing tools and the installed version can not print directly, so you might miss some comfort compared to the Linux version. (But you will be producing pdf files which can be handled by your mac quite well). Documents generated by AMC will be printed from OS X.

For this installation you will create a local MacPort repository. In this repository you will add macports description files unknown to macports. The procedure will create a port file for AMC and some additional port files for tools needed to run AMC. Once these files are installed by macport, the installation of AMC can de started.

Prerequisites

The requirements are the same as the installation of version 1.1.1 AMC. To work with the interface, AMC requires the graphical environment X Window System and X11 font Linux Libertine characters and and installation MacPorts system.

OS X does not contain the standard X11 graphical environment. It is possible to fill this gap by installing XQuartz, an X Windows System environment running OS X. You can download the application on the XQuartz site. XQuartz.

Linux Libertine font

Linux Libertine font is a free font that covers code pages for Latin languages​​, Greek, Cyrillic languages​​, Hebrew, the International Phonetic Alphabet (and other). You need to download the package "OTF" on LinuxLibertine.org site. LinuxLibertine.org.

Attention : The current version of XQuartz (2.7.4) does not recognize the fonts installed in the user's folder. You must install the fonts by moving in the "/ Library / Fonts" folder.

MacPorts

MacPorts is a system to build, install and manage open source software. You need to download the installation package Mountain Lion on the site "MacPorts" http://www.macports.org and install MacPorts.

MacPorts files installation (port) files

The MacPorts port file contains information that allows a program to be installed into the MacPorts system. It shows what tools are needed for installation and operation of the program and how to install the program.
MacPorts contains "many ports"http://www.macports.org/ports.php but it does not contain a port describing the AMC installation from the source code of the program. Some tools required for installation and operation of AMC are absent from MacPorts. So we have to create the files to port these tools and file port for the development version of AMC.

To avoid conflicts with ports already described in MacPorts, new ports will be installed in the folders of the user who installs, instead of being installed in folders directly managed by MacPorts.

Note: MacPorts is a collaborative effort and many developers are involved in its development. The files described here they have been proposed to be added to the files referenced in MacPorts. When and if an addition is accepted, the local port file is no longer needed. One day a MacPorts update may be accepted in the standard hierarchy of MacPorts.

Local repository MacPorts

For MacPorts to use a local folder, you must create that local folder.

mkdir -p ~/nix/macports

An archive containing files ports described here is available for download: attachment:macports.zip.

Ports are grouped into categories and file organization reflects this port group. Each port is part of a main category and has its own folder. The main category of AMC in MacPorts X11 is also the case for AMC port will be located within a folder X11. AMC is developed in PERL and requires many CPAN modules. PERL modules to be added will be in the file perl. The following PERL ports will be added. -The following ports will be updated because the version currently available in MacPort is too old. -
  • p5-class-load (module CPAN Class::Load) (plus nécessaire, mis à jour dans MacPorts)
  • p5-email-mime (module CPAN Email::MIME) (plus nécessaire, mis à jour dans MacPorts)
  • p5-email-simple (module CPAN Email::Simple) (plus nécessaire, mis à jour dans MacPorts)

Here is a command to create the hierarchy.

cd ~/nix/macports
mkdir -p perl/p5-email-abstract perl/p5-email-sender perl/p5-moo \
    perl/p5-moox-types-mooselike perl/p5-role-tiny perl/p5-strictures \
    perl/p5-throwable x11/auto-multiple-choice-devel

This should produce:

You should then tell MacPorts to take the local folder into account, before considering the standard hierarchy MacPorts. To do this you must edit the file "/opt/local/etc/macports/sources.conf" and add a URL to the local file before the URL of the repository rsync MacPorts.

Each directory must contain a port document named Portfile. This document is a text document containing a description for the MacPorts installation tool. Files carying new PERL modules were created with the utility cpan2port, then modified to comply with the rules and practices used by contributors MacPorts. For updated modules, a copy of the available port in MacPorts was adapted for the installation of the new version of the tool.

perl/p5-email-abstract/Portfile
PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         Email-Abstract 3.004
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         Email::Abstract - unified interface to mail representations
long_description    Email::Abstract provides module writers with the ability \
                    to write simple, representation-independent mail handling \
                    code. For instance, in the cases of Mail::Thread or \
                    Mail::ListDetector, a key part of the code involves \
                    reading the headers from a mail object. Where previously \
                    one would either have to specify the mail class required, \
                    or to build a new object from scratch, Email::Abstract can \
                    be used to perform certain simple operations on an object \
                    regardless of its underlying representation. \
                    \
                    Email::Abstract currently supports Mail::Internet, \
                    MIME::Entity, Mail::Message, Email::Simple and \
                    Email::MIME. Other representations are encouraged to \
                    create their own Email::Abstract::* class by copying \
                    Email::Abstract::EmailSimple. All modules installed under \
                    the Email::Abstract hierarchy will be automatically \
                    picked up and used.

platforms           darwin
supported_archs     noarch

checksums           sha256 0d195361c1168b2e890b94aeae6b7b4f2d3eaf6664df18f178c543c1fa532a3a \
                    rmd160 a6a99eb1c250392c55ee216c79897796c7c8501b

if {${perl5.major} != ""} {
depends_lib-append  port:p${perl5.major}-email-simple \
                    port:p${perl5.major}-mro-compat

}

perl/p5-email-sender/Portfile
PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         Email-Sender 1.300006
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         Email::Sender - a library for sending email
long_description    Email::Sender replaces the old and sometimes problematic \
                    Email::Send library, which did a decent job at handling \
                    very simple email sending tasks, but was not suitable for \
                    serious use, for a variety of reasons.

platforms           darwin
supported_archs     noarch

checksums           sha256 860fd72a906f1de8755d7e9c791a1d2517229a997c4612199d949eb0857cfbff \
                    rmd160 d37ba19b3bdc961dd9c96a72ab8ed987cb65e7ff

if {${perl5.major} != ""} {
depends_lib-append  port:p${perl5.major}-try-tiny \
                    port:p${perl5.major}-capture-tiny \
                    port:p${perl5.major}-moo \
                    port:p${perl5.major}-sub-exporter \
                    port:p${perl5.major}-throwable \
                    port:p${perl5.major}-module-runtime \
                    port:p${perl5.major}-moox-types-mooselike \
                    port:p${perl5.major}-email-abstract \
                    port:p${perl5.major}-email-simple \
                    port:p${perl5.major}-list-moreutils \
                    port:p${perl5.major}-email-address
}

perl/p5-moo/Portfile
# -*- 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
# $Id$

PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         Moo 1.002000 ../by-authors/id/M/MS/MSTROUT
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         Moo - Minimalist Object Orientation (with Moose compatiblity)
long_description    This module is an extremely light-weight subset of Moose \
                    optimised for rapid startup and \"pay only for what you \
                    use\". \
                    \
                    It also avoids depending on any XS modules to allow simple \
                    deployments. The name Moo is based on the idea that it \
                    provides almost -- but not quite -- two thirds of Moose. \
                    \
                    Unlike Mouse this module does not aim at full \
                    compatibility with Moose's surface syntax, preferring \
                    instead of provide full interoperability via the metaclass \
                    inflation capabilities described in \"MOO AND MOOSE\".

platforms           darwin
supported_archs       noarch

checksums           sha256 4b8284c183a0a0bae0449c51fe5f22d96510192dd990dc905689db8f662c68a1 \
                    rmd160 a8a77e43968856048c2c137e0d9fbfe0c4d99132

if {${perl5.major} != ""} {
depends_lib-append  port:p${perl5.major}-devel-globaldestruction \
                    port:p${perl5.major}-strictures \
                    port:p${perl5.major}-role-tiny \
                    port:p${perl5.major}-module-runtime \
                    port:p${perl5.major}-class-method-modifiers
depends_build-append port:p${perl5.major}-test-fatal
}

perl/p5-moox-types-mooselike/Portfile
PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         MooX-Types-MooseLike 0.23
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         MooX::Types::MooseLike - some Moosish types and a type builder
long_description    ${description}

platforms           darwin
supported_archs       noarch

checksums           sha256 6b4a9b079490cdce9c6ca4f1211ce853da3367801ca35360e0f0c63495dd5f48 \
                    rmd160 6cb1ba26bf37fc8adc105676735e067500d21e14

if {${perl5.major} != ""} {
depends_lib-append  port:p${perl5.major}-moo \
                    port:p${perl5.major}-module-runtime
depends_build-append port:p${perl5.major}-test-fatal
}

perl/p5-role-tiny/Portfile
PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         Role-Tiny 1.002005 ../by-authors/id/M/MS/MSTROUT
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         Role::Tiny - Roles. Like a nouvelle cuisine portion size slice of Moose.
long_description    Role::Tiny is a minimalist role composition tool.

platforms           darwin
supported_archs     noarch

checksums           sha256 3905f99efd3b604a5de83265914aaa0ead1dcb45c6e38b58c24a2de0309e5bee \
                    rmd160 aabe3136c2a3877ef6d110b5873c935673985d91

if {${perl5.major} != ""} {
depends_lib-append  port:p${perl5.major}-test-fatal
}

perl/p5-strictures/Portfile
PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         strictures 1.004004 ../by-authors/id/E/ET/ETHER
license             {Artistic-1 GPL}
platforms           darwin
maintainers         nomaintainer
description         strictures - turn on strict and make all warnings fatal.
long_description    ${description}

checksums           sha256 12117dbaaaa85e07cbf01d95927ecb5ba8d5ed896c18d7dbc6b4be47b255ee34 \
                    rmd160 e9638bdb9621637b457f039913185f1fcf012aa4

supported_archs     noarch

perl/p5-throwable/Portfile
# -*- 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
# $Id$

PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         Throwable 0.200008 ../by-authors/id/R/RJ/RJBS
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         Throwable - a role for classes that can be thrown
long_description    Throwable is a role for classes that are meant to be \
                    thrown as exceptions to standard program flow. It is \
                    very simple and does only two things: saves any previous \
                    value for \$@ and calls die \$self.

platforms           darwin
supported_archs       noarch

checksums           sha256 d08d51862417031d1a47e0645517a9b4d3669b651e93ddbfe27728514118bc79 \
                    rmd160 a69dc110d8d1d5b28f9dd5992a6ca0d45a85aed3

if {${perl5.major} != ""} {
depends_lib-append  port:p${perl5.major}-moox-types-mooselike \
                    port:p${perl5.major}-devel-stacktrace \
                    port:p${perl5.major}-class-load \
                    port:p${perl5.major}-moo
}

x11/auto-multiple-choice-devel/Portfile
# -*- 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
# $Id: Portfile 96038 2012-07-30 02:14:11Z dports@macports.org $

PortSystem              1.0

name                    auto-multiple-choice-devel
svn.revision            1377
version                 1.2.0.${svn.revision}
categories              x11 tex education
platforms               darwin
license                 GPL-2+
maintainers             nomaintainer

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. Documents should be printed from OS X.

homepage                http://home.gna.org/auto-qcm
conflicts               auto-multiple-choice

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

fetch.type              svn
svn.url                 svn://svn.gna.org/auto-qcm/trunk/
worksrcdir              trunk

build.args              AMCCONF=macports \
                        BASEPATH=${prefix} \
                        LATEX_FREE=1 \
                        GCC_PP="${configure.cc} ${configure.cc_archflags}" 

# When building from source, some files should be configured before.
# This pre-configuration use the make tool, not the configure tool.
pre-build {
    system -W ${worksrcpath} "${build.cmd} version_files" 
}

# 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}

variant latex description "Add LaTeX support" {
    depends_run-append  port:texlive-latex-extra \
                        port:texlive-latex-recommended \
                        port:texlive-fonts-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" 
    }
}

default_variants        +latex

livecheck.type          regex
livecheck.url           http://svn.gna.org/viewcvs/auto-qcm/trunk/
livecheck.version       ${svn.revision}
livecheck.regex         {Revision (\d+)}

Installing AMC

Once the files port set up, generate the index of new ports.

cd ~/nix/macports
portindex

Finally, install the development version of AMC can be launched.

auto-multiple-choice-window-2.png (35.1 kB) Joël Brogniart, 07/18/2022 10:56 am