# texlive-base/cfg - "Build" settings for package

#---------------------------------------------------------------------

[technotes]

#---------------------------------------------------------------------

1. Warning: You'll need about two gigabytes of  free disk space on the
distro's  "build" partition *plus* two gigabytes of free disk space on
the  target partition to  build this package.  Additionally, after the
"build" is completed,  you'll  need about a gigabyte to hold the final
version of the package.

#---------------------------------------------------------------------

2. As of  Fall 2009, the sizes of this distro's versions of  "texlive"
were as follows:

      Normal      hard-disk copy =  709 MB
      LiveDistro "squashfs" copy =  333 MB

As of Fall 2013, the sizes had increased to:

      Normal      hard-disk copy = 1493 MB
      LiveDistro "squashfs" copy =  549 MB

As of Winter 2016, the sizes had increased to:

      Normal      hard-disk copy = 1547 MB
      LiveDistro "squashfs" copy =  614 MB

As of Summer 2017, the sizes had increased to:

      Normal      hard-disk copy = 4890 MB
      LiveDistro "squashfs" copy = 1880 MB (approx.)

#---------------------------------------------------------------------

3. Building  this package while XOrg is running  may cause XOrg to ab-
ort.

#---------------------------------------------------------------------

[buildtimes]

00.49 hours (or 029.35 minutes) - 2021 L.A. dedi box: 6x2 CPU 32GB RAM
00.61 hours (or 036.45 minutes) - ThinkPad W530 i7 4x2 32GB RAM

# Past times (not directly comparable to the above):

00.35 hours (or 021.10 minutes) - ThinkPad E540 i7 4x2 16GB RAM
00.39 hours (or 023.55 minutes) - HP EliteBook 8560w 32GB RAM
00.56 hours (or 033.60 minutes) - Dell Inspiron 6400 2.0 GHz Intel Duo
                                  7200 2GB RAM
01.11 hours (or 066.73 minutes) - Toshiba Satellite C655 E-300 CPU 4GB
                                  RAM
01.88 hours (or 112.98 minutes) - Compaq 1.7 GHz Intel Pentium 4 512MB
                                  RAM

#---------------------------------------------------------------------

[settings]
altpkg     = yes
configure  = no
exepack    = no                 # Handled explicitly
fortran    = disabled
license    = See "license*.txt" in installed tree
nosyslinks = yes
proddir    = $PRODTREE/texlive
purge      = yes
shareddir  = yes
smptries   = 12
strip      = no                 # Handled explicitly

dontfind   = poppler xpdf
tmpsize    = 1433M

setpaths   = \
gcc ghostscript libgmp libgsl libicu luajit mpfr texlive woff2

#---------------------------------------------------------------------

[depends]
actools
atomicops
bison3
boehmgc
brotli
cairo
flex
fontconfig
freetype2
gawk
ghostscript
graphite2
grep
harfbuzz
libgd
libgmp
libgsl
libicu
libpaper
libpng
mpfr
ncurses
pkgconf
poppler
potrace
sed
t1lib
woff2
xpdf
xorg
zlib
zziplib

#---------------------------------------------------------------------

[build]

#---------------------------------------------------------------------

echo ======================= `date` Initial setup start

BINDIR=$PKGDIR_PROD/bin
DOCDIR=$PKGDIR_PROD/doc
INCDIR=$PKGDIR_PROD/include
LIBDIR=$PKGDIR_PROD/lib
MANDIR=$PKGDIR_PROD/man
INFODIR=$DOCDIR/info
LOCDIR=$PKGDIR_PROD/texmf-local
VARDIR=/var/texlive

BADTEST=texk/web2c/eptexdir/wcfname.test
cd .    > $BADTEST
chmod 755 $BADTEST

mkdir -p  $BINDIR $DOCDIR $INCDIR $INFODIR $LIBDIR $MANDIR
mkdir -p  $VARDIR $LOCDIR
chmod 777 $VARDIR

cp -p  $PKGDIR_SPECIAL/license.txt $DOCDIR/
export LANG

SD=$PKGDIR_SPECIAL

chown -R 0.0 .
chmod -R a-s .

find . \
    \( -perm 777 -o -perm 775 -o -perm 711 \
                 -o -perm 555 -o -perm 511 \) \
       -exec chmod 755 {} \;  -o \
    \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 \
                 -o -perm 440 -o -perm 400 \) \
       -exec chmod 644 {} \;

# Suggested by BLFS:
export TEXARCH=$(uname -m | sed -e 's/i.86/i386/' -e 's/$/-linux/')

mkdir build
cd    build

#---------------------------------------------------------------------

echo ======================= `date` Initial setup end
echo ======================= `date` configure start

