#!/usr/bin/env bash # Copyright (c) the JPEG XL Project Authors. All rights reserved. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. # Tool to create the reference software .zip package with its required # dependencies bundled. set -eu MYDIR=$(dirname $(realpath "$0")) # Temporary files cleanup hooks. CLEANUP_FILES=() cleanup() { if [[ ${#CLEANUP_FILES[@]} -ne 0 ]]; then rm -fr "${CLEANUP_FILES[@]}" fi } trap 'retcode=$?; { set +x; } 2>/dev/null; cleanup' INT TERM EXIT main() { # Run from the repo's top level directory. cd "${MYDIR[@]}/.." local deps=( third_party/brotli third_party/highway third_party/skcms ) local ref_files=($(git ls-files)) for dep in "${deps[@]}"; do local dep_files=($(git -C "${dep}" ls-files)) for dep_file in "${dep_files[@]}"; do ref_files+=("${dep}/${dep_file}") done done echo "Packaging ${#ref_files[@]} files..." >&2 local dest_zip="reference_package.zip" rm -f "${dest_zip}" printf '%s\n' "${ref_files[@]}" | zip -q -@ "${dest_zip}" if [[ "${1:-}" == "test" ]]; then echo "Testing on docker..." >&2 set -x sudo docker run --rm -v "$(realpath ${dest_zip}):/home/pkg.zip:ro" \ ubuntu:20.04 <