Installing AMC with MacPorts on macOS

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

1 7 Joël Brogniart
h1. Installing AMC development version on OS X
2 1
3 7 Joël Brogniart
This is a translation of the French entry wiki. First translation was done by Pieter Van den Hombergh.
4 1
5 7 Joël Brogniart
_(This installation - revision 1728 b36f9124e727 4/29/2015 - was tested with OS X 10.9.5, Xcode 6.1, MacPorts 2.3.3 and OS X 10.10.3, Xcode 6.3.2, MacPorts 2.3.3)_
6 1
7 7 Joël Brogniart
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.
8 1
9 7 Joël Brogniart
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.
10 1
11 7 Joël Brogniart
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.
12 1
13 7 Joël Brogniart
For this installation you will create a local MacPort repository. In this repository you will add macports description for AMC. Once this file is installed, the installation of AMC can be started.
14 1
15 1
h2. Prerequisites
16 1
17 7 Joël Brogniart
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, font Linux Libertine characters and the MacPorts installation system.
18 1
19 1
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.
20 2 Joël Brogniart
21 7 Joël Brogniart
h3. MacPorts
22 1
23 7 Joël Brogniart
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.
24 1
25 7 Joël Brogniart
h3. Linux Libertine font
26 1
27 7 Joël Brogniart
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":http://www.linuxlibertine.org. 
28 1
29 7 Joël Brogniart
*Caution* : The current version of XQuartz (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.
30 1
31 7 Joël Brogniart
h2. MacPorts installation (port) files
32 1
33 7 Joël Brogniart
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. 
34 7 Joël Brogniart
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.
35 2 Joël Brogniart
36 2 Joël Brogniart
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.
37 4 Joël Brogniart
38 7 Joël Brogniart
h3. Local MacPorts repository
39 4 Joël Brogniart
40 7 Joël Brogniart
For MacPorts to use a local folder, you must create that local folder.
41 4 Joël Brogniart
42 4 Joël Brogniart
<pre>mkdir -p ~/nix/macports</pre>
43 4 Joël Brogniart
44 7 Joël Brogniart
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.
45 4 Joël Brogniart
46 7 Joël Brogniart
<pre>file:///Users/julesvernes/nix/macports
47 7 Joël Brogniart
rsync://rsync.macports.org/release/tarballs/ports.tar [default]</pre>
48 4 Joël Brogniart
49 7 Joël Brogniart
h3. Port Files
50 4 Joël Brogniart
51 7 Joël Brogniart
An archive containing the file port described here is available for download: attachment:macports.zip.
52 7 Joël Brogniart
53 7 Joël Brogniart
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 is X11, and so the AMC port folder will be located within a folder @X11@.
54 7 Joël Brogniart
55 4 Joël Brogniart
Here is a command to create the hierarchy.
56 4 Joël Brogniart
<pre>cd ~/nix/macports
57 7 Joël Brogniart
mkdir -p x11/auto-multiple-choice-devel</pre>
58 4 Joël Brogniart
59 4 Joël Brogniart
This should produce: 
60 4 Joël Brogniart
61 4 Joël Brogniart
!port-hierarchy.png!
62 4 Joël Brogniart
63 7 Joël Brogniart
Each directory must contain a port document named @Portfile@. This document is a text document containing a description for the MacPorts installation tool.
64 4 Joël Brogniart
65 4 Joël Brogniart
h4. @x11/auto-multiple-choice-devel/Portfile@
66 4 Joël Brogniart
<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
67 4 Joël Brogniart
# $Id: Portfile 96038 2012-07-30 02:14:11Z dports@macports.org $
68 4 Joël Brogniart
69 4 Joël Brogniart
PortSystem              1.0
70 7 Joël Brogniart
PortGroup               bitbucket 1.0
71 7 Joël Brogniart
72 7 Joël Brogniart
set bitbucket_commit    "b36f912"
73 7 Joël Brogniart
set amc_revision        "1728"
74 7 Joël Brogniart
75 7 Joël Brogniart
bitbucket.setup         auto-multiple-choice auto-multiple-choice ${bitbucket_commit}
76 4 Joël Brogniart
name                    auto-multiple-choice-devel
77 7 Joël Brogniart
version                 1.2.1.${amc_revision}
78 4 Joël Brogniart
categories              x11 tex education
79 4 Joël Brogniart
platforms               darwin
80 4 Joël Brogniart
license                 GPL-2+
81 7 Joël Brogniart
maintainers             laposte.fr:joel.brogniart,openmaintainer
82 4 Joël Brogniart
83 4 Joël Brogniart
description             Auto Multiple Choice - Multiple Choice Papers Management
84 4 Joël Brogniart
long_description        Utility to manage multiple choice questionnaires, \
85 4 Joël Brogniart
                        with optionally mixed questions and answers. \
86 4 Joël Brogniart
                        AMC provides automatic marking from papers' scans. \
87 4 Joël Brogniart
                        Annotated papers are produced. Marks can be exported \
88 4 Joël Brogniart
                        as an OpenOffice.org sheet file. \
89 4 Joël Brogniart
                        \
90 7 Joël Brogniart
                        This version can't print directly with CUPS. User should set \
91 7 Joël Brogniart
                        "Printing method" to "file" or "command" in preferences. \
92 7 Joël Brogniart
                        "file" method produce PDF files that could be printed from OS X.
93 7 Joël Brogniart
                    
94 4 Joël Brogniart
homepage                http://home.gna.org/auto-qcm
95 4 Joël Brogniart
96 7 Joël Brogniart
checksums               rmd160  871847a2102c01401a0204e86968f0f43357209a \
97 7 Joël Brogniart
                        sha256  521d6134fb5869bdf9d105c32be2884dd583d0da01e53f742447056c0e4b1b63
98 7 Joël Brogniart
99 7 Joël Brogniart
set amc_perl_version    "5.16"
100 7 Joël Brogniart
101 7 Joël Brogniart
depends_build-append    \
102 7 Joël Brogniart
                        port:dblatex \
103 7 Joël Brogniart
                        port:p${amc_perl_version}-xml-libxml
104 7 Joël Brogniart
105 4 Joël Brogniart
depends_lib             port:opencv
106 7 Joël Brogniart
107 7 Joël Brogniart
depends_run             \
108 7 Joël Brogniart
                        port:gdk-pixbuf2 \
109 7 Joël Brogniart
                        port:libnotify \
110 4 Joël Brogniart
                        port:librsvg \
111 7 Joël Brogniart
                        port:netpbm \
112 7 Joël Brogniart
                        port:p${amc_perl_version}-archive-zip \
113 7 Joël Brogniart
                        port:p${amc_perl_version}-dbd-sqlite \
114 7 Joël Brogniart
                        port:p${amc_perl_version}-digest-md5 \
115 7 Joël Brogniart
                        port:p${amc_perl_version}-email-mime \
116 7 Joël Brogniart
                        port:p${amc_perl_version}-email-sender \
117 7 Joël Brogniart
                        port:p${amc_perl_version}-file-basedir \
118 7 Joël Brogniart
                        port:p${amc_perl_version}-file-mimeinfo \
119 7 Joël Brogniart
                        port:p${amc_perl_version}-glib-object-introspection \
120 7 Joël Brogniart
                        port:p${amc_perl_version}-gtk2 \
121 7 Joël Brogniart
                        port:p${amc_perl_version}-locale-gettext \
122 7 Joël Brogniart
                        port:p${amc_perl_version}-module-load-conditional \
123 7 Joël Brogniart
                        port:p${amc_perl_version}-openoffice-oodoc \
124 7 Joël Brogniart
                        port:p${amc_perl_version}-perlmagick \
125 7 Joël Brogniart
                        port:p${amc_perl_version}-text-csv \
126 7 Joël Brogniart
                        port:p${amc_perl_version}-xml-simple \
127 7 Joël Brogniart
                        port:p${amc_perl_version}-xml-writer \
128 8 Joël Brogniart
                        port:pdftk \
129 7 Joël Brogniart
                        port:poppler \
130 7 Joël Brogniart
                        port:sqlite3
131 4 Joël Brogniart
132 4 Joël Brogniart
use_configure           no
133 7 Joël Brogniart
use_parallel_build  no
134 4 Joël Brogniart
135 4 Joël Brogniart
build.args              AMCCONF=macports \
136 4 Joël Brogniart
                        BASEPATH=${prefix} \
137 4 Joël Brogniart
                        LATEX_FREE=1 \
138 4 Joël Brogniart
                        GCC_PP="${configure.cc} ${configure.cc_archflags}"
139 4 Joël Brogniart
140 4 Joël Brogniart
# When building from source, some files should be configured before.
141 4 Joël Brogniart
# This pre-configuration use the make tool, not the configure tool.
142 4 Joël Brogniart
pre-build {
143 7 Joël Brogniart
    system -W ${worksrcpath} "${build.cmd} version_files AMCCONF=macports BASEPATH=${prefix}"
144 4 Joël Brogniart
}
145 4 Joël Brogniart
146 4 Joël Brogniart
destroot.args           AMCCONF=macports \
147 4 Joël Brogniart
                        BASEPATH=${prefix}
148 4 Joël Brogniart
149 4 Joël Brogniart
variant latex description "Add LaTeX support" {
150 7 Joël Brogniart
  depends_run-append     \
151 4 Joël Brogniart
                        port:texlive-fonts-recommended \
152 7 Joël Brogniart
                        port:texlive-lang-french \
153 7 Joël Brogniart
                        port:texlive-latex-extra \
154 7 Joël Brogniart
                        port:texlive-latex-recommended \
155 4 Joël Brogniart
                        port:texlive-xetex
156 4 Joël Brogniart
157 7 Joël Brogniart
  build.args-delete   LATEX_FREE=1
158 4 Joël Brogniart
159 7 Joël Brogniart
  post-activate {
160 7 Joël Brogniart
    system "${prefix}/bin/mktexlsr 2>&1"
161 7 Joël Brogniart
  }
162 4 Joël Brogniart
163 7 Joël Brogniart
  post-deactivate {
164 7 Joël Brogniart
    system "${prefix}/bin/mktexlsr 2>&1"
165 7 Joël Brogniart
  }
166 4 Joël Brogniart
}
167 4 Joël Brogniart
168 4 Joël Brogniart
default_variants        +latex
169 7 Joël Brogniart
</pre>
170 4 Joël Brogniart
171 4 Joël Brogniart
h2. Installing AMC
172 4 Joël Brogniart
173 7 Joël Brogniart
Once the file port set up, generate the index of the new port.
174 5 Joël Brogniart
<pre>cd ~/nix/macports
175 5 Joël Brogniart
portindex</pre>
176 5 Joël Brogniart
177 7 Joël Brogniart
*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.
178 5 Joël Brogniart
179 7 Joël Brogniart
<pre>sudo port uninstall auto-multiple-choice</pre>
180 5 Joël Brogniart
181 7 Joël Brogniart
Finally, installation of the development version of AMC can be launched.
182 5 Joël Brogniart
183 7 Joël Brogniart
<pre>sudo port install auto-multiple-choice-devel</pre>
184 5 Joël Brogniart
185 7 Joël Brogniart
The installation may take a while. When it is complete and if there is no error, AMC is ready to be used.
186 5 Joël Brogniart
187 5 Joël Brogniart
h2. Using AMC
188 5 Joël Brogniart
189 5 Joël Brogniart
You can start from the terminal or from XQuartz.
190 5 Joël Brogniart
191 7 Joël Brogniart
h3. In the Terminal
192 5 Joël Brogniart
193 7 Joël Brogniart
<pre>auto-multiple-choice</pre>
194 5 Joël Brogniart
195 5 Joël Brogniart
This command will launch XQuartz and AMC application.
196 5 Joël Brogniart
197 7 Joël Brogniart
h3. In XQuartz
198 5 Joël Brogniart
199 5 Joël Brogniart
Start XQuartz application.
200 5 Joël Brogniart
201 5 Joël Brogniart
!xquartz.png!
202 5 Joël Brogniart
203 7 Joël Brogniart
We can immediately set XQuartz to facilitate the launch of AMC. Open the @Applications > Customize...@ menu.
204 5 Joël Brogniart
205 5 Joël Brogniart
!xquartz-menu-applications-personnaliser.png!
206 5 Joël Brogniart
207 7 Joël Brogniart
In the Personalization window, click the button @Add an entry@.
208 7 Joël Brogniart
209 5 Joël Brogniart
!xquartz-fenetre-personnaliser-menu-applications.png!
210 5 Joël Brogniart
211 7 Joël Brogniart
Set "@Auto Multiple Choice@" in the @Name@ column and "@auto-multiple-choice@" in the @Command@ column of the new menu item.
212 5 Joël Brogniart
213 7 Joël Brogniart
!xquartz-fenetre-personnaliser-menu-applications-2.png!
214 5 Joël Brogniart
215 7 Joël Brogniart
Close the Customize window, then select the @Applications > Auto Multiple Choice@ menu.
216 5 Joël Brogniart
217 7 Joël Brogniart
!xquartz-menu-applications-amc.png!
218 5 Joël Brogniart
219 5 Joël Brogniart
AMC window should appear.
220 5 Joël Brogniart
221 7 Joël Brogniart
!auto-multiple-choice-window.png!
222 5 Joël Brogniart
223 7 Joël Brogniart
Auto-multiple-choice is now ready to work.
224 5 Joël Brogniart
225 5 Joël Brogniart
h2. Links
226 5 Joël Brogniart
227 5 Joël Brogniart
* Auto Multiple Choice, "http://home.gna.org/auto-qcm/":http://home.gna.org/auto-qcm/.
228 7 Joël Brogniart
* 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.
229 5 Joël Brogniart
* MacPorts, "http://www.macports.org":http://www.macports.org.
230 5 Joël Brogniart
* MacPorts, "Local Portfile Repositories":http://guide.macports.org/#development.local-repositories.
231 5 Joël Brogniart
* MacPorts, "How to create portfiles for CPAN Perl modules":https://trac.macports.org/wiki/howto/cpan2port.
232 5 Joël Brogniart
* XQuartz, http://xquartz.macosforge.org</a>.