../configure \
    --prefix=$PKGDIR_PROD           \
    --build=$LACARCHBUILD           \
    --host=$LACARCHHOST             \
    --bindir=$BINDIR                \
    --datarootdir=$PKGDIR_PROD      \
    --includedir=$INCDIR            \
    --infodir=$INFODIR              \
    --libdir=$LIBDIR                \
    --mandir=$MANDIR                \
\
    --with-x                        \
\
    --disable-dependency-tracking   \
    --disable-docs                  \
    --disable-make-rules            \
    --disable-multiplatform         \
    --disable-native-texlive-build  \
    --disable-static                \
    --enable-shared                 \
\
    --with-system-cairo             \
    --with-system-fontconfig        \
    --with-system-freetype2         \
    --with-system-gmp               \
    --with-system-graphite2         \
    --with-system-harfbuzz          \
    --with-system-icu               \
    --with-system-libgs             \
    --with-system-libpaper          \
    --with-system-libpng            \
    --with-system-mpfr              \
    --with-system-pixman            \
    --with-system-zlib

#---------------------------------------------------------------------

echo ======================= `date` configure end
echo ======================= `date` smpmake start

export LACLDDIRS=$LACLDDIRS:`pwd`/texk/web2c/web2c
smpmake

#---------------------------------------------------------------------

echo ======================= `date` smpmake end
echo ======================= `date` make check start

make check >& /tmp/texcheck.log
cat           /tmp/texcheck.log
N=`grep  FAIL /tmp/texcheck.log | grep -v ': *0$' | wc -l`

if [ "x$N" = "x0" ]; then
    echo make check passes
else
    echo make check fails
    exit 1
fi

#---------------------------------------------------------------------

echo ======================= `date` make check end
echo ======================= `date` Install stage 1 start

make install-strip
make texlinks

PP=$PKGDIR_PROD
mkdir -pv $PP/tlpkg/TeXLive/
install -v -m644 ../texk/tests/TeXLive/* $PP/tlpkg/TeXLive/

# RJK: Fix a missing header file
SYNCTEXINC=$INCDIR/synctex/
install -v -m644 \
    ../texk/web2c/synctexdir/synctex_version.h $SYNCTEXINC/

#---------------------------------------------------------------------

echo ======================= `date` Install stage 1 end
echo ======================= `date` Install stage 2 start

tar Jxf $SD/texlive-20*-texmf.tar.xz \
    -C $PP --strip-components=1

#---------------------------------------------------------------------

echo ======================= `date` Install stage 2 end
echo ======================= `date` Install stage 3 start

PATH=$BINDIR:$PATH
pushd $PP

# Upstream patches for "texmf" may be applied at this point. For exam-
# ple:
#     patch -Np1 -i $SD/texlive-20170524-texmf-upstream_fixes-1.patch

chown -R 0.0 .
chmod -R a-s .

sed -e "s@^TEXMFROOT *=.*@TEXMFROOT = $PP@" \
    -e "s@^TEXMFLOCAL *=.*@TEXMFLOCAL = $LOCDIR@" \
    -e "s@^TEXMFSYSVAR *=.*@TEXMFSYSVAR = $VARDIR@" \
    -i texmf-dist/web2c/texmf.cnf
popd

pushd $BINDIR
FN=../texmf-dist/scripts/context/lua/mtxrun.lua
if [ -f $FN ]; then ln -nsf $FN mtxrun; fi
popd

mktexlsr
fmtutil-sys --all
mtxrun --generate
texhash

# Note: "kpsewhich" crashes if it's "upx"-compressed.
#
cd $BINDIR
upx --lzma `find . -type f | grep -v kpsewhich` 2> /dev/null || true

#---------------------------------------------------------------------

echo ======================= `date` Install stage 3 end
echo ======================= `date` Install stage 4 start

find . \
    \( -perm 777 -o -perm 775 -o -perm 711 \
                 -o -perm 555 -o -perm 511 \) \
       -exec chmod 755 {} \;  -o \
    \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 \
                 -o -perm 440 -o -perm 400 \) \
       -exec chmod 644 {} \;

#---------------------------------------------------------------------

echo ======================= `date` Install stage 4 end
echo ======================= `date` Install stage 5 start

mtxrun --generate

echo ======================= `date` Install stage 5 end

#---------------------------------------------------------------------

# Original URLs. These URLs were valid at one point, but may have died
# since then. If you download newer versions of tarballs [etc.], don't
# delete  the  original versions,  as you may not  be able  to replace
# them.

[urls]
url_debian  = Not checked yet
url_home    = http://www.tug.org/texlive/
url_lfs     = Not checked yet

url_tarball = ftp://tug.org/texlive/historic/2023/\
texlive-20230313-source.tar.xz

#---------------------------------------------------------------------

[history]
170819 Updated from svn-35188 to 20170524
180625 Updated to 20180414
180905 Added a missing header file
190509 Updated to 20190410
210207 Updated to 20200406
211025 Updated to 20210325
230320 Updated to 20230313