Skip to content

Commit 1d0ca70

Browse files
puneetsharma21jiridanek
authored andcommitted
Split PDF build into separate TeX Live and Pandoc scripts
Signed-off-by: puneetsharma21 <[email protected]>
1 parent f165e91 commit 1d0ca70

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

jupyter/utils/install_pandoc.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
ARCH=$(uname -m)
5+
6+
if [[ "$ARCH" == "ppc64le" ]]; then
7+
# Install Pandoc from source
8+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
9+
dnf install -y cabal-install ghc gmp-devel
10+
11+
# Set version
12+
PANDOC_VERSION=3.7.0.2
13+
14+
cd /tmp
15+
git clone --recurse-submodules https://github.com/jgm/pandoc.git
16+
cd pandoc
17+
git checkout ${PANDOC_VERSION}
18+
git submodule update --init --recursive
19+
20+
cabal update
21+
cd pandoc-cli
22+
cabal build -j$(nproc)
23+
cabal install --installdir=/usr/local --overwrite-policy=always --install-method=copy
24+
25+
# Clean up Haskell build system
26+
rm -rf ~/.cabal ~/.ghc /tmp/pandoc
27+
dnf remove -y cabal-install ghc gmp-devel
28+
dnf clean all && rm -rf /var/cache/dnf
29+
fi
30+
31+
if [[ "$ARCH" == "x86_64" ]]; then
32+
# pandoc installation
33+
curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz
34+
mkdir -p /usr/local/pandoc
35+
tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/
36+
rm -f /tmp/pandoc.tar.gz
37+
fi
38+
39+
/usr/local/pandoc --version

jupyter/utils/install_texlive.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
ARCH=$(uname -m)
5+
6+
if [[ "$ARCH" == "ppc64le" ]]; then
7+
echo "Installing TeX Live from source for $ARCH"
8+
9+
# Download and extract source
10+
wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz
11+
tar -xf texlive-20250308-source.tar.xz
12+
cd texlive-20250308-source
13+
14+
# Install build dependencies
15+
dnf install -y gcc-toolset-13 perl make libX11-devel libXt-devel \
16+
zlib-devel freetype-devel libpng-devel ncurses-devel \
17+
gd-devel libtool wget tar xz bison flex libXaw-devel
18+
19+
source /opt/rh/gcc-toolset-13/enable
20+
21+
# Create build directory
22+
mkdir ../texlive-build
23+
cd ../texlive-build
24+
25+
# Configure, build, install
26+
../texlive-20250308-source/configure --prefix=/usr/local/texlive
27+
make -j$(nproc)
28+
make install
29+
30+
# Symlink for pdflatex
31+
cd /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu
32+
ln -s pdftex pdflatex
33+
34+
# Cleanup TeX source to reduce image size
35+
rm -rf /texlive-20250308-source /texlive-build
36+
37+
export PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:$PATH"
38+
pdflatex --version
39+
fi
40+
41+
if [[ "$ARCH" == "x86_64" ]]; then
42+
# tex live installation
43+
echo "Installing TexLive to allow PDf export from Notebooks"
44+
curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz
45+
zcat < install-tl-unx.tar.gz | tar xf -
46+
cd install-tl-2*
47+
perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive
48+
cd /usr/local/texlive/bin/x86_64-linux
49+
./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended
50+
fi
51+

0 commit comments

Comments
 (0)