求助: 在 macOS 下编译 dvisvgm

我之前也编译过这个,感觉确实不太好编译。

这是我基于这个Build dvisvgm and kpathsea on macOS · GitHub 改的脚本,应该能直接在新版arm64安装

#!/bin/bash
set -xeuo pipefail
IFS=$'\n\t'

PREFIX="${1:-/usr/local/dvisvgm}"
TEX="$(kpsewhich -var-value SELFAUTOLOC)"

echo "$PREFIX, $TEX"

brew install automake freetype ghostscript potrace autoconf-archieve brotli woff2


# download the sources
mkdir -p "$PREFIX/source/texk"
cd "$PREFIX/source/"

# see https://www.tug.org/texlive/svn/
rsync -av --exclude=.svn tug.org::tldevsrc/Build/source/build-aux .
rsync -av --exclude=.svn tug.org::tldevsrc/Build/source/texk/kpathsea texk/

git clone https://github.com/mgieseki/dvisvgm.git

#compile kpathsea
cd texk/kpathsea

# patch SELFAUTOLOC
perl -0777 -i.bak \
    -pe 's|(kpathsea_selfdir \(kpathsea kpse, const_string argv0\)\n\{)|$1\n  return xstrdup("'"$TEX"'");\n|g' \
    progname.c
./configure --prefix="$PREFIX/"

make -j10
make install

# compile dvisvgm
cd ../../dvisvgm

#autoreconf -fi
CPPFLAGS="-I$PREFIX/include/ `pkg-config --cflags-only-I openssl`" \
    LDFLAGS="-L$PREFIX/lib/ `pkg-config --libs-only-L freetype2`" ./configure --prefix="$PREFIX/"


make -j10
make check
make install

把上面这个保存成build_dvisgm.sh,然后执行 bash build_dvisgm.sh [安装的绝对路径]

上述安装的版本应该是3.0.2

1 个赞