Skip to content

Commit

Permalink
Migrate vendored TeX distro to use an archive based on TinyTeX
Browse files Browse the repository at this point in the history
This means a much bigger (although still pretty lightweight, at
~100 MB *extracted*) is distributed, including utilities such as
tlmgr, which will be necessary to include package management in
both tecomp and texedit.
  • Loading branch information
kosude committed Jun 12, 2024
1 parent 09c8081 commit 5eff80a
Show file tree
Hide file tree
Showing 96 changed files with 250 additions and 8,098 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ tmp/
*.log
*.aux
*.pdf
*.toc
*.out

.DS_STORE

Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ $(BUILD_DIR):


#
# Copy TexLive distribution
# Extract Tex distribution to build dir
#

TEXLIVE_SRC := $(SRC_DIR)/vendor/tex
TEXLIVE_DST := $(BUILD_DIR)/engine
TEXDIST_SRC := $(SRC_DIR)/vendor/tex/tex.tar.xz
TEXDIST_DST := $(BUILD_DIR)/engine
TEXDIST_UNPACK := $(SRC_DIR)/vendor/tex/unpack.sh

$(TEXLIVE_DST): $(TEXLIVE_SRC)
mkdir -p $(TEXLIVE_DST)
cp -r $(TEXLIVE_SRC)/* $(TEXLIVE_DST)
$(TEXDIST_DST): $(TEXDIST_SRC)
mkdir -p $(TEXDIST_DST)
$(TEXDIST_UNPACK) $(TEXDIST_DST)


#
Expand All @@ -90,7 +91,7 @@ $(BUILD_DIR)/texpdfc.sh: $(SRC_DIR)/tecomp/texpdfc.sh | $(BUILD_DIR)

COMPILER_TOML := $(SRC_DIR)/tecomp/Cargo.toml

tecomp: $(COMPILER_TOML) $(TEXLIVE_DST) $(BUILD_DIR)/texpdfc.sh | validate_cargo
tecomp: $(COMPILER_TOML) $(TEXDIST_DST) $(BUILD_DIR)/texpdfc.sh | validate_cargo
$(CARGO) $(CARGOCHAN) build $(CARGOFLAGS) --manifest-path=$(COMPILER_TOML) --target-dir=$(BUILD_DIR)/_$@ --out-dir=$(BUILD_DIR)


Expand Down
1 change: 0 additions & 1 deletion examples/Fail.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
%%hello.tex
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
Expand Down
37 changes: 20 additions & 17 deletions examples/HelloWorld.tex
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
%%hello.tex
\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{subfiles}

\begin{document}

\title{How to Structure a LaTeX Document}
\author{Someone}
\date{\today}
\maketitle
\title{How to Structure a LaTeX Document}
\author{Someone}
\date{\today}
\maketitle

\begin{abstract}
Your abstract goes here...
\end{abstract}
\begin{abstract}
Your abstract goes here...
\end{abstract}

\section{Structure}
This section's content...
\section{Structure}
This section's content...

\subsection{Top Matter}
This subsection's content...
\subsection{Top Matter}
This subsection's content...

\subsubsection{Article Information}
This subsubsection's content...
\subsubsection{Article Information}
This subsubsection's content...

\emph{hello} hello $x^2, \mathbb R, \mathcal C, \mathfrak F, \int_0^1 \sin(x) \mathrm d x$
\emph{hello} hello $x^2, \mathbb R, \mathcal C, \mathfrak F, \int_0^1 \sin(x) \mathrm d x$

\pagebreak
\bigskip

This content is on a separate page.
% subfile directives are relative to the CWD, so this assumes tecomp is being executed from the project root:
\subfile{examples/HelloWorldSubfile.tex}

\end{document}
1 change: 1 addition & 0 deletions examples/HelloWorldSubfile.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\textbf{This line was typeset from another TeX document!}
6 changes: 3 additions & 3 deletions tecomp/texpdfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ outdir=$(realpath $3)

base_dir="$(realpath "${0%/*}")"
texlive_base_dir="$(realpath "$base_dir/engine")"
texlive_os_dir="$(realpath "$texlive_base_dir/os/$arch")"
pdflatex_bin="$texlive_os_dir/bin/pdflatex"
texlive_bin_dir="$(realpath "$texlive_base_dir/bin/$arch")"
pdflatex_bin="$texlive_bin_dir/pdflatex"

cd $texlive_base_dir
source env_$arch.sh
source env_$arch.sh $texlive_base_dir

cmd="$pdflatex_bin -interaction=nonstopmode -file-line-error -output-directory=$outdir $filename"

Expand Down
45 changes: 45 additions & 0 deletions vendor/tex/LICENSE.CTAN
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$Id: LICENSE.CTAN 2212 2006-09-28 16:31:42Z karl $

COPYING CONDITIONS FOR CTAN SNAPSHOT:

A snapshot of the Comprehensive TeX Archive Network (CTAN) holdings is
taken from time to time and distributed on physical media. It may be
bundled with the TeX Live system, or distributed separately.

In any case, the licensing conditions of the packages in the CTAN
snapshot vary widely. In particular (and in contrast to TeX Live), not
all the software meets free software or open source criteria: some are
available only as binaries, others have restrictions on commercial
resale, and so on.

Furthermore, the creators of the CTAN snapshot have explicitly received
permission from some authors of software to include their material; this
software is in the ctan/nonfree/ subdirectory. (The nonfree area on the
CTAN servers, http://www.ctan.org/tex-archive/nonfree, contains much
more software that is not included here.) This permission does not
extend to any redistributors; you yourself must also contact such
authors with regards to your own distribution, or refrain from including
such software.

Thus, when redistributing the CTAN snapshot, you must be very careful
that you are not violating any license conditions. Since each situation
is different, we cannot offer any general advice.

To learn redistribution requirements, of course the licensing
information within the packages themselves is the final authority. For
aggregate information, we suggest checking the TeX Catalogue:
http://www.ctan.org/tex-archive/help/Catalogue/catalogue.html (or any
CTAN mirror). The Catalogue is also included in the CTAN snapshot in
ctan/help/Catalogue, but the online version will have updates.

You may also find the CTAN Search by License page helpful in this
regard: http://tug.ctan.org/cgi-bin/searchByLicense.py

If you believe any files have been included erroneously, please contact
us (references are given below).

If you have any questions or comments, please contact us.
Thanks for your interest in TeX.

CTAN maintainers mailing list: ctan@dante.de
CTAN home page: http://www.ctan.org/
112 changes: 112 additions & 0 deletions vendor/tex/LICENSE.TL
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
$Id: LICENSE.TL 70641 2024-03-14 22:48:58Z karl $

COPYING CONDITIONS FOR TeX Live:

To the best of our knowledge, all software in the TeX Live distribution
is freely redistributable (libre, that is, not necessarily gratis),
within the Free Software Foundation's definition and the Debian Free
Software Guidelines. Where the two conflict, we generally follow the
FSF. If you find any non-free files included, please contact us
(references given at the end).

That said, TeX Live has neither a single copyright holder nor a single
license covering its entire contents, since it is a collection of many
independent packages. Therefore, you may copy, modify, and/or
redistribute software from TeX Live only if you comply with the
requirements placed thereon by the owners of the respective packages.

To most easily learn these requirements, we suggest checking the TeX
Catalogue at: https://ctan.org/pkg. As always, the legal statements
within the packages themselves are the final authority.

In some cases, TeX Live is distributed with a snapshot of the CTAN
archive, which is entirely independent of and separable from TeX Live
itself. Please be aware that the CTAN snapshot contains many files which
are *not* freely redistributable; see LICENSE.CTAN for more information.

To state explicitly what is implied by the above: Because TeX Live is
free software, there is no warranty; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.


GUIDELINES FOR REDISTRIBUTION:

In general, you may redistribute TeX Live, with or without modification,
for profit or not, according to the usual free software tenets. Here
are some general guidelines for doing so:

- If you make any changes to the TeX Live distribution or any
package it contains, besides complying with any licensing requirements,
you must prominently mention such changes in your modified distribution
so that users do not take your work for ours, and know to contact you,
not us, in case of questions or problems. A new top-level file
README.<yourwork> is a good place to describe the general situation.

- Especially (but not necessarily) if changes or additions are made, we
recommend a clearly different title, such as "<your work> DVD, based on
TeX Live YYYY", where YYYY is the release year of TeX Live you are
using. This credits both our work and yours.

- You absolutely may *not* place your own copyright on the entire
distribution, since it is not your work. Statements such as "all rights
reserved" and "may not be reproduced" are especially reprehensible,
since they are antithetical to the free software principles under which
TeX Live is produced.

- You may use any cover or media label designs that you wish. Such
packaging and marketing details are not covered by any TeX Live license.

- Finally, we make the following requests (not legal requirements):

a) Acknowledging that TeX Live is developed as a joint effort by all TeX
user groups, and encouraging the user/reader to join their user group
of choice, as listed on this web page: https://tug.org/usergroups.html

b) Referencing the TeX Live home page: https://tug.org/texlive/

Such information may be placed on the label of your media, your cover,
and/or in accompanying text (for instance, in the acknowledgements
section of a book).

Finally, although it is again not a requirement, we'd like to invite any
redistributors to make a donation, whether cash or in-kind, for example
via https://tug.org/donate. Thanks.


If you have any questions or comments, *please* contact us. In general,
we appreciate being given the chance to review any TeX Live-related
material in advance of publication, simply to avoid mistakes. It is
much better to correct text on a CD label or in a book before thousands
of copies are made!

We are also happy to keep anyone planning a publication informed as to
our deadlines and progress. Just let us know. However, be aware that
TeX Live is produced entirely by volunteers, and no dates can be
guaranteed.


LICENSING FOR NEW PACKAGES:

Finally, we have been asked what license to use for new work. To be
considered for inclusion on TeX Live, a package must use a free software
license, such as the LaTeX Project Public License, the GNU General
Public License, the modified BSD license, etc. (Please use an existing
license instead of making up your own.) Furthermore, all sources must
be available, including for documentation files. Please see
https://tug.org/texlive/pkgcontrib.html for more information, and other
considerations.

Thanks for your interest in TeX and friends.

- Karl Berry, for the TeX Live project

------------------------------------------------------------
TeX Live mailing list: https://lists.tug.org/tex-live
TeX Live home page: https://tug.org/texlive/

The FSF's free software definition: https://gnu.org/philosophy/free-sw.html
Debian Free Software Guidelines: https://debian.org/intro/free
FSF commentary on existing licenses: https://gnu.org/licenses/license-list.html

LPPL: https://latex-project.org/lppl.html
LPPL rationale: https://latex-project.org/help/documentation/modguide.pdf
18 changes: 0 additions & 18 deletions vendor/tex/README

This file was deleted.

13 changes: 13 additions & 0 deletions vendor/tex/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This directory contains an archive containing a lightweight TeX distribution largely based on TinyTeX:
https://yihui.org/tinytex/

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

Execute the `unpack.sh` script to extract it into the `build/` directory in the project root, in order to be distributed as-is.

When re-building the archive, use the following command while inside the distributable folder:
tar -cvJf tex.tar.xz *

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

The `tex.tar.xz` archive was last updated on 2024-06-12.
2 changes: 0 additions & 2 deletions vendor/tex/env_darwin.sh

This file was deleted.

4 changes: 0 additions & 4 deletions vendor/tex/env_linux.sh

This file was deleted.

Binary file removed vendor/tex/os/darwin/bin/pdflatex
Binary file not shown.
Loading

0 comments on commit 5eff80a

Please sign in to comment.