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 git.
12 MYDIR
=$
(dirname $
(realpath
"$0"))
14 # Git revisions we use for the given submodules. Update these whenever you
15 # update a git submodule.
16 TESTDATA
="873045a9c42ed60721756e26e2a6b32e17415205"
17 THIRD_PARTY_BROTLI
="36533a866ed1ca4b75cf049f4521e4ec5fe24727"
18 THIRD_PARTY_HIGHWAY
="58b52a717469e62b2d9b8eaa2f5dddb44d4a4cbf"
19 THIRD_PARTY_SKCMS
="42030a771244ba67f86b1c1c76a6493f873c5f91"
20 THIRD_PARTY_SJPEG
="e5ab13008bb214deb66d5f3e17ca2f8dbff150bf"
21 THIRD_PARTY_ZLIB
="51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf" # v1.3.1
22 THIRD_PARTY_LIBPNG
="f135775ad4e5d4408d2e12ffcc71bb36e6b48551" # v1.6.40
23 THIRD_PARTY_LIBJPEG_TURBO
="8ecba3647edb6dd940463fedf38ca33a8e2a73d1" # 2.1.5.1
25 # Download the target revision from GitHub.
30 local varname
=`echo "$path" | tr '[:lower:]' '[:upper:]'`
31 varname
="${varname//[\/-]/_}"
33 eval "sha=\${${varname}}"
35 local down_dir
="${MYDIR}/downloads"
36 local local_fn
="${down_dir}/${sha}.tar.gz"
37 if [[ -e "${local_fn}" && -d "${MYDIR}/${path}" ]]; then
38 echo "${path} already up to date." >&2
43 local strip_components
=0
44 if [[ "${project:0:4}" == "http" ]]; then
45 # "project" is a googlesource.com base url.
46 url
="${project}${sha}.tar.gz"
48 # GitHub files have a top-level directory
50 url
="https://github.com/${project}/tarball/${sha}"
53 echo "Downloading ${path} version ${sha}..." >&2
54 mkdir
-p "${down_dir}"
55 curl
-L --show-error -o "${local_fn}.tmp" "${url}"
56 mkdir
-p "${MYDIR}/${path}"
57 tar -zxf "${local_fn}.tmp" -C "${MYDIR}/${path}" \
58 --strip-components="${strip_components}"
59 mv "${local_fn}.tmp" "${local_fn}"
64 local toplevel
=$
(git rev-parse
--show-toplevel)
66 [[ "${dir}" == "${toplevel}" ]]
71 if is_git_repository
"${MYDIR}"; then
73 Current directory is a git repository, downloading dependencies via git:
75 git submodule update --init --recursive
78 git
-C "${MYDIR}" submodule update
--init --recursive --depth 1 --recommend-shallow
82 # Sources downloaded from a tarball.
83 download_github testdata libjxl
/testdata
84 download_github third_party
/brotli google
/brotli
85 download_github third_party
/highway google
/highway
86 download_github third_party
/sjpeg webmproject
/sjpeg
87 download_github third_party
/skcms \
88 "https://skia.googlesource.com/skcms/+archive/"
89 download_github third_party
/zlib madler
/zlib
90 download_github third_party
/libpng glennrp
/libpng
91 download_github third_party
/libjpeg-turbo libjpeg-turbo
/libjpeg-turbo