summaryrefslogtreecommitdiff
path: root/configure
blob: b3e4624fa13c878c4fb7278674841f22a707e96b (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash

checking() {
  printf "checking %s... " "$1" >&2
}

check() {
  checking "for $1"
  var="${VAR:-${1^^}}"
  cmd="${!var}"
  : ${cmd:=${1}}
  shift
  varflags="${var}FLAGS"
  varflags="$@ ${!varflags}"
  get=$(command -v "${cmd}")
  e=$?
  if [[ -n "$get" ]]; then
    declare -g "$var=$get"
    echo ${get}
    if [[ -z "$NO_RUN" ]]; then
      checking "${get} usability"
      ${get} -h >/dev/null 2>&1
      e=$?
      if (( $e )); then
        echo unusable, returned $e
        return $e
      else
        echo yes
      fi
    fi
    # intentionally stripping whitespace
    echo ${var} := ${get} ${varflags} >> "${OUT}" || exit 1
  else
    echo no
  fi
  return $e
}

rcheck() {
  check "$@" || exit
}

fcheck() {
  for f in $3; do
    checking "for $f $1 support in ffmpeg"
    if grep -Eq "^ $2 $f " <<< "$4"; then
      echo yes
    else
      echo no
      exit 1
    fi
  done
}

echeck() {
  checking "for $2"
  if [ "$1" "$2" ]; then
    echo found
  else
    echo "$2 is missing; make sure you have $3" >&2
    exit 1
  fi
}

echeck -f ast2json/script-a1-monday.rpyc "copied the rpyc files"
echeck -d www/dump "you have extracted the rpa"

OUT=Makefile.inc
> "${OUT}" || exit 1

VAR=GZIP check zopfli || rcheck gzip -9
NO_RUN=1 rcheck apngasm
rcheck convert
rcheck cwebp -quiet -alpha_cleanup -m 6
rcheck ffmpeg -v warning -y
F=$($FFMPEG -formats 2>&1)
fcheck demuxing "D." "matroska,webm ogg wav yuv4mpegpipe" "$F"
fcheck muxing ".E" "ipod mp4 ogg wav webm yuv4mpegpipe" "$F"
fcheck decoding ".{6}" "mpeg4 rawvideo pcm_s16le vorbis" "$($FFMPEG -decoders 2>&1)"
fcheck encoding ".{6}" "libx264 rawvideo libtheora libvpx libvpx-vp9 libfdk_aac libopus pcm_s16le" "$($FFMPEG -encoders 2>&1)"
rcheck npm --quiet
rcheck webpmux
NO_RUN=1 check defluff
check pngquant
check zopflipng

exit 0