Installing AMC with MacPorts on macOS

Version 8 (Joël Brogniart, 03/23/2024 09:13 am) → Version 9/46 (Joël Brogniart, 03/23/2024 09:13 am)

h1. Installing AMC development version on OS X

This is a translation of the French entry wiki. First translation was done by Pieter Van den Hombergh.

_(This installation - AMC version 1.3.0 revision 1728 b36f9124e727 3/16/2016 4/29/2015 - was tested with OS X 10.11.4, 10.9.5, Xcode 7.3, 6.1, MacPorts 2.3.4)_ 2.3.3 and OS X 10.10.3, Xcode 6.3.2, MacPorts 2.3.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.

In previous versions of this note, the source code of all necessary files were shown. As these sources are provided in the associated archive and not to burden the instructions, source code no longer appear in the note.

It is possible to install the "pre-compiled version
1.1.2":http://project.auto-multiple-choice.net/projects/auto-multiple-choice/wiki/Installation_d'AMC_sous_OS_X , 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 has only been tested on OS X 10.10.3 and 10.9.5 with the latest version of XCode. You will need "MacPorts":http://www.macports.org, 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.

For this installation you will create a local MacPort repository. In this repository you will add macports description for AMC and possibly files for additional ports. AMC. Once these files are this file is installed, the installation of AMC can be started.

h2. Prerequisites

The requirements are the same as the installation of version 1.1.2 AMC. To work with the interface, AMC requires the graphical environment X Window System and X11, the font Linux Libertine font, the DejaVu font family characters and the MacPorts installation 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":http://xquartz.macosforge.org.

h3. MacPorts

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

h3. 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":http://www.linuxlibertine.org LinuxLibertine.org site.

"LinuxLibertine.org":http://www.linuxlibertine.org.

*Caution* : The current version of XQuartz (2.7.8) (2.7.7) does not recognize the fonts installed in the user's folder. You must install the fonts by moving them in the "@/Library/Fonts@" folder.

h3. DejaVu font family

DejaVu fonts are used for japanese documentation generation.
Ces polices sont utilisées pour la génération des documentations en japonais. You need to download the fonts on "dejavu-fonts.org":http://dejavu-fonts.org/wiki/Download site.

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

h2. MacPorts 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. So we have to create the 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.

h3. Local MacPorts repository

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

<pre>mkdir -p ~/nix</pre> ~/nix/macports</pre>

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.

<pre>file:///Users/julesvernes/nix/macports
rsync://rsync.macports.org/release/tarballs/ports.tar [default]</pre>

h3. Port Files

An archive containing the file port described here is available for download: attachment:macports.zip.

Download Ports are grouped into categories and uncompress file organization reflects this archive then move port group. Each port is part of a main category and has its own folder. The main category of AMC in MacPorts is X11, and so the "@macports@" AMC port folder inside, will be located within a folder @X11@.

Here is a command to create
the previously created folder. hierarchy.
<pre>cd ~/nix/macports
mkdir -p x11/auto-multiple-choice-devel</pre>


This should produce:

!port-hierarchy.png!

Each directory must contain a port document named @Portfile@. This document is a text document containing a description for the MacPorts installation tool.

h4. Excerpt for @x11/auto-multiple-choice-devel/Portfile@
<pre title="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
PortGroup bitbucket 1.0
PortGroup perl5 1.0


set bitbucket_commit "23cc81f7ce8a" "b36f912"
set amc_revision "1900"
#1900:23cc81f7ce8a
"1728"

bitbucket.setup auto-multiple-choice auto-multiple-choice ${bitbucket_commit}
#perl5.branches 5.16
name auto-multiple-choice-devel
version 1.3.${amc_revision} 1.2.1.${amc_revision}
categories x11 tex education
platforms darwin
license GPL-2+
maintainers laposte.fr:joel.brogniart,openmaintainer

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

