I followed the answer shared by Dave Jarvis and the TeX-FPC README file to build it for the most recent version of TeX (released on Feb 2021). With the latest version, I encountered a memory issue in generating tex.dvi and had to apply a patch for webmac written by Joachim Kuebart.
I made the build available in a Docker image. It is documented here.
If you want to build it without Docker, then here are the steps.
Step 1 Customize these variables and save them to your ~/.bashrc file. Restart the terminal after doing so.
env TEX_HOME="/root/tex" env PATH="${PATH}:${TEX_HOME}/distro/bin/" env PATH="${PATH}:${TEX_HOME}/tex-fpc/shell/" env PATH="${PATH}:${TEX_HOME}/tex-fpc/MFT/"
Step 2 Install the build dependencies. These are the commands that I use for debian.
apt-get update -y && apt-get upgrade -y apt-get install patch fpc zip unzip procps ed tree -y --no-install-recommends apt-get install wget -y
Step 3 Run the prepare-build.sh script.
#!/usr/bin/env bash set -e mkdir -p "$TEX_HOME" cd "$TEX_HOME" # get the source files wget --no-verbose http://mirrors.ctan.org/systems/knuth/dist.zip wget --no-verbose http://mirrors.ctan.org/systems/knuth/local.zip wget --no-verbose http://mirrors.ctan.org/systems/unix/tex-fpc.zip for i in *.zip; do unzip -q $i; done rm *.zip # base folders that will be required for metafont and tex mkdir distro cd distro mkdir -p TeXinputs TeXformats TeXfonts MFbases MFinputs bin cd "$TEX_HOME" cp -r dist/* tex-fpc # build tangle, which converts .web + .ch files into Pascal files fpc ./tex-fpc/tangle.p mv tex-fpc/tangle distro/bin/ # build weave, which converts .web + .ch files into .tex files cd $TEX_HOME/tex-fpc/web cp ../weave.ch . ../ch.ch/mkprod weave tgl weave.web weave.ch mv weave ../../distro/bin/
Step 4 Run the build-mf.sh script.
#!/usr/bin/env bash set -e # build inimf (the initialization version of metafont, which supports the dump command) cd "$TEX_HOME" itgl ./tex-fpc/mf/mf.web ./tex-fpc/mf.ch mv mf.pool distro/MFbases/ mv inimf distro/bin/ # build plain.base (base files to metafont are like format files to tex) # also note the use of the inimf dump command cd "$TEX_HOME" cp /tmp/local.mf tex-fpc/MFT/ cd distro inimf ../tex-fpc/lib/plain input ../tex-fpc/MFT/local dump mv plain.base MFbases/ # build the production version of metafont cd $TEX_HOME/tex-fpc/mf/ cp ../mf.ch . ../ch.ch/mkprod mf tgl mf.web mf.ch mv mf ../../distro/bin/ # get the source font files cd $TEX_HOME mv local/cm/*mf local/lib/*mf distro/MFinputs/ cp tex-fpc/lib/manfnt.mf distro/MFinputs/ cp tex-fpc/lib/logo10.mf distro/MFinputs/ cp tex-fpc/lib/logo.mf distro/MFinputs/ # use metafont to build the fonts that are required for plain.fmt cd $TEX_HOME/tex-fpc/cm/ ln -s ../../distro/MFbases/ . ln -s ../../distro/MFinputs/ . ln -s ../../distro/TeXfonts/ . plainfonts manfonts webfonts cd $TEX_HOME/distro/ mkfont manfnt mkfont logo10
Step 5 Create the webmac-memory.patch file.
@@ -81,18 +81,17 @@ \outer\def\N#1.#2.{\MN#1.\vfil\eject % beginning of starred section \def\rhead{\uppercase{\ignorespaces#2}} % define running headline \message{*\modno} % progress report \edef\next{\write\cont{\Z{#2}{\modno}{\the\pageno}}}\next % to contents file \ifon\startsection{\bf\ignorespaces#2.\quad}\ignorespaces} \def\MN#1.{\par % common code for \M, \N {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}% remove \* from section name \ifx\modno\modstar \onmaybe \else\ontrue \fi - \mark{{{\tensy x}\modno}{\rhead}}} - % each \mark is {section reference or null}{group title} + \mark{{\tensy x}\modno}} \def\O#1{\hbox{\rm\char'23\kern-.2em\it#1\/\kern.05em}} % octal constant \def\P{\rightskip=0pt plus 100pt minus 10pt % go into Pascal mode \sfcode`;=3000 \pretolerance 10000 \hyphenpenalty 10000 \exhyphenpenalty 10000 \global\ind=2 \1\ \unskip} \def\Q{\rightskip=0pt % get out of Pascal mode \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 } @@ -116,31 +115,29 @@ \let\*=* \def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue \newif\ifon \newif\iftitle \newif\ifpagesaved \def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead \hfill\title\qquad\mainfont\topsecno} % top line on left-hand pages \def\rheader{\mainfont\topsecno\eightrm\qquad\title\hfill \rhead\qquad\mainfont\the\pageno} % top line on right-hand pages -\def\topsecno{\expandafter\takeone\topmark} -\def\takeone#1#2{#1} -\def\taketwo#1#2{#2} +\let\topsecno=\topmark \def\nullsec{\eightrm\kern-2em} % the \kern-2em cancels \qquad in headers \def\page{\box255 } \def\normaloutput#1#2#3{\ifodd\pageno\hoffset=\pageshift\fi \shipout\vbox{ \vbox to\fullpageheight{ \iftitle\global\titlefalse \else\hbox to\pagewidth{\vbox to10pt{}\ifodd\pageno #3\else#2\fi}\fi \vfill#1}} % parameter #1 is the page itself \global\advance\pageno by1} \def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred sections -\mark{\noexpand\nullsec{\rhead}} +\mark{\noexpand\nullsec} \def\title{} % an optional title can be set by the user \def\topofcontents{\centerline{\titlefont\title} \vfill} % this material will start the table of contents page \def\botofcontents{\vfill} % this material will end the table of contents page \def\contentspagenumber{0} % default page number for table of contents \newdimen\pagewidth \pagewidth=6.5in % the width of each page \newdimen\pageheight \pageheight=8.7in % the height of each page \newdimen\fullpageheight \fullpageheight=9in % page height including headlines
Step 6 Run the build-tex.sh script.
#!/usr/bin/env bash set -e # build initex (an initialization version of tex, which supports the dump command to create formats) cd $TEX_HOME itgl ./tex-fpc/tex/tex.web ./tex-fpc/tex.ch mv tex.pool distro/TeXformats/ mv initex distro/bin/ # create the plain format (uses the dump command from initex) cd $TEX_HOME/ cp ./tex-fpc/lib/hyphen.tex distro/TeXinputs/ cd ./tex-fpc/tex ln -s ../../distro/TeXformats/ . ln -s ../../distro/TeXfonts/ . ln -s ../../distro/TeXinputs/ . initex ../lib/plain \\dump mv plain.fmt TeXformats/ # build the production version of tex cd $TEX_HOME/tex-fpc/tex cp ../tex.ch . ../ch.ch/mkprod tex tgl tex.web tex.ch mv tex ../../distro/bin/ # add the webmac files and apply the patch by Joachim Kuebart cd $TEX_HOME/distro cp ../tex-fpc/webmac-fpc.tex ./TeXinputs/ cp ../tex-fpc/lib/webmac.tex ./TeXinputs/ patch ./TeXinputs/webmac.tex -i /tmp/webmac-memory.patch # build the tex.dvi document cd $TEX_HOME/distro weave ../tex-fpc/tex/tex.web ../tex-fpc/tex/tex.ch tex.tex tex tex.tex # list the files in your distro tree
By performing these steps, you will be able to compile .tex documents into .dvi using the tex command, or more preferably, the tex.sh script. The tex.sh script creates soft links for the directories TeXformats and TeXfonts in the work directory and then invokes tex.