2 # Copyright (c) the JPEG XL Project Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file.
7 # This file downloads the dependencies needed to build JPEG XL into third_party.
8 # These dependencies are normally pulled by gtest.
12 MYDIR
=$
(dirname $
(realpath
"$0"))
14 # Git revisions we use for the given submodules. Update these whenever you
15 # update a git submodule.
16 THIRD_PARTY_BROTLI
="35ef5c554d888bef217d449346067de05e269b30"
17 THIRD_PARTY_HIGHWAY
="22e3d7276f4157d4a47586ba9fd91dd6303f441a"
18 THIRD_PARTY_SKCMS
="64374756e03700d649f897dbd98c95e78c30c7da"
19 THIRD_PARTY_SJPEG
="868ab558fad70fcbe8863ba4e85179eeb81cc840"
20 THIRD_PARTY_ZLIB
="cacf7f1d4e3d44d871b605da3b647f07d718623f"
21 THIRD_PARTY_LIBPNG
="a40189cf881e9f0db80511c382292a5604c3c3d1"
23 # Download the target revision from GitHub.
28 local varname
=`echo "$path" | tr '[:lower:]' '[:upper:]'`
29 varname
="${varname/\//_}"
31 eval "sha=\${${varname}}"
33 local down_dir
="${MYDIR}/downloads"
34 local local_fn
="${down_dir}/${sha}.tar.gz"
35 if [[ -e "${local_fn}" && -d "${MYDIR}/${path}" ]]; then
36 echo "${path} already up to date." >&2
41 local strip_components
=0
42 if [[ "${project:0:4}" == "http" ]]; then
43 # "project" is a googlesource.com base url.
44 url
="${project}${sha}.tar.gz"
46 # GitHub files have a top-level directory
48 url
="https://github.com/${project}/tarball/${sha}"
51 echo "Downloading ${path} version ${sha}..." >&2
52 mkdir
-p "${down_dir}"
53 curl
-L --show-error -o "${local_fn}.tmp" "${url}"
54 mkdir
-p "${MYDIR}/${path}"
55 tar -zxf "${local_fn}.tmp" -C "${MYDIR}/${path}" \
56 --strip-components="${strip_components}"
57 mv "${local_fn}.tmp" "${local_fn}"
62 if git
-C "${MYDIR}" rev-parse
; then
64 Current directory is a git repository, downloading dependencies via git:
66 git submodule update --init --recursive
69 git
-C "${MYDIR}" submodule update
--init --recursive --depth 1 --recommend-shallow
73 # Sources downloaded from a tarball.
74 download_github third_party
/brotli google
/brotli
75 download_github third_party
/highway google
/highway
76 download_github third_party
/sjpeg webmproject
/sjpeg
77 download_github third_party
/skcms \
78 "https://skia.googlesource.com/skcms/+archive/"
79 download_github third_party
/zlib madler
/zlib
80 download_github third_party
/libpng glennrp
/libpng