checksums rmd160 52a2f16741171f3c2430d291b7ae086813a879e6 871847a2102c01401a0204e86968f0f43357209a \
sha256 3aea36ff2c5acc872559fa36c14db628bb6bdc71c8c958dfd8715aaf4c9f70df 521d6134fb5869bdf9d105c32be2884dd583d0da01e53f742447056c0e4b1b63

set amc_perl_version "5.16"

depends_build-append \
port:dblatex \
port:p${perl5.major}-xml-libxml port:p${amc_perl_version}-xml-libxml

depends_lib port:opencv

depends_run \
port:gdk-pixbuf2 \
port:libnotify \
port:librsvg \
port:netpbm \
port:p${amc_perl_version}-archive-zip \
port:p${amc_perl_version}-dbd-sqlite \
port:p${amc_perl_version}-digest-md5 \
port:p${amc_perl_version}-email-mime \
port:p${amc_perl_version}-email-sender \
port:p${amc_perl_version}-file-basedir \
port:p${amc_perl_version}-file-mimeinfo \
port:p${amc_perl_version}-glib-object-introspection \
port:p${amc_perl_version}-gtk2 \
port:p${amc_perl_version}-locale-gettext \
port:p${amc_perl_version}-module-load-conditional \
port:p${amc_perl_version}-openoffice-oodoc \
port:p${amc_perl_version}-perlmagick \
port:p${amc_perl_version}-text-csv \
port:p${amc_perl_version}-xml-simple \
port:p${amc_perl_version}-xml-writer \
port:pdftk \
port:poppler \
port:sqlite3

use_configure no
use_parallel_build no

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 AMCCONF=macports BASEPATH=${prefix}"
}

destroot.args AMCCONF=macports \
BASEPATH=${prefix}

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

default_variants +latex

</pre>

h2. Installing AMC

Once the file port set up, generate the index of the new port.
<pre>cd ~/nix/macports
portindex</pre>

*Warning*: standard and development of AMC versions can be installed simultaneously. If a standard version was previously installed, you must uninstall it before installing the development version.

<pre>sudo port uninstall auto-multiple-choice</pre>

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

<pre>sudo port install auto-multiple-choice-devel</pre>

The installation may take a while. When it is complete and if there is no error, AMC is ready to be used.

h2. Using AMC

You can start from the terminal or from XQuartz.

h3. In the Terminal

<pre>auto-multiple-choice</pre>

This command will launch XQuartz and AMC application.

h3. In XQuartz

Start XQuartz application.

!xquartz.png!

We can immediately set XQuartz to facilitate the launch of AMC. Open the @Applications > Customize...@ menu.

!xquartz-menu-applications-personnaliser.png!

In the Personalization window, click the button @Add an entry@.

!xquartz-fenetre-personnaliser-menu-applications.png!

Set "@Auto Multiple Choice@" in the @Name@ column and "@auto-multiple-choice@" in the @Command@ column of the new menu item.

!xquartz-fenetre-personnaliser-menu-applications-2.png!

Close the Customize window, then select the @Applications > Auto Multiple Choice@ menu.

!xquartz-menu-applications-amc.png!

AMC window should appear.

!auto-multiple-choice-window.png!

Auto-multiple-choice is now ready to work.

h2. Links

* Auto Multiple Choice, "http://home.gna.org/auto-qcm/":http://home.gna.org/auto-qcm/.
* Auto Multiple Choice, "Installation sous OS X (10.8)":http://project.auto-multiple-choice.net/projects/auto-multiple-choice/wiki/Installation_d'AMC_sous_OS_X_Mountain_Lion.
* MacPorts, "http://www.macports.org":http://www.macports.org.
* MacPorts, "Local Portfile Repositories":http://guide.macports.org/#development.local-repositories.
* MacPorts, "How to create portfiles for CPAN Perl modules":https://trac.macports.org/wiki/howto/cpan2port.
* XQuartz, http://xquartz.macosforge.org</a>.