% !TEX TS-program = htlatex
\documentclass[11pt, oneside]{amsart}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{url}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\title{TUG-MacTeX-Additions}
\author{Richard Koch}
\date{\today}                                           % Activate to display a given date or no date

\begin{document}
\maketitle
\section{MacTeX Additions}
This is the portion of the TUG documentation which deals with making the MacTeX Additions package.

{\bf Warning:} It is important that the folders in which packages are built live on the hard disk rather than an external
disk. Building constructs folders named ``root'' which are copies of material to be installed. This root folder and its
contents are often owned by root. But material on an external drive is owned by the user instead.

This package is not part of MacTeX, but is furnished on the MacTeX web site for users who obtain
TeX Live another way, or use BasicTeX rather than the full TeX Live.

A clean package file will contain
\begin{itemize}
\item File ``signPackage.sh''
\item Files ``background.jpg'', ``License.rtf'', ``ReadMe.rtf'', ``Welcome.rtf''
\item Folder scripts\_convert containing files ``postinstall'', ``setloginpath'', and ``settexpath''
\item Folder scripts\_ghostscript containing files ``postinstall'' and ``setloginpath''
\item Folder scripts\_gui containing file ``postinstall''
\item The MacTeXMaker project file for PackageMaker
\item ``TUG'' folder with this document
\end{itemize}

This package is easy to maintain. To update the package, the three rtf files must be edited, changing the package name
and release date.
\newpage
\section{Building TeXLive-Additions-2013 with Packagemaker}


Edit MacTeXMaker, the Packagemaker project file, using the GUI interface, as follows.

\begin{enumerate}
\item Click the top item on the left. The right side will change to a view with three tabs. First select
the Configuration tab. Edit so
\begin{enumerate}
\item Title: MacTeX-Additions-2013
\item User Sees: Easy and Custom Intall
\item Install Destination: System volume
\item Certificate: Leave this blank. You might think that putting a certificate name here would correctly sign
the package, but experiments show that it does not. The package needs to be signed after it is constructed.
\item Description: Empty
\end{enumerate}
\item The Requirements and Actions tab entries for the top item can be left blank
\end{enumerate}
\newpage

Click the entry GUI-Applications in the Contents section on the left. The right side will change to a view with two tabs.
\begin{enumerate}
\item  Select the Configuration tab. Edit so
\begin{enumerate}
\item Choice Name: GUI-Applications
\item Identifier: choice1
\item Initial State: Selected and Enabled
\item Destiination: /
\item Tooltip: Leave Blank
\item Description: Leave Blank
\end{enumerate}
\item The Requirements tab entries for this contents item can be left blank
\item Open the GUI-Applications  entry in the bottom left column. This item should show an ``Applications'' directory,
obtained by dragging ../GUI-Applications/root/Applications to the left column. The right side will change to a view with four tabs.
 It is not necessary to edit the
items under the Contents tab. But it is {\em very important} to edit  the Components section, turning off all ``allow relocation'' boxes. The items under the
Configuration tab should be edited as follows:
\begin{enumerate}
\item Install: ../GUI-Applications/root/Applications (The item on the right should have selected ``Relative To Project'')
\item Destination: /Applications (The item on the right should have selected ``Relative To Project'')
\item Do not check ``Allow custom location''
\item Patch: No patch root selected
\item Package Identifier: org.tug.mactex.gui
\item Package Version: 1.0
\item Restart Action: None
\item Check ``Require admin authentication''
\item PackageLocation: Self-Contained
\end{enumerate}
\newpage
The items under the Scripts tab should be edited to read
\begin{enumerate}
\item Scripts directory: scripts\_gui (The item on the right should have selected ``Relative To Project'')
\item Preinstall: Leave Blank
\item Postinstall: scripts\_gui/postinstall (The item on the right should have selected ``Relative To Project'')
\end{enumerate}

\end{enumerate}

\newpage
Click the entry Ghostscript-9.07 in the Contents section on the left. The right side will change to a view with two tabs.
\begin{enumerate}
\item  Select the Configuration tab. Edit so
\begin{enumerate}
\item Choice Name: Ghostscript-9.07
\item Identifier: choice2
\item Initial State: Selected and Enabled
\item Destiination: /
\item Tooltip: Leave Blank
\item Description: Leave Blank
\end{enumerate}
\item The Requirements tab entries for this contents item can be left blank
\item Open the Ghostscript-9.07  entry in the bottom left column. This item should show a ``local'' directory,
obtained by dragging ../Ghostscript-9.07/root/usr/local to the left column. The right side will change to a view with four tabs.
 It is not necessary to edit the
items under the Contents or Components tabs. The items under the
Configuration tab should be edited as follows:
\begin{enumerate}
\item Install: ../Ghostscript-9.07/root/usr/local (The item on the right should have selected ``Relative To Project'')
\item Destination: /usr/local (The item on the right should have selected ``Relative To Project'')
\item Do not check ``Allow custom location''
\item Patch: No patch root selected
\item Package Identifier: org.tug.mactex.ghostscript9.07
\item Package Version: 1.0
\item Restart Action: None
\item Check ``Require admin authentication''
\item PackageLocation: Self-Contained
\end{enumerate}
The items under the Scripts tab should be edited to read
\begin{enumerate}
\item Scripts directory: scripts\_ghostscript (The item on the right should have selected ``Relative To Project'')
\item Preinstall: Leave Blank
\item Postinstall: scripts\_ghostscript/postinstall (The item on the right should have selected ``Relative To Project'')
\end{enumerate}

\end{enumerate}

