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 # Tool to create the reference software .zip package with its required
8 # dependencies bundled.
12 MYDIR=$(dirname $(realpath "$0"))
14 # Temporary files cleanup hooks.
17 if [[ ${#CLEANUP_FILES[@]} -ne 0 ]]; then
18 rm -fr "${CLEANUP_FILES[@]}"
21 trap 'retcode=$?; { set +x; } 2>/dev/null; cleanup' INT TERM EXIT
25 # Run from the repo's top level directory.
34 local ref_files=($(git ls-files))
35 for dep in "${deps[@]}"; do
36 local dep_files=($(git -C "${dep}" ls-files))
37 for dep_file in "${dep_files[@]}"; do
38 ref_files+=("${dep}/${dep_file}")
42 echo "Packaging ${#ref_files[@]} files..." >&2
43 local dest_zip="reference_package.zip"
45 printf '%s\n' "${ref_files[@]}" | zip -q -@ "${dest_zip}"
47 if [[ "${1:-}" == "test" ]]; then
48 echo "Testing on docker..." >&2
50 sudo docker run --rm -v "$(realpath ${dest_zip}):/home/pkg.zip:ro" \
55 DEBIAN_FRONTEND=noninteractive apt install -y build-essential zip cmake
61 cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_SJPEG=OFF ..
62 cmake --build . -- -j\$(nproc)
64 tools/djxl ../testdata/jxl/blending/cropped_traffic_light.jxl test.png
65 tools/cjxl ../testdata/jxl/flower/flower.png.im_q85_444.jpg test.jxl
66 tools/djxl test.jxl test.jpg
70 echo "${dest_zip} ready."