2022/01/13


ASYMPTOTE: The build process for TeX Live does not automatically build
asymptote. Asymptote must be built separately. This requires first 
building three libraries, fftw-3.3.10, gsl-2.7, readline-6.3.
We carefully build these so they will statically link, because they 
may not xist on user machines.

Asymptote also depends on glm, which is a header-only C++ library, 
available at  https://glm.g-truc.net/0.9.9/index.html. 
The latest version is 0.9.9.8, from April 13, 2020. The library 
must be downloaded and a subfolder inside the resulting folder, 
named glm, must be placed in "includes". As usual, we put these 

preparation steps at the end and describe here the steps
to rebuild asymptote if there are changes.


BUILDING ASYMPTOTE:

On Mojave and above, disable the bin, include, lib, share, and texlive 
folders in /usr/local. For example

	cd /usr
	sudo mv local local-temp

The previous step may not really be necessary, but "just in case."
Now build asymptote. 

	cd
	cd ~/texlive2022dev/source/utils/asymptote
	make clean

		(may not be necessary, but reach into texlive2022dev/source/utils/asymptote
		 and throw away the folder gc-8.2.0)

	export CPPFLAGS="-I/Users/koch/AsymptoteBuild/include -I/Users/koch/AsymptoteBuild/include/gsi -I/Users/koch/AsymptoteBuild/include/readline"
	export LDFLAGS="-L/Users/koch/AsymptoteBuild/lib"
	./configure --prefix=/tmp/asyinst --enable-texlive-build
	make  CFLAGS="-g"
	strip asy


Fix Local When Done


	cd /usr/local
	rename bin, lib, share, include, and texlive



To Test, some version of texlive must be active, but not necessarily the newest version, and then

	cd
	cd ~/texlive2022dev/source/utils/asymptote
	make check

	## We want Testing errors…PASSED

	## End of checking
 

Move To Desktop 
	
	cd 
	cd texlive2022dev/source/utils/asymptote
	cp asy ~/Desktop/asy

To Test 3D

	Find the Sample folder in AsymptoteBuild. Make a copy of this folder
	named MySample and place it inside AsymptoteBuild. Put a copy of 
	asy in MySample. We are going to run a pdflatex file through pdflatex,
	and then asy, and then pdflatex again. But the required "base" files
	for asy are missing, so we provide a flag to a copy of these files in
	the asymptote source. Therefore inside MySample:

		pdflatex Sample.tex
		./asy -v -dir /Users/koch/texlive2022dev/source/utils/asymptote/base Sample-*.asy
		pdflatex Sample.tex

	The output Sample.pdf should have two illustrations, one a three dimensional cube.


----------------

NOTES: gsl-2.7 is latest, released June 1, 2021

	fftw 3.3.10 is the latest, released Sept 15, 2021

	glm-0.9.9.8 is the latest, released on April 13, 2020


This as of Jan 3, 2021





INITIAL STEPS; DO THESE JUST ONCE BEFORE BEGINNING
TO BUILD ASYMPTOTE:

You must compile three libraries, which will be statically linked so that in
the end they are not installed in a user's system. 

Create a folder named "AsymptoteBuild" in your home directory.

Get the Fast Fourier Transform Library (FFTW) from http://www.fftw.org/
and install the tar.gz file in AsymptoteBuild. Decompress it, producing a folder
named fftw-3.3.10. 

Get the GNU Scientific Library (GSL) from http://www.gnu.org/software/gsl/
and install the tar.gz file in AsymptoteBuild. Decompress it, producing a folder
named gsl-2.7.1. 

Get the GNU Readline Library from https://tiswww.case.edu/php/chet/readline/rltop.html and and install the tar.gz file in AsymptoteBuild. We use version 6.3, which has always worked, rather than version 7.0. Decompress it, producing a folder 
named readline-6.3 containing the source code. Before compiling readline 6.3, one problem requires "fixing", at least on arm. The ioctl function needs to be declared in C99. This requires #include <sys/ioctl.h> in rltty.c and terminal.c. 


Get the glm-0.9.9.8 library from https://glm.g-truc.net/0.9.9/index.html and install the tar.gz file in AsymptoteBuild. 
Decompress, producing a folder named glm-0.9.9.8.


Build these libraries as follows:

	cd ~/AsymptoteBuild
	cd fftw-3.3.10
	make clean
	./configure --prefix=/Users/koch/AsymptoteBuild --exec-prefix=/Users/koch/AsymptoteBuild
	make
	make install

	cd ..
	cd gsl-2.7.1
	make clean
	./configure --prefix=/Users/koch/AsymptoteBuild --exec-prefix=/Users/koch/AsymptoteBuild
	make
	make install

	cd ..
	cd readline-6.3
	make clean
	make
	make install

	cd /Users/koch/AsymptoteBuild/lib
	rm -f *.dylib
	rm -f *.la

	The glm library requires no building. Instead, open the folder and find the subfolder glm. 
	Make a copy of this folder and put it inside the "include" folder, which was created by the
	previous "make install" commands.


--------------------------------


To see which dylibs are called by asymptote:

	otool -L asy



