(env
 (release
  (ocamlopt_flags
   (:standard -w -9 -alert --deprecated -O2)))
 (_
  (flags
   (:standard -w -9 -alert --deprecated))))

; Regenerate using dune build @gendune --auto-promote

(include dune.inc)

(executable
 (name gen_dune)
 (libraries liquidsoap_build_tools)
 (modules gen_dune))

(rule
 (alias gendune)
 (deps
  (source_tree .))
 (target dune.inc.gen)
 (action
  (with-stdout-to
   dune.inc.gen
   (run ./gen_dune.exe))))

(rule
 (alias gendune)
 (action
  (diff dune.inc dune.inc.gen)))

(rule
 (alias citest)
 (target test.wav)
 (action
  (run ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -ac 2 %{target})))

(rule
 (alias citest)
 (target test.mp3)
 (action
  (run ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -ac 2 %{target})))

(rule
 (alias citest)
 (target json)
 (action
  (progn
   (run rm -rf json)
   (run git clone --depth 1 https://github.com/nst/JSONTestSuite json)
   (system "cd json && mv test_parsing/*.json .")
   (system
    "cd json && find . -maxdepth 1 -type d | grep -v '^\\.$' | xargs rm -rf"))))

(rule
 (alias citest)
 (target json5)
 (action
  (progn
   (run rm -rf json5)
   (run git clone --depth 1 https://github.com/json5/json5-tests.git json5)
   (system
    "cd json5 && find . -type f | egrep '\\.json|\\.js|\\.txt' | xargs -I % mv % .")
   (system "cd json5 && find . -type d | grep -v '^\\.$' | xargs rm -rf"))))

(rule
 (alias citest)
 (target big-list-of-naughty-strings)
 (action
  (progn
   (run rm -rf big-list-of-naughty-strings)
   (run
    git
    clone
    --depth
    1
    https://github.com/minimaxir/big-list-of-naughty-strings.git))))
