summaryrefslogtreecommitdiff
path: root/util/meson_aux/skeletonmm-tarball.sh
blob: ff50bc5b531deb00ddbf9cec026c215f1ef726ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh -e

# External command, intended to be called with custom_target() in meson.build

# skeletonmm-tarball.sh <source_dir> <output_file> <input_files...>

source_dir="$1"
output_file="$2"
shift; shift

# These options don't contain filenames, and thus no spaces that
# must be preserved in the call to tar.
tar_options="-chof -"

case "$output_file" in
  *.xz)
    ( cd "$source_dir"; tar $tar_options "$@" ) | xz --to-stdout --extreme >"$output_file"
    ;;
  *.gz)
    ( cd "$source_dir"; tar $tar_options "$@" ) | gzip --to-stdout --best --no-name >"$output_file"
    ;;
  *) echo "Error: Unknown filetype, $output_file"
     exit 1
     ;;
esac