\newpage
Click the entry Convert-IM-6.8.3 in the Contents section on the left. The right side will change to a view with two tabs.
\begin{enumerate}
\item  Select the Configuration tab. Edit so
\begin{enumerate}
\item Choice Name: Convert-IM-6.8.3
\item Identifier: choice3
\item Initial State: Selected and Enabled
\item Destiination: /
\item Tooltip: Leave Blank
\item Description: Leave Blank
\end{enumerate}
\item The Requirements tab entries for this contents item can be left blank
\item Open the Convert-IM-6.8.3  entry in the bottom left column. This item should show an ``local'' directory,
obtained by dragging ../Convert-IM/rot/usr/local to the left column. The right side will change to a view with four tabs.
 It is not necessary to edit the
items under the Contents or Components tabs. The items under the
Configuration tab should be edited as follows:
\begin{enumerate}
\item Install: ../Convert-IM/root/usr/local (The item on the right should have selected ``Relative To Project'')
\item Destination: /usr/local (The item on the right should have selected ``Relative To Project'')
\item Do not check ``Allow custom location''
\item Patch: No patch root selected
\item Package Identifier: org.tug.mactex.imagemagick-convert-6.8.3-3
\item Package Version: 1.0
\item Restart Action: None
\item Check ``Require admin authentication''
\item PackageLocation: Self-Contained
\end{enumerate}
The items under the Scripts tab should be edited to read
\begin{enumerate}
\item Scripts directory: scripts\_convert (The item on the right should have selected ``Relative To Project'')
\item Preinstall: Leave Blank
\item Postinstall: scripts\_convert/postinstall (The item on the right should have selected ``Relative To Project'')
\end{enumerate}

\end{enumerate}


\newpage
Click the entry Latin-Modern-Fonts in the Contents section on the left. The right side will change to a view with two tabs.
\begin{enumerate}
\item  Select the Configuration tab. Edit so
\begin{enumerate}
\item Choice Name: Latin-Modern-Fonts
\item Identifier: choice4
\item Initial State: Enabled
\item Destiination: /
\item Tooltip: Leave Blank
\item Description: Leave Blank
\end{enumerate}
\item The Requirements tab entries for this contents item can be left blank
\item Open the Latin-Modern-Fonts  entry in the bottom left column. This item should show a ``Fonts'' directory,
obtained by dragging ../Latin-Modern-Fonts/root/Library/Fonts to the left column. The right side will change to a view with four tabs.
 It is not necessary to edit the
items under the Contents or Components tabs. The items under the
Configuration tab should be edited as follows:
\begin{enumerate}
\item Install: ../Latin-Modern-Fonts/root/Library/Fonts (The item on the right should have selected ``Relative To Project'')
\item Destination: /Library/Fonts (The item on the right should have selected ``Relative To Project'')
\item Do not check ``Allow custom location''
\item Patch: No patch root selected
\item Package Identifier: org.tug.mactex.latin-modern
\item Package Version: 1.0
\item Restart Action: None
\item Check ``Require admin authentication''
\item PackageLocation: Self-Contained
\end{enumerate}
The items under the Scripts tab should be left blank

\end{enumerate}


\newpage
Click the entry TeX-Gyre-Fonts in the Contents section on the left. The right side will change to a view with two tabs.
\begin{enumerate}
\item  Select the Configuration tab. Edit so
\begin{enumerate}
\item Choice Name:TeX-Gyre-Fonts
\item Identifier: choice5
\item Initial State: Enabled
\item Destiination: /
\item Tooltip: Leave Blank
\item Description: Leave Blank
\end{enumerate}
\item The Requirements tab entries for this contents item can be left blank
\item Open the TeX-Gyre-Fonts  entry in the bottom left column. This item should show a ``Fonts'' directory,
obtained by dragging ../TeX-Gyre-Fonts/root/Library/Fonts to the left column. The right side will change to a view with four tabs.
 It is not necessary to edit the
items under the Contents or Components tabs. The items under the
Configuration tab should be edited as follows:
\begin{enumerate}
\item Install: ../TeX-Gyre-Fonts/root/Library/Fonts (The item on the right should have selected ``Relative To Project'')
\item Destination: /Library/Fonts (The item on the right should have selected ``Relative To Project'')
\item Do not check ``Allow custom location''
\item Patch: No patch root selected
\item Package Identifier: org.tug.mactex.tex-gyre
\item Package Version: 1.0
\item Restart Action: None
\item Check ``Require admin authentication''
\item PackageLocation: Self-Contained
\end{enumerate}
The items under the Scripts tab should be left blank

\end{enumerate}

\newpage
\section{Building}
After verifying all these items, build the install package by clicking the ``Build'' icon. When asked to select
a name, choose ``MacTeX-Additions-2013-Temp''. 

Packagemaker will report a large number of warnings in the Ghostscript package, but all are incorrect permissions for links. I believe
these permissions are actually correct; they agree with link permissions set by the TeX Live installer.

Packagemaker will also report warnings in the GUI-Applications package. Almost all of these say ``Group ID 80 does not match 20 of root volume.''
Experimentation involving changing the groups of these applications changes this to ``Group ID 20 does not match 80 of root volume.''
I do not believe this warning is important, but it would be nice to know more about it.


\section{Signing}

After the package has been made, sign it by executing the following line in Terminal:
\begin{verbatim}
     sh signPackage.sh
\end{verbatim}
This script simply calls
\begin{verbatim}
     productsign --sign "Developer ID Installer: Richard Koch" old-name new-name
\end{verbatim}
where ``old-name'' is MacTeX-Additions-2013-Temp.pkg and ``new-name'' is MacTeX-Additions-2013.pkg.









\end{document}  