| 1 |
(This file was generated by makeinfo and splitinfo.gawk.) |
| 2 |
(Released under the old-style GNU documentation license; |
| 3 |
see sources or other output files for full text.) |
| 4 |
|
| 5 |
6 Layout and infrastructure |
| 6 |
*************************** |
| 7 |
|
| 8 |
The TeX Live source tree is the subtree rooted at 'Build/source' of the |
| 9 |
complete TL distribution and contains the sources for all executables |
| 10 |
distributed by TL, as well as 'configure' scripts and 'make' rules to |
| 11 |
build and install them together with some of their support files. |
| 12 |
|
| 13 |
6.1 Build system tools |
| 14 |
====================== |
| 15 |
|
| 16 |
As mentioned above (see Prerequisites), a normal build has few |
| 17 |
requirements. On the other hand, if you want to modify the TeX Live |
| 18 |
infrastructure sources, such as 'configure.ac' or 'Makefile.am' files, |
| 19 |
you will need to have several additional tools installed. |
| 20 |
|
| 21 |
In general, the TL build system uses the latest released versions of |
| 22 |
the GNU build tools, installed directly from the original GNU releases |
| 23 |
(e.g., by building them with 'configure --prefix=/usr/local/gnu' and |
| 24 |
having 'PATH' start with '/usr/local/gnu/bin'). We have found that |
| 25 |
trying to use the versions of these tools packaged for distros causes |
| 26 |
many extra hassles, so don't do that, tempting as it may be. |
| 27 |
|
| 28 |
Currently the versions we use are: |
| 29 |
|
| 30 |
autoconf (GNU Autoconf) 2.72 |
| 31 |
automake (GNU automake) 1.18.1 |
| 32 |
bison (GNU Bison) 3.8.2 |
| 33 |
flex 2.6.0 |
| 34 |
ltmain.sh (GNU libtool) 2.5.4 |
| 35 |
m4 (GNU M4) 1.4.21 |
| 36 |
makeinfo (GNU texinfo) 7.2 |
| 37 |
|
| 38 |
These versions should be used to update the generated files (e.g., |
| 39 |
'configure' or 'Makefile.in') in all or parts of the TL tree after their |
| 40 |
dependencies have been changed. This can be done explicitly with the |
| 41 |
top-level 'reautoconf' script or implicitly by using the configure |
| 42 |
option '--enable-maintainer-mode'. |
| 43 |
|
| 44 |
It has often turned out that the bison and flex versions are not |
| 45 |
critical; however, the autotools versions are. If you don't have the |
| 46 |
given versions, get them before modifying the build infrastructure. |
| 47 |
|
| 48 |
The files in the Subversion repository (see |
| 49 |
<https://tug.org/texlive/svn>) are all up to date (barring bugs). For |
| 50 |
this to be reflected by their timestamps in your checkout, be sure to |
| 51 |
set 'use-commit-times=yes' in '~/.subversion/config' or the equivalent. |
| 52 |
|
| 53 |
If timestamps are wrong, you may also be able to avoid unnecessary |
| 54 |
runs of 'bison', 'flex', or 'makeinfo' with 'touch' of the generated |
| 55 |
('.c', '.h', or '.info') files. With '--enable-maintainer-mode' it may |
| 56 |
also be necessary to 'touch' first 'aclocal.m4', then 'configure' and |
| 57 |
'config.h.in' (or 'c-auto.in'), and finally all 'Makefile.in' files. |
| 58 |
|
| 59 |
6.2 Top-level directories |
| 60 |
========================= |
| 61 |
|
| 62 |
Here is a brief description of the top-level directories in the TeX Live |
| 63 |
source tree. |
| 64 |
|
| 65 |
As mentioned at the beginning of see Overview of build system, the |
| 66 |
main source directories are 'texk/' (TeX-specific programs and |
| 67 |
libraries), 'utils/' (additional programs), and 'libs/' (generic |
| 68 |
libraries). |
| 69 |
|
| 70 |
In addition, the top-level directories 'am/' and 'm4/' contain |
| 71 |
'Makefile.am' fragments and Autoconf macros, respectively, used in many |
| 72 |
places. Specifically, the file 'm4/kpse-pkgs.m4' contains lists of all |
| 73 |
program and library modules; missing modules are silently ignored. |
| 74 |
(This helps in creating cut-down source trees.) |
| 75 |
|
| 76 |
Each module contributes fragments (in separate files) defining its |
| 77 |
capabilities and requirements to the 'configure.ac' scripts at the |
| 78 |
top-level and in the subdirectories 'libs', 'utils', and 'texk'. The |
| 79 |
fragments from program modules supply 'configure' options to disable or |
| 80 |
enable building them; those from library modules specify if an installed |
| 81 |
(system) version of that library can be used. This ultimately |
| 82 |
determines which modules need to be built--although all modules must be |
| 83 |
configured for the benefit of 'make' targets such as 'dist' or |
| 84 |
'distcheck'. |
| 85 |
|
| 86 |
The top-level 'build-aux/' directory contains the common files |
| 87 |
'compile', 'config.guess', 'config.sub', 'depcomp', etc. used by most |
| 88 |
packages. These are taken from the GNU Gnulib sources |
| 89 |
(<https://www.gnu.org/software/gnulib>), which in turn synchronizes with |
| 90 |
any ultimate upstream repository. There are independent copies of some |
| 91 |
of these in a few other places, e.g., |
| 92 |
'libs/freetype2/freetype-*/builds/unix/'. The 'reautoconf' script does |
| 93 |
not touch those, but a TL cron job keeps them in sync (nightly). |
| 94 |
|
| 95 |
When the top-level './Build' script is used to build TL, two more two |
| 96 |
more top-level directories appear: 'Work/' for the build tree, and |
| 97 |
'inst/' for the install tree (from 'make install'). These names (and |
| 98 |
everything else about 'Build''s operation) can be changed by setting |
| 99 |
environment variables before running it; see the script source. |
| 100 |
|
| 101 |
6.3 Autoconf macros |
| 102 |
=================== |
| 103 |
|
| 104 |
Here we describe a few of the Autoconf macros used in several |
| 105 |
modules--many more are defined in the sources; see the top-level 'm4/' |
| 106 |
directory. These general macros are supplemented by module-specific |
| 107 |
macros in directories such as 'texk/dvipng/m4/'; some of those are |
| 108 |
described in following sections (see Library modules and Program |
| 109 |
modules). |
| 110 |
|
| 111 |
6.3.1 General setup macros |
| 112 |
-------------------------- |
| 113 |
|
| 114 |
The TL sources use two general setup macros: |
| 115 |
|
| 116 |
-- Macro: KPSE_BASIC (NAME, [MORE-OPTIONS]) |
| 117 |
Initialize the basic TL infrastructure for module NAME: |
| 118 |
'AM_INIT_AUTOMAKE([foreign MORE-OPTIONS])' |
| 119 |
'AM_MAINTAINER_MODE' |
| 120 |
'KPSE_COMPILER_WARNINGS' |
| 121 |
and make sure the C compiler understands function prototypes. This |
| 122 |
is used for all generic library and program modules. |
| 123 |
|
| 124 |
-- Macro: KPSE_COMMON (NAME, [MORE-OPTIONS]) |
| 125 |
Like 'KPSE_BASIC' but add: |
| 126 |
'LT_PREREQ([2.2.6])' |
| 127 |
'LT_INIT([win32-dll])' |
| 128 |
'AC_SYS_LARGEFILE' |
| 129 |
'AC_FUNC_FSEEKO' |
| 130 |
along with checks for frequently used functions, headers, types, |
| 131 |
and structures. This is used for TeX-specific modules. |
| 132 |
|
| 133 |
6.3.2 Macros for programs |
| 134 |
------------------------- |
| 135 |
|
| 136 |
Macros for program checks: |
| 137 |
|
| 138 |
-- Macro: KPSE_CHECK_LATEX |
| 139 |
Set 'LATEX' to the first of 'latex', 'elatex', or 'lambda' which |
| 140 |
exists in 'PATH', or to 'no' if none of them exists. Call |
| 141 |
'AC_SUBST' for 'LATEX'. The result of this test can be overridden |
| 142 |
by setting the 'LATEX' environment variable or the cache variable |
| 143 |
'ac_cv_prog_LATEX'. |
| 144 |
|
| 145 |
-- Macro: KPSE_CHECK_PDFLATEX |
| 146 |
Check for 'pdflatex' in 'PATH' and set 'PDFLATEX'. |
| 147 |
|
| 148 |
-- Macro: KPSE_CHECK_PERL |
| 149 |
Check for 'perl' or 'perl5' in 'PATH' and set 'PERL'. |
| 150 |
|
| 151 |
-- Macro: KPSE_PROG_LEX |
| 152 |
Call 'AC_PROG_LEX' and add the flag '-l' for 'flex'. |
| 153 |
|
| 154 |
6.3.3 Macros for compilers |
| 155 |
-------------------------- |
| 156 |
|
| 157 |
Macros for compiler-related checks: |
| 158 |
|
| 159 |
-- Macro: KPSE_COMPILER_WARNINGS |
| 160 |
When using the (Objective) C/C++ compiler, set |
| 161 |
'WARNING_[OBJ]C[XX]FLAGS' to suitable warning flags (depending on |
| 162 |
the value given to or implied for '--enable-compiler-warnings'). |
| 163 |
Call 'AC_SUBST' for them. At present this assumes GNU compiler |
| 164 |
warning options, but could be extended to others if necessary. |
| 165 |
|
| 166 |
This macro caches its results in the 'kpse_cv_warning_cflags', ... |
| 167 |
variables. |
| 168 |
|
| 169 |
-- Macro: KPSE_COMPILER_VISIBILITY |
| 170 |
When using the C or C++ compiler, try to set |
| 171 |
'VISIBILITY_C[XX]FLAGS' to flags to hide external symbols. Call |
| 172 |
'AC_SUBST' for this variable. This tests for the compiler option |
| 173 |
'-fvisibility=hidden' and, except for C, |
| 174 |
'-fvisibility-inlines-hidden'. Reports or patches for additional |
| 175 |
tests are welcome. |
| 176 |
|
| 177 |
This macro caches its results in the 'kpse_cv_visibility_cflags' or |
| 178 |
'kpse_cv_visibility_cxxflags' variable. |
| 179 |
|
| 180 |
-- Macro: KPSE_CXX_HACK |
| 181 |
Provide the configure option '--enable-cxx-runtime-hack'. If |
| 182 |
enabled and when using 'g++', try to statically link with |
| 183 |
'libstdc++', notably improving portability of the resulting binary. |
| 184 |
|
| 185 |
This macro caches its result in the 'kpse_cv_cxx_hack' variable. |
| 186 |
|
| 187 |
6.3.4 Macros for libraries |
| 188 |
-------------------------- |
| 189 |
|
| 190 |
One macro for a library check: |
| 191 |
|
| 192 |
-- Macro: KPSE_LARGEFILE (VARIABLE, [EXTRA-DEFINE]) |
| 193 |
Call 'AC_SYS_LARGEFILE' and 'AC_FUNC_FSEEKO' and append suitable |
| 194 |
'-D' flags (optionally including '-DEXTRA-DEFINE') to VARIABLE. |
| 195 |
|
| 196 |
6.3.5 Macros for library and header flags |
| 197 |
----------------------------------------- |
| 198 |
|
| 199 |
Each library module 'libs/LIB' or 'texk/LIB' is supplemented by a macro |
| 200 |
'KPSE_LIB_FLAGS' (all uppercase) that provides make variables for that |
| 201 |
library. E.g., for 'libs/libpng': |
| 202 |
|
| 203 |
-- Macro: KPSE_LIBPNG_FLAGS |
| 204 |
Provide the configure option '--with-system-libpng'. Set and |
| 205 |
'AC_SUBST' 'make' variables for modules using this library (either |
| 206 |
an installed version or from the TeX Live tree): |
| 207 |
|
| 208 |
'LIBPNG_INCLUDES' for use in 'CPPFLAGS', |
| 209 |
'LIBPNG_LIBS' for use in 'LDADD', |
| 210 |
'LIBPNG_DEPEND' for use as a Makefile dependency, |
| 211 |
'LIBPNG_RULE' for the 'make' rules to rebuild the library. |
| 212 |
|
| 213 |
-- Macro: KPSE_ADD_FLAGS (NAME) |
| 214 |
Temporarily extend 'CPPFLAGS' and 'LIBS' with the values required |
| 215 |
for the library module 'NAME'. |
| 216 |
|
| 217 |
-- Macro: KPSE_RESTORE_FLAGS |
| 218 |
Restore 'CPPFLAGS' and 'LIBS' to their original values. |
| 219 |
|
| 220 |
As an example, the 'configure.ac' file for a hypothetical program |
| 221 |
'utils/foo' using 'libpng', and hence 'zlib', would contain |
| 222 |
KPSE_ZLIB_FLAGS |
| 223 |
KPSE_LIBPNG_FLAGS |
| 224 |
|
| 225 |
and its 'Makefile.am' would be along these lines: |
| 226 |
bin_PROGRAMS = foo |
| 227 |
AM_CPPFLAGS = ${LIBPNG_INCLUDES} ${ZLIB_INCLUDES} |
| 228 |
foo_LDADD = ${LIBPNG_LIBS} ${ZLIB_LIBS} |
| 229 |
foo_DEPENDENCIES = ${ZLIB_DEPEND} ${LIBPNG_DEPEND} |
| 230 |
## Rebuild libz |
| 231 |
@ZLIB_RULE@ |
| 232 |
## Rebuild libpng |
| 233 |
@LIBPNG_RULE@ |
| 234 |
|
| 235 |
If it were necessary to examine whether certain 'zlib' or 'libpng' |
| 236 |
features were available, 'configure.ac' should be continued this way: |
| 237 |
KPSE_ADD_FLAGS([zlib]) |
| 238 |
... # tests for 'zlib' features, if any |
| 239 |
KPSE_ADD_FLAGS([libpng]) |
| 240 |
... # tests for 'libpng' features |
| 241 |
KPSE_RESTORE_FLAGS # restore 'CPPFLAGS' and 'LIBS' |
| 242 |
|
| 243 |
6.3.6 Macros for Windows |
| 244 |
------------------------ |
| 245 |
|
| 246 |
Windows differs in several aspects from Unix-like systems, many of them |
| 247 |
due to the lack of symbolic links. |
| 248 |
|
| 249 |
-- Macro: KPSE_CHECK_WIN32 |
| 250 |
Check if compiling for a Windows system. The result is either 'no' |
| 251 |
for Unix-like systems (including Cygwin), 'mingw32' for Windows |
| 252 |
with GCC, or 'native' for Windows with MSVC. The result is cached |
| 253 |
in the 'kpse_cv_have_win32' variable. |
| 254 |
|
| 255 |
-- Macro: KPSE_COND_WIN32 |
| 256 |
Call 'KPSE_CHECK_WIN32' and define the Automake conditional 'WIN32' |
| 257 |
('true' if the value of 'kpse_cv_have_win32' is not 'no'). |
| 258 |
|
| 259 |
-- Macro: KPSE_COND_MINGW32 |
| 260 |
Call 'KPSE_COND_WIN32' and define the Automake conditional |
| 261 |
'MINGW32' ('true' if the value of 'kpse_cv_have_win32' is |
| 262 |
'mingw32'). |
| 263 |
|
| 264 |
-- Macro: KPSE_COND_WIN32_WRAP |
| 265 |
Call 'KPSE_COND_WIN32' and define the Automake conditional |
| 266 |
'WIN32_WRAP' ('true' if the standard Windows wrapper |
| 267 |
('texk/texlive/windows_wrapper/runscript.exe') exists. This |
| 268 |
wrapper is used on Windows instead of symlinks for the "linked |
| 269 |
scripts" (see Linked scripts). |
| 270 |
|
| 271 |
-- Macro: KPSE_WIN32_CALL |
| 272 |
Call 'KPSE_COND_WIN32' and check whether the file |
| 273 |
'texk/texlive/windows_wrapper/callexe.c' exists; if it does, create |
| 274 |
a symlink in the build tree. Compiling 'callexe.c' with |
| 275 |
'-DEXEPROG='"FOO.exe"'' and installing 'callexe.exe' as 'BAR.exe' |
| 276 |
is used on Windows instead of a symlink 'BAR->FOO' for Unix-like |
| 277 |
systems. |
| 278 |
|
| 279 |
6.4 Library modules |
| 280 |
=================== |
| 281 |
|
| 282 |
Here we discuss some specifics for a few of the libraries in TL, both |
| 283 |
for the details themselves, and as a way of illuminating the general |
| 284 |
structure and variation. |
| 285 |
|
| 286 |
6.4.1 The 'png' library in 'libs/libpng' |
| 287 |
---------------------------------------- |
| 288 |
|
| 289 |
The "generic" 'png' library uses the source tree in the subdirectory |
| 290 |
'libpng-src/', with all modifications for TL recorded in 'TLpatches/*'. |
| 291 |
The 'configure.ac' fragment 'ac/withenable.ac' contains |
| 292 |
|
| 293 |
KPSE_WITH_LIB([libpng], [zlib]) |
| 294 |
|
| 295 |
to specify the module name and indicate the dependency on 'zlib'. A |
| 296 |
third literal argument ''tree'' would specify that the library from the |
| 297 |
TeX Live tree cannot be replaced by a system version. That not being |
| 298 |
the case here, a second fragment 'ac/libpng.ac' contains |
| 299 |
|
| 300 |
KPSE_TRY_LIB([libpng], |
| 301 |
[#include <png.h>], |
| 302 |
[png_structp png; png_voidp io; png_rw_ptr fn; |
| 303 |
png_set_read_fn(png, io, fn);]) |
| 304 |
|
| 305 |
thus providing the simple C code |
| 306 |
|
| 307 |
#include <png.h> |
| 308 |
int main () |
| 309 |
{ png_structp png; png_voidp io; png_rw_ptr fn; |
| 310 |
png_set_read_fn(png, io, fn); |
| 311 |
return 0; } |
| 312 |
|
| 313 |
which Autoconf uses to verify the usability of a system version with C |
| 314 |
code. The analogous macro 'KPSE_TRY_LIBXX' would check using C++. |
| 315 |
These fragments are included by the 'configure.ac' at the top level of |
| 316 |
TL ('Build/source/configure.ac'). |
| 317 |
|
| 318 |
For this library, like many other modules, a proxy build system for |
| 319 |
TL is used, consisting of our own 'configure.ac', 'Makefile.am', |
| 320 |
'include/Makefile.am'; the distributed build system is not used. |
| 321 |
(Consequently, a few generated files and auxiliary scripts are removed |
| 322 |
from the distributed source tree.) |
| 323 |
|
| 324 |
The public headers 'png.h', 'pngconf.h', and 'pnglibconf.h' are |
| 325 |
"installed" (as symlinks) under 'include/' in the build tree exactly as |
| 326 |
they are for a system version under, e.g., '/usr/include/'. |
| 327 |
|
| 328 |
The module is supplemented by the file 'm4/kpse-libpng-flags.m4' that |
| 329 |
defines the M4 macro 'KPSE_LIBPNG_FLAGS' used by all modules depending |
| 330 |
on this library in their 'configure.ac' to generate the 'make' variables |
| 331 |
'LIBPNG_INCLUDES' for use in 'CPPFLAGS', 'LIBPNG_LIBS' for use in |
| 332 |
'LDADD', 'LIBPNG_DEPEND' for use as dependencies, and 'LIBPNG_RULE' for |
| 333 |
the 'make' rules to rebuild the library. |
| 334 |
|
| 335 |
'm4/kpse-libpng-flags.m4' also supplies the configure option |
| 336 |
'--with-system-libpng', which then uses 'pkg-config' to determine the |
| 337 |
flags required for the system library. |
| 338 |
|
| 339 |
6.4.2 The 'zlib' library in 'libs/zlib' |
| 340 |
--------------------------------------- |
| 341 |
|
| 342 |
This generic library is very much analogous to 'libpng', but without the |
| 343 |
dependency on any other library. The file 'm4/kpse-zlib-flags.m4' |
| 344 |
supplies the configure option '--with-system-zlib', as well as |
| 345 |
'--with-zlib-includes' and '--with-zlib-libdir' to specify non-standard |
| 346 |
locations of the 'zlib' headers and/or library. |
| 347 |
|
| 348 |
6.4.3 The 'freetype' library in 'libs/freetype2' |
| 349 |
------------------------------------------------ |
| 350 |
|
| 351 |
This module uses a wrapper build system. In contrast to the proxy build |
| 352 |
described earlier, the wrapper build has an almost trivial |
| 353 |
'configure.ac' and a 'Makefile.am' which invokes the 'configure' and |
| 354 |
'make' in the distributed source, followed by 'make install' with the TL |
| 355 |
build tree as destination. In other words, this actually uses the build |
| 356 |
system provided by upstream (possibly patched). |
| 357 |
|
| 358 |
The flags required for the system library are obtained through |
| 359 |
'freetype-config'. |
| 360 |
|
| 361 |
6.4.4 The 'kpathsea' library in 'texk/kpathsea' |
| 362 |
----------------------------------------------- |
| 363 |
|
| 364 |
This is one of the TeX-specific libraries that are maintained as part of |
| 365 |
TeX Live (see (kpathsea)); the other is 'ptexenc'. These TeX libraries |
| 366 |
are Libtool libraries (static and/or shared) and are installed by 'make |
| 367 |
install' together with the programs. They are, however, not part of the |
| 368 |
TL DVD as distributed by TeX user groups, and have never been officially |
| 369 |
released for standalone use. |
| 370 |
|
| 371 |
It is possible, and probably useful for distro builds (see Distro |
| 372 |
builds), to specify the configure option '--with-system-kpathsea' in |
| 373 |
order to use a system version of the library. Programs outside the TL |
| 374 |
tree should use 'pkg-config' for the required flags. |
| 375 |
|
| 376 |
In addition to 'kpathsea/ac/withenable.ac' and |
| 377 |
'kpathsea/ac/kpathsea.ac' here there is a third fragment |
| 378 |
'kpathsea.ac/mktex.ac', included by both 'withenable.ac' and |
| 379 |
'configure.ac', which supplies configure options such as |
| 380 |
'--enable-mktextfm-default'. These determine the compile time default |
| 381 |
of whether or not to run 'mktextfm' (and similar) to generate a missing |
| 382 |
'.tfm' (or whatever) file. In any case, however, the command line |
| 383 |
options '-mktex=tfm' or '-no-mktex=tfm' for the TeX-like engines |
| 384 |
override this default. |
| 385 |
|
| 386 |
6.5 Program modules |
| 387 |
=================== |
| 388 |
|
| 389 |
As with libraries (see Library modules), here we discuss the details for |
| 390 |
a few of the programs in TL. |
| 391 |
|
| 392 |
6.5.1 The 't1utils' package in 'utils/t1utils' |
| 393 |
---------------------------------------------- |
| 394 |
|
| 395 |
Here we use the distributed source tree 't1utils-src' with modifications |
| 396 |
documented in 'TLpatches/*' and a proxy build system consisting of |
| 397 |
'configure.ac' and 'Makefile.am'. The fragment 'ac/withenable.ac' |
| 398 |
contains |
| 399 |
|
| 400 |
KPSE_ENABLE_PROG([t1utils]) |
| 401 |
|
| 402 |
specifying the module name without any dependencies, and supplies the |
| 403 |
configure option '--disable-t1utils'. |
| 404 |
|
| 405 |
6.5.2 The 'xindy' package in 'utils/xindy' |
| 406 |
------------------------------------------ |
| 407 |
|
| 408 |
This module uses the distributed source tree 'xindy-src/' with |
| 409 |
modifications documented in 'TLpatches/*', and a wrapper 'configure.ac' |
| 410 |
and 'Makefile.am' that descends into 'xindy-src'. |
| 411 |
|
| 412 |
The 'xindy' build requires a 'make' that supports a 'VPATH' build, |
| 413 |
can handle all needed targets, and does not refer to '${top_srcdir}' or |
| 414 |
'${top_builddir}'. The fragment 'xindy/ac/withenable.ac' contains |
| 415 |
|
| 416 |
KPSE_ENABLE_PROG([xindy], , [disable]) |
| 417 |
m4_include(kpse_TL[utils/xindy/ac/xindy.ac]) |
| 418 |
m4_include(kpse_TL[utils/xindy/ac/clisp.ac]) |
| 419 |
|
| 420 |
where 'disable' in the third argument indicates that 'xindy' is only |
| 421 |
built if explicitly enabled by the user with 'configure --enable-xindy' |
| 422 |
(the need for 'clisp' makes it too painful to enable by default). |
| 423 |
|
| 424 |
The additional fragments 'ac/xindy.ac' and 'ac/clisp.ac' specify more |
| 425 |
'configure' options to be seen at the top level, with 'ac/xindy.ac' also |
| 426 |
included by 'configure.ac'. |
| 427 |
|
| 428 |
6.5.3 The 'xdvik' package in 'texk/xdvik' |
| 429 |
----------------------------------------- |
| 430 |
|
| 431 |
This package is maintained as part of the TeX Live tree with sources in |
| 432 |
its own directory ('texk/xdvik/'). The fragment |
| 433 |
'xdvik/ac/withenable.ac' contains |
| 434 |
|
| 435 |
dnl extra_dirs = texk/xdvik/squeeze |
| 436 |
KPSE_ENABLE_PROG([xdvik], [kpathsea freetype2], [x]) |
| 437 |
m4_include(kpse_TL[texk/xdvik/ac/xdvik.ac]) |
| 438 |
|
| 439 |
thus specifying dependencies on the 'kpathsea', 'freetype', and X11 |
| 440 |
libraries. The M4 comment (following 'dnl') signals the subsidiary |
| 441 |
'squeeze/configure.ac'. This is needed because the main executable |
| 442 |
'xdvi-bin' (to be installed as, e.g., 'xdvi-xaw') is for the 'host' |
| 443 |
system whereas the auxiliary program 'squeeze/squeeze' has to run on the |
| 444 |
'build' system; in a cross compilation, these differ. |
| 445 |
|
| 446 |
The additional fragment 'ac/xdvik.ac' is also included by |
| 447 |
'configure.ac' and supplies the configure option '--with-xdvi-x-toolkit' |
| 448 |
also seen at the top level. |
| 449 |
|
| 450 |
6.5.4 The subdirectory 'utils/asymptote' |
| 451 |
---------------------------------------- |
| 452 |
|
| 453 |
This subdirectory contains the sources for 'asy' and 'xasy' but due to |
| 454 |
its complexity and prerequisites (e.g., OpenGL) it is not part of the TL |
| 455 |
build system. These programs must be built and installed independently, |
| 456 |
but are included on the TL DVD together with their support files. See |
| 457 |
<https://tug.org/texlive/build.html#asymptote>. |
| 458 |
|
| 459 |
6.6 Extending TeX Live |
| 460 |
====================== |
| 461 |
|
| 462 |
This section outlines the basic process for adding new packages to the |
| 463 |
TL build system. |
| 464 |
|
| 465 |
A new package directory 'foo' should be placed under |
| 466 |
'Build/source/texk/' if it uses Kpathsea (or another TeX-specific |
| 467 |
library), or under 'Build/source/utils' if it does not. |
| 468 |
|
| 469 |
The new directory should normally have the original sources, modified |
| 470 |
only with changes necessary for TL, in a subdirectory 'foo/foo-src'. |
| 471 |
The changes should be documented in 'foo/TLpatches/*', and also be |
| 472 |
submitted upstream whenever reasonable. In addition, 'foo/' will need |
| 473 |
the usual Automake build-related files ('configure.ac', 'Makefile.am', |
| 474 |
etc. Please maintain 'foo/ChangeLog' for all TL changes. |
| 475 |
|
| 476 |
It is also possible to add a package which is configured with |
| 477 |
Autoconf (or another 'make'-based system) and not Automake. The package |
| 478 |
must still support the standard 'make' variables and targets, and |
| 479 |
'VPATH' builds (see (automake)VPATH Builds). For Autoconf-only |
| 480 |
packages, it is probably not sensible to use a 'foo-src' subdirectory. |
| 481 |
|
| 482 |
6.6.1 Adding a new program module |
| 483 |
--------------------------------- |
| 484 |
|
| 485 |
A TeX-specific program module in a subdirectory 'texk/PROG' may use the |
| 486 |
TeX-specific libraries and is included by adding its name 'PROG' to the |
| 487 |
M4 list 'kpse_texk_pkgs' defined in 'm4/kpse-pkgs.m4'. |
| 488 |
|
| 489 |
A generic program module in a subdirectory 'utils/PROG' must not use |
| 490 |
the TeX-specific libraries, notably Kpathsea, and is included by adding |
| 491 |
its name 'PROG' to the M4 list 'kpse_utils_pkgs' in 'm4/kpse-pkgs.m4'. |
| 492 |
|
| 493 |
In either case, the subdirectory 'texk/PROG' or 'utils/PROG' must |
| 494 |
include a file 'ac/withenable.ac' which contains a call to the M4 macro |
| 495 |
'KPSE_ENABLE_PROG' defined in 'm4/kpse-setup.m4' with 'PROG' as the |
| 496 |
mandatory first argument and three optional arguments: |
| 497 |
|
| 498 |
1. a list of required libraries from the TL tree; |
| 499 |
|
| 500 |
2. a list of options: 'disable' if this module is not to be built |
| 501 |
without the configure option '--enable-PROG', 'native' if cross |
| 502 |
compilation is not possible, 'x' if the program requires X11 |
| 503 |
libraries; |
| 504 |
|
| 505 |
3. a comment added to the help text for the 'configure' option |
| 506 |
'--enable-PROG' or '--disable-PROG'. |
| 507 |
|
| 508 |
If the module requires specific 'configure' options to be seen at the |
| 509 |
top level, they should be defined in an additional fragment 'ac/PROG.ac' |
| 510 |
included from 'ac/withenable.ac' and 'configure.ac'. |
| 511 |
|
| 512 |
Usually, the new program is maintained somewhere outside of TeX Live. |
| 513 |
In that case, as above, we put the upstream sources into a subdirectory |
| 514 |
'PROG-src' (e.g., 'utils/newprog/newprog-src'). We do not typically run |
| 515 |
'configure' in this original '...-src' directory, but only in our own |
| 516 |
directory; but we do compile using the source files in '...-src'. |
| 517 |
|
| 518 |
So, to summarize the files that must (usually) be created inside a |
| 519 |
new TL source directory ('texk/newprog' or 'utils/newprog'): |
| 520 |
|
| 521 |
'ac/withenable.ac' |
| 522 |
The 'KPSE_ENABLE_PROG' call just explained. |
| 523 |
|
| 524 |
'configure.ac' |
| 525 |
'Makefile.am' |
| 526 |
By merging the contents of the original 'configure.ac' (if |
| 527 |
provided) and a comparable program already in TL. In the above |
| 528 |
example, one line that will be needed in 'configure.ac' (can be |
| 529 |
added before the 'AC_CONFIG_FILES' at the end) is: |
| 530 |
|
| 531 |
AC_SUBST([NEWPROG_TREE], [newprog-src]) |
| 532 |
|
| 533 |
and then use '@NEWPROG_TREE@' in 'Makefile.am' where needed. |
| 534 |
|
| 535 |
In general, there is no magic recipe for this part of the job. |
| 536 |
It's necessary to think about what needs to be done in the original |
| 537 |
vs. in TeX Live. It's useful to look at the setup for the most |
| 538 |
comparable programs already in TL that you can find. It's also |
| 539 |
useful to grep the entire 'Build/source' tree for whatever you can |
| 540 |
think of to investigate how something is done. Most of the |
| 541 |
TL-specific macros are defined in 'Build/source/m4/*'. |
| 542 |
|
| 543 |
'TLpatches/TL-Changes' |
| 544 |
First actions taken after getting the original source tree; |
| 545 |
typically removal of derived or unused common files. |
| 546 |
|
| 547 |
'TLpatches/patch-...' |
| 548 |
If any changes are needed to the original sources, record the |
| 549 |
patches here so they can be applied next time. Also, send them |
| 550 |
upstream so that we don't have to maintain them forever. |
| 551 |
|
| 552 |
'ChangeLog' |
| 553 |
Record all TL-specific changes, now and in the future. |
| 554 |
|
| 555 |
After populating the new TL source directory ('.../newprog/', in the |
| 556 |
above), run GNU 'autoreconf' there (see Build system tools). Once that |
| 557 |
works, if you are the one who's eventually going to commit the new |
| 558 |
package, 'svn add' the necessary files, including the generated |
| 559 |
'Makefile.in aclocal.m4 configure', and 'svn:ignore' the Automake cache |
| 560 |
'autom4te.cache'. (This is so people checking out the TL source tree do |
| 561 |
not have to run any autotools, but can simply run 'configure'.) |
| 562 |
|
| 563 |
To reiterate: do not fail to commit the generated 'configure' and |
| 564 |
other files. The m4 code in 'kpse-pkgs.m4' uses the existence of |
| 565 |
'configure' to determine whether to descend into (and configure) a given |
| 566 |
subdirectory. |
| 567 |
|
| 568 |
Then, run the TL tool 'reautoconf' in the top-level TL |
| 569 |
'Build/source/' directory, to incorporate the new program into the build |
| 570 |
tree. It is good to then rebuild the whole tree (e.g., using TL's |
| 571 |
'Build/Build' script) to get all the necessary files generated. |
| 572 |
|
| 573 |
It will probably fail. So then you need to keep at it until the |
| 574 |
program compiles and tests successfully. The most efficient way is to |
| 575 |
rerun 'autoreconf' as needed in the new source directory |
| 576 |
('Build/source/.../newprog'), then 'make' in the corresponding build |
| 577 |
directory ('Build/work/.../newprog'), then 'make check', etc. In the |
| 578 |
end, also make sure that the whole tree builds from scratch. |
| 579 |
|
| 580 |
After final success, don't forget to commit. (Or email the TL |
| 581 |
maintainers with the patch.) |
| 582 |
|
| 583 |
6.6.2 Adding a new engine |
| 584 |
------------------------- |
| 585 |
|
| 586 |
Adding a new TeX engine is not completely different from adding a |
| 587 |
program, but it's not all that similar, either. In this case, the main |
| 588 |
work is done by creating a new subdirectory of 'texk/web2c/' for the |
| 589 |
engine. The subdirectory is conventionally named ending in 'dir', like |
| 590 |
'pdftexdir' and 'xetexdir', to avoid clashes with executable names. |
| 591 |
|
| 592 |
The source files for the new engine should be put in this |
| 593 |
'NEWENGINEdir' subdirectory. Also, a file |
| 594 |
'NEWENGINEdir/am/NEWENGINE.am' (e.g., 'pdftexdir/am/pdftex.am' is needed |
| 595 |
with the Makefile fragment needed to build it. |
| 596 |
|
| 597 |
The overall 'web2c/Makefile.am' needs to have an 'include' statement |
| 598 |
added to insert that 'NEWENGINE.am' file. |
| 599 |
|
| 600 |
In 'web2c/ac/web2c.ac', a line needs to be added in the definition of |
| 601 |
the 'kpse_tex_progs' variable to include it in the build. That line |
| 602 |
specifies whether the new engine is built by default, and the additional |
| 603 |
libraries requires. |
| 604 |
|
| 605 |
For examples of building engines in CWEB, you can check the existing |
| 606 |
'hitexdir' and 'mplibdir' directories; these are somewhat simpler than |
| 607 |
LuaTeX. Of course, every engine will have its own unique features and |
| 608 |
requirements, so existing examples will only take you so far. |
| 609 |
|
| 610 |
Web2c is built as one "package", with each subdirectory's '.am' |
| 611 |
fragment inserted with an Automake 'include'. This means that, for |
| 612 |
instance, '$(srcdir)' is '.../web2c', not '.../webdir/enginedir'. It is |
| 613 |
a difficult setup to come to terms with, but the alternative is to |
| 614 |
recurse into each engine subdirectory, and that would be far worse (see |
| 615 |
(automake)Directories). |
| 616 |
|
| 617 |
6.6.3 Adding a new generic library module |
| 618 |
----------------------------------------- |
| 619 |
|
| 620 |
A generic library module in a subdirectory 'libs/LIB' must not depend on |
| 621 |
TeX-specific libraries, by definition. It is included by adding its |
| 622 |
name 'LIB' to the M4 macro 'kpse_libs_pkgs' in 'm4/kpse-pkgs.m4'--before |
| 623 |
any other libraries from the TeX Live tree on which it depends. |
| 624 |
|
| 625 |
As with program modules, the subdirectory 'libs/LIB' must contain the |
| 626 |
sources and build system for the library (and any installable support |
| 627 |
programs) and a fragment 'ac/withenable.ac' that contains the M4 macro |
| 628 |
'KPSE_WITH_LIB' defined in 'm4/kpse-setup.m4' with 'LIB' as the |
| 629 |
mandatory first argument and two optional arguments: a list of required |
| 630 |
libraries from the TL tree, and a list of options: for libraries, |
| 631 |
currently there is only one--specify 'tree' if this library cannot be |
| 632 |
replaced by a system version. |
| 633 |
|
| 634 |
If a system version can be used, a second fragment 'ac/LIB.ac' is |
| 635 |
needed, containing the M4 macro 'KPSE_TRY_LIB' (or 'KPSE_TRY_LIBXX') |
| 636 |
with 'LIB' as the mandatory first argument and two additional arguments |
| 637 |
for the Autoconf macro 'AC_LANG_PROGRAM' used to compile and link a |
| 638 |
small C (or C++) program as sanity check for using the system library. |
| 639 |
|
| 640 |
In addition a file 'm4/kpse-LIB-flags' (at the top level) must define |
| 641 |
the M4 macro 'KPSE_LIB_FLAGS' (all uppercase) setting up the 'make' |
| 642 |
variables 'LIB_INCLUDES', 'LIB_LIBS', 'LIB_DEPEND', and 'LIB_RULE' with |
| 643 |
the values required for 'CPPFLAGS', 'LDADD', dependencies, and a |
| 644 |
(multi-line) 'make' rule to rebuild the library when necessary. All of |
| 645 |
that is needed for the library from the TL tree and, if supported, for a |
| 646 |
system version. |
| 647 |
|
| 648 |
If a system library is allowed, 'KPSE_LIB_FLAGS' also provides the |
| 649 |
configure option '--with-system-LIB' and uses the additional M4 macro |
| 650 |
'KPSE_LIB_SYSTEM_FLAGS' to generate the 'make' variables for a system |
| 651 |
library. In addition, the definition of the M4 macro |
| 652 |
'KPSE_ALL_SYSTEM_FLAGS' in 'm4/kpse-pkgs.m4' must be extended by the |
| 653 |
line: |
| 654 |
'AC_REQUIRE([KPSE_LIB_SYSTEM_FLAGS])' |
| 655 |
|
| 656 |
6.6.4 Adding a new TeX-specific library module |
| 657 |
---------------------------------------------- |
| 658 |
|
| 659 |
A TeX-specific library module in a subdirectory 'texk/LIB' may depend on |
| 660 |
other TeX-specific libraries but must not depend on any generic library |
| 661 |
from the TL tree. It is included in the same general ways as a generic |
| 662 |
library (see the previous section), with these modifications: |
| 663 |
|
| 664 |
* The library name 'LIB' is added to the M4 macro |
| 665 |
'kpse_texlibs_pkgs', which is also in 'm4/kpse-pkgs.m4'. |
| 666 |
|
| 667 |
* The fragment 'ac/withenable.ac' must use 'KPSE_WITH_TEXLIB'. |
| 668 |
|