blob: 83c0613998172f0ac9645ab7b5977519014efd93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
packager='Aditya Mahajan <adityam at umich dot edu>'
pkgname=luametatex
pkgver=2023.05.05
pkgrel=1
pkgdesc="ConTeXt LuaMetaTeX distribution"
url="http://www.contextgarden.net"
license=('GPL')
arch=('i686' 'x86_64')
optdepends=('ghostscript: support for PS and EPS images'
'graphicsmagick: support for GIF and TIFF images'
'inkscape: support for SVG images'
'pstoedit: support for metapost outlines for fonts'
'zint: support for barcodes'
'curl: loading remote content')
makedepends=('rsync' 'curl')
conflicts=()
replaces=()
backup=()
install=luametatex.install
PKGEXT=".pkg.tar.gz"
options=(!strip)
# ConTeXt minimals uses a different naming convention for architectures
declare -A _platform_map
_platform_map['i686']='linux-32'
_platform_map['x86_64']='linux-64'
_platform=${_platform_map[$CARCH]}
_lmtxserver=lmtx.pragma-ade.nl
_lmtxserverlist=lmtx.contextgarden.net,lmtx.pragma-ade.com,lmtx.pragma-ade.nl
_zipfile=context-${_platform}.zip
source=("http://${_lmtxserver}/install-lmtx/${_zipfile}")
md5sums=('SKIP')
# Manually add the modules that you want to download here
modules=(
"https://mirrors.ctan.org/macros/context/contrib/context-filter.zip"
"https://mirrors.ctan.org/macros/context/contrib/context-vim.zip"
"https://mirrors.ctan.org/macros/context/contrib/context-visualcounter.zip"
)
module_names=("${modules[@]##*/}")
module_count=${#modules[@]}
_dest=/opt/luametatex
# Font directories
_texlivefontdir="/usr/share/texmf-dist/fonts/"
_contextmodulesdir="/opt/context-minimals/texmf-modules"
_userfontdir="\$HOME/.fonts"
_osfontdir="/usr/share/fonts"
pkgver() {
cd "$scrdir"
grep -e '\\edef\\contextversion' tex/texmf-context/tex/context/base/mkxl/context.mkxl | sed -n 's/.*{\(.*\) .*}/\1/p'
}
prepare() {
OLDPATH=$PATH
PATH=$scrdir/bin:$scrdir/tex/texmf-${_platform}/bin:$PATH
msg "Starting download or update of ConTeXt distribution"
chmod +x $srcdir/bin/mtxrun
$srcdir/bin/mtxrun --script $srcdir/bin/mtx-install.lua --update \
--server="${_lmtxserverlist}" \
--instance="install-lmtx" --erase \
|| return 1
PATH=$OLDPATH
# Make sure the binaries are executable
chmod +x $srcdir/tex/texmf-${_platform}/bin/{context,luametatex,mtxrun}
# Copy mtxrun for next install
cp $srcdir/tex/texmf-${_platform}/bin/mtxrun $srcdir/bin
cp $srcdir/tex/texmf-context/scripts/context/lua/{mtxrun.lua,mtx-install.lua} $srcdir/bin
# PKGBUILD doesn't seem to support brace expansion
declare -i count=0
while [ $count -lt $module_count ]
do
wget -O $srcdir/${module_names[$count]} ${modules[$count]}
unzip -o -d $srcdir/tex/texmf-modules $srcdir/${module_names[$count]}
count+=1
done
OLDPATH=$PATH
PATH=$scrdir/tex/texmf-${_platform}/bin:$PATH
cd $srcdir/tex && texmf-${_platform}/bin/mtxrun --script texmf-context/scripts/context/lua/mtx-install-tikz.lua
PATH=$OLDPATH
# Generate a setuptex file
mkdir -p $srcdir/tex
cat <<- _EOF_ > $srcdir/tex/setuptex
_OLD_PATH=\$PATH
_OLD_CONTEXTDIST=$CONTEXTDIST
TEXMFOS=${_dest}/texmf-${_platform}
export TEXMFOS
TEXMFCACHE=\$HOME/.cache/luametatex
export TEXMFCACHE
CONTEXTDIST="lmtx"
export CONTEXTDIST
PATH=\$TEXMFOS/bin:\$PATH
export PATH
OSFONTDIR="$_userfontdir;$_osfontdir;"
export OSFONTDIR
resettex () {
PATH=\$_OLD_PATH
export PATH
unset _OLD_PATH
CONTEXTDIST=$_OLD_CONTEXTDIST
export CONTEXTDIST
unset _OLD_CONTEXTDIST
unset -f resettex
}
_EOF_
# If texlive exists, use fonts from texlive
if [ -d $_texlivefontdir ]
then
mkdir -p $srcdir/tex/texmf-fonts
if [ -L $srcdir/tex/texmf-fonts/fonts ]
then
rm $srcdir/tex/texmf-fonts/fonts
fi
ln -s $_texlivefontdir $srcdir/tex/texmf-fonts/fonts
fi
}
package()
{
install -d $pkgdir/opt || return 1
msg "Copying files"
# cp -r does not delete old files that are present in texmf-cache from
# previous installation
# cp -r --preserve=links $srcdir/tex $pkgdir/$_dest || return 1
rsync -az --links --delete --info=progress2 $srcdir/tex/ $pkgdir/$_dest || return 1
}
|