Sync with upstream
[llpp.git] / misc / getmupdf.sh
blob9cfbe85c5b0fdc2667ccccad527ae797f53980aa
1 #!/bin/sh
2 set -eu
4 MUPDF_OUTPUT_DIR="$1"
5 MUPDF_URL="https://github.com/ArtifexSoftware/mupdf"
6 MUPDF_DESIRED_VERSION="1512d2156c5e0446ab590fc09fa41274faf244d6"
8 if [ ! -d ${MUPDF_OUTPUT_DIR} ]; then
9 echo "mupdf does not exist, fetching it from ${MUPDF_URL}"
10 git clone ${cloneargs-} ${MUPDF_URL} --recursive ${MUPDF_OUTPUT_DIR}
13 cd ${MUPDF_OUTPUT_DIR}
14 git remote update
15 MUPDF_VERSION=$(git rev-parse HEAD)
17 test "${MUPDF_VERSION}" = "${MUPDF_DESIRED_VERSION}" || {
18 printf "mupdf current version is ${MUPDF_VERSION} "
19 echo "switching to ${MUPDF_DESIRED_VERSION}"
20 git reset --hard ${MUPDF_DESIRED_VERSION}
21 git submodule update --init --recursive