% !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.

\section{Important Warnings}

This section contains lessons learned in 2013. The material here is important for all packages made with the new
PackageMaker.

Folders in which packages are built should live on the hard disk rather than an external
disk. Building constructs subfolders named ``root'' which contain copies of material to be installed. This root folder and its
contents are usually owned by root. But material on an external drive is owned by the user instead, so owners will be
incorrect after installing.

The final MacTeX template refers to  root folders of the various sub projects. In the template, each sub project
is listed in the left column; clicking on an arrow there reveals a panel in which the root folder is determined and configured.

Configuration of a root folder is governed by a panel with four tabs: Configuration, Contents, Components, and Scripts.
The material in the first and last tabs is important and should be entered carefully. The second Contents tab allows owners, groups, and
permissions of individual files in the folder to be set. This task is impossible for a huge root folder like TeXLive, but luckily
Apple provides a button "Apply Recommedations" which does it automatically following Apple's "best practices policy."
Always click this button.

For binary files like texlive/2013/bin/universal-darwin, the recommendations are unexpected. Actual binaries have owner root
and group wheel, but symbolic links have owner an individual user and group wheel. Permissions are -rwxr-xr-x. Experiments
and email conversations show that these choices work well.

For the GUI-package, the third tab, "Components", is very important. It lists actual apps and offers to relocate them. {\em Turn this off}.
Otherwise the installer won't upgrade programs in /Applications/TeX, but instead will search the disk for a copy to update.
Always check that these items are off. 

\section{Contents}

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}


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}

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}


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''. 


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