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

(include_subdirs unqualified)

(rule
 (target liquidsoap_paths.ml)
 (action
  (copy liquidsoap_paths.%{env:LIQUIDSOAP_BUILD_TARGET=default}.ml %{target})))

(library
 (name liquidsoap_core)
 (preprocess
  (pps ppx_string))
 (libraries
  mm
  dtools
  dune-build-info
  duppy
  fileutils
  liquidsoap-lang
  liquidsoap-lang.console
  menhirLib
  pcre
  camomile.lib
  curl
  cry
  uri
  metadata
  magic-mime
  (select
   file_watcher.ml
   from
   (inotify -> file_watcher.inotify.ml)
   (-> file_watcher.mtime.ml)))
 (foreign_stubs
  (language c)
  (names unix_c defer_c))
 (wrapped false)
 (library_flags -linkall)
 (modules
  aFrame
  accelerate
  add
  amplify
  annotate
  append
  audio_converter
  audio_gen
  available
  avi
  avi_encoder
  avi_format
  biquad_filter
  blank
  charset_base
  charset
  child_support
  chord
  clip
  clock
  comb
  compand
  compress
  compress_exp
  content
  content_audio
  content_pcm_base
  content_pcm_f32
  content_pcm_s16
  content_base
  content_midi
  content_timed
  content_video
  conversion
  configure
  cross
  debug_sources
  decoder
  decoder_utils
  defer
  delay
  delay_line
  doc
  dtmf
  dyn_op
  echo
  encoder
  encoder_formats
  encoder_utils
  error
  export_metadata
  external_decoder
  external_encoder
  external_encoder_format
  external_input
  external_input_audio
  external_input_video
  extralib
  extra_args
  fdkaac_format
  ffmpeg_format
  file_watcher
  filter
  filter_rc
  fir_filter
  flac_format
  flac_metadata_plug
  flanger
  frame
  frame_base
  frame_settings
  frame_type
  format_type
  gate
  generated
  generator
  gstreamer_format
  harbor
  harbor_base
  harbor_input
  harbor_output
  hooks_implementations
  hls_output
  http
  icecast_utils
  icecast2
  id3_plug
  iir_filter
  image_decoder
  image_plug
  insert_metadata
  ioRing
  json
  keyboard
  lang
  lang_avi
  lang_encoder
  lang_external_encoder
  lang_fdkaac
  lang_flac
  lang_gstreamer
  lang_mp3
  lang_ogg
  lang_opus
  lang_source
  lang_shine
  lang_speex
  lang_string
  lang_theora
  lang_vorbis
  lang_wav
  latest_metadata
  liqcurl
  lifecycle
  liq_time
  liquidsoap_paths
  log
  lufs
  mFrame
  map_metadata
  map_op
  max_duration
  mean
  merge_metadata
  midi_decoder
  midi_routing
  midimeter
  modules
  mp3_format
  mpd
  ms_stereo
  muxer
  native_audio_converter
  native_video_converter
  noblank
  noise
  normalize
  ogg_format
  ogg_metadata_plug
  on_end
  on_frame
  on_metadata
  on_offset
  on_track
  opus_format
  output
  pan
  pipe
  pipe_output
  pitch
  playlist_parser
  plug
  pool
  pos
  ppm_decoder
  prepend
  process_handler
  producer_consumer
  raw_audio_decoder
  replaygain_op
  request
  request_simple
  request_source
  resample
  rms_smooth
  rqueue
  runtime_error
  sandbox
  sequence
  server
  server_builtins
  sha1
  shebang
  shine_format
  source
  speex_format
  srt_decoder
  srt_parser
  start_stop
  startup
  stereo
  still_frame
  stringView
  strings
  swap
  switch
  synth_op
  synthesized
  term
  theora_format
  time_warp
  track
  track_map
  tutils
  type
  typing
  unifier
  udp_io
  utils
  value
  vFrame
  video_board
  video_converter
  video_effects
  video_fade
  video_plug
  video_testsrc
  video_text
  video_text_native
  video_volume
  vorbis_format
  wav_aiff
  wav_aiff_decoder
  wav_encoder
  wav_format
  websocket
  window_op))

(library
 (name liquidsoap_builtins)
 (library_flags -linkall)
 (preprocess
  (pps ppx_string))
 (wrapped false)
 (libraries liquidsoap_core)
 (modules
  builtins_callbacks
  builtins_clock
  builtins_cry
  builtins_files
  builtins_harbor
  builtins_http
  builtins_metadata
  builtins_process
  builtins_request
  builtins_resolvers
  playlist_basic
  builtins_runtime
  builtins_server
  builtins_settings
  builtins_socket
  builtins_source
  builtins_string_extra
  builtins_sys
  builtins_thread
  builtins_time))

(library
 (name liquidsoap_alsa)
 (libraries alsa liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules alsa_in alsa_out alsa_io alsa_settings))

(library
 (name liquidsoap_ao)
 (libraries ao liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules ao_out))

(library
 (name liquidsoap_bjack)
 (libraries bjack liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules bjack_in bjack_out))

(library
 (name liquidsoap_camlimages)
 (libraries camlimages.all_formats liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules camlimages_decoder))

(library
 (name liquidsoap_mem_usage)
 (libraries mem_usage liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_mem_usage))

(library
 (name liquidsoap_memtrace)
 (libraries memtrace liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liqmemtrace))

(library
 (name liquidsoap_dssi)
 (libraries dssi liquidsoap_ladspa liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules dssi_op))

(library
 (name liquidsoap_faad)
 (libraries faad liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules aac_decoder))

(library
 (name liquidsoap_fdkaac)
 (libraries fdkaac liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules fdkaac_encoder))

(library
 (name liquidsoap_ffmpeg)
 (libraries
  ffmpeg-avutil
  ffmpeg-avcodec
  ffmpeg-avfilter
  ffmpeg-avdevice
  ffmpeg-swscale
  ffmpeg-swresample
  ffmpeg-av
  liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules
  builtins_ffmpeg_base
  builtins_ffmpeg_bitstream_filters
  builtins_ffmpeg_decoder
  builtins_ffmpeg_filters
  builtins_ffmpeg_encoder
  ffmpeg_avfilter_utils
  ffmpeg_audio_converter
  ffmpeg_content_base
  ffmpeg_copy_content
  ffmpeg_copy_decoder
  ffmpeg_copy_encoder
  ffmpeg_decoder
  ffmpeg_decoder_common
  ffmpeg_image_decoder
  ffmpeg_encoder
  ffmpeg_encoder_common
  ffmpeg_filter_io
  ffmpeg_internal_decoder
  ffmpeg_internal_encoder
  ffmpeg_io
  ffmpeg_raw_content
  ffmpeg_raw_decoder
  ffmpeg_utils
  ffmpeg_video_converter
  lang_ffmpeg))

(library
 (name liquidsoap_flac)
 (libraries flac liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_flac_decoder flac_encoder))

(library
 (name liquidsoap_ogg_flac)
 (libraries flac.ogg flac.decoder liquidsoap_core liquidsoap_ogg)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (foreign_stubs
  (language c)
  (names ogg_flac_encoder_stubs))
 (modules liq_flac_ogg_decoder ogg_flac_encoder ogg_flac_duration))

(library
 (name liquidsoap_frei0r)
 (libraries frei0r liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules frei0r_op))

(library
 (name liquidsoap_gd)
 (libraries gd liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules video_text_gd))

(library
 (name liquidsoap_graphics)
 (libraries graphics liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules graphics_out))

(library
 (name liquidsoap_gstreamer)
 (libraries gstreamer liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules
  gstreamer_decoder
  video_text_gstreamer
  gstreamer_encoder
  gstreamer_io
  gstreamer_utils))

(library
 (name liquidsoap_irc)
 (libraries irc-client-unix liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_irc))

(library
 (name liquidsoap_jemalloc)
 (libraries jemalloc liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_jemalloc))

(library
 (name liquidsoap_ladspa)
 (libraries ladspa liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules ladspa_op))

(library
 (name liquidsoap_lame)
 (libraries lame liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules lame_encoder))

(library
 (name liquidsoap_lastfm)
 (libraries lastfm liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_lastfm liqfm))

(library
 (name liquidsoap_lilv)
 (libraries lilv liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules lilv_op))

(library
 (name liquidsoap_lo)
 (libraries lo liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_lo))

(library
 (name liquidsoap_mad)
 (libraries mad liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules mad_decoder))

(library
 (name liquidsoap_ogg)
 (libraries ogg ogg.decoder liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules ogg_muxer ogg_encoder liq_ogg_decoder))

(library
 (name liquidsoap_opus)
 (libraries opus opus.decoder liquidsoap_core liquidsoap_ogg)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_opus_decoder opus_encoder))

(library
 (name liquidsoap_osc)
 (libraries osc-unix liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_osc))

(library
 (name liquidsoap_oss)
 (libraries liquidsoap_core)
 (enabled_if
  (= "linux" %{system}))
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (foreign_stubs
  (language c)
  (names oss_io_c))
 (modules oss_io))

(library
 (name liquidsoap_portaudio)
 (libraries portaudio liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules portaudio_io))

(library
 (name liquidsoap_posix_time)
 (libraries posix-time2 liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_posix_time))

(library
 (name liquidsoap_prometheus)
 (libraries cohttp-lwt-unix prometheus-app liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_prometheus builtins_prometheus))

(library
 (name liquidsoap_pulseaudio)
 (libraries pulseaudio liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules pulseaudio_io))

(library
 (name liquidsoap_samplerate)
 (libraries samplerate liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules libsamplerate_converter))

(library
 (name liquidsoap_sdl)
 (libraries tsdl-image tsdl-ttf liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules sdlimage_decoder video_text_sdl sdl_out keyboard_sdl sdl_utils))

(library
 (name liquidsoap_imagelib)
 (libraries imagelib imagelib.unix liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules imagelib_decoder))

(library
 (name liquidsoap_shine)
 (libraries shine liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules shine_encoder))

(library
 (name liquidsoap_soundtouch)
 (libraries soundtouch liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules soundtouch_op st_bpm))

(library
 (name liquidsoap_speex)
 (libraries speex speex.decoder liquidsoap_core liquidsoap_ogg)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_speex_decoder speex_encoder))

(library
 (name liquidsoap_srt)
 (libraries srt liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_srt srt_io))

(library
 (name liquidsoap_ssl)
 (libraries ssl liquidsoap_core liquidsoap_builtins)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules ssl_base builtins_ssl))

(library
 (name liquidsoap_stereotool)
 (libraries stereotool liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules stereotool_op))

(library
 (name liquidsoap_taglib)
 (libraries taglib liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules taglib_plug taglib_id3v2))

(library
 (name liquidsoap_theora)
 (libraries theora theora.decoder liquidsoap_core liquidsoap_ogg)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_theora_decoder theora_encoder))

(library
 (name liquidsoap_tls)
 (libraries
  tls
  ca-certs
  mirage-crypto-rng.unix
  cstruct
  liquidsoap_core
  liquidsoap_builtins)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_tls))

(library
 (name liquidsoap_vorbis)
 (libraries vorbis vorbis.decoder liquidsoap_core liquidsoap_ogg)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules liq_vorbis_decoder vorbis_encoder vorbisduration))

(library
 (name liquidsoap_yaml)
 (libraries yaml liquidsoap_core)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules builtins_yaml))

(library
 (name liquidsoap_xmlplaylist)
 (libraries xmlplaylist liquidsoap_core liquidsoap_builtins)
 (library_flags -linkall)
 (wrapped false)
 (optional)
 (modules playlist_xml))

(copy_files ../config/*.ml)

(library
 (name liquidsoap_optionals)
 (library_flags -linkall)
 (preprocess
  (pps ppx_string))
 (wrapped false)
 (modules
  alsa_option
  ao_option
  bjack_option
  builtins_optionals
  camlimages_option
  dssi_option
  faad_option
  fdkaac_option
  ffmpeg_option
  flac_option
  ogg_flac_option
  frei0r_option
  gd_option
  graphics_option
  gstreamer_option
  imagelib_option
  inotify_option
  irc_option
  jemalloc_option
  ladspa_option
  lame_option
  lastfm_option
  lilv_option
  lo_option
  mad_option
  mem_usage_option
  memtrace_option
  ogg_option
  opus_option
  osc_option
  oss_option
  portaudio_option
  posix_time_option
  prometheus_option
  pulseaudio_option
  samplerate_option
  sdl_option
  shine_option
  soundtouch_option
  speex_option
  srt_option
  ssl_option
  stereotool_option
  taglib_option
  theora_option
  tls_option
  vorbis_option
  winsvc_option
  yaml_option
  xmlplaylist_option)
 (libraries
  liquidsoap_core
  (select
   alsa_option.ml
   from
   (liquidsoap_alsa -> alsa_option.enabled.ml)
   (-> alsa_option.disabled.ml))
  (select
   ao_option.ml
   from
   (liquidsoap_ao -> ao_option.enabled.ml)
   (-> ao_option.disabled.ml))
  (select
   bjack_option.ml
   from
   (liquidsoap_bjack -> bjack_option.enabled.ml)
   (-> bjack_option.disabled.ml))
  (select
   camlimages_option.ml
   from
   (liquidsoap_camlimages -> camlimages_option.enabled.ml)
   (-> camlimages_option.disabled.ml))
  (select
   dssi_option.ml
   from
   (liquidsoap_dssi -> dssi_option.enabled.ml)
   (-> dssi_option.disabled.ml))
  (select
   faad_option.ml
   from
   (liquidsoap_faad -> faad_option.enabled.ml)
   (-> faad_option.disabled.ml))
  (select
   fdkaac_option.ml
   from
   (liquidsoap_fdkaac -> fdkaac_option.enabled.ml)
   (-> fdkaac_option.disabled.ml))
  (select
   ffmpeg_option.ml
   from
   (liquidsoap_ffmpeg -> ffmpeg_option.enabled.ml)
   (-> ffmpeg_option.disabled.ml))
  (select
   flac_option.ml
   from
   (liquidsoap_flac -> flac_option.enabled.ml)
   (-> flac_option.disabled.ml))
  (select
   ogg_flac_option.ml
   from
   (liquidsoap_ogg_flac -> ogg_flac_option.enabled.ml)
   (-> ogg_flac_option.disabled.ml))
  (select
   frei0r_option.ml
   from
   (liquidsoap_frei0r -> frei0r_option.enabled.ml)
   (-> frei0r_option.disabled.ml))
  (select
   gd_option.ml
   from
   (liquidsoap_gd -> gd_option.enabled.ml)
   (-> gd_option.disabled.ml))
  (select
   graphics_option.ml
   from
   (liquidsoap_graphics -> graphics_option.enabled.ml)
   (-> graphics_option.disabled.ml))
  (select
   gstreamer_option.ml
   from
   (liquidsoap_gstreamer -> gstreamer_option.enabled.ml)
   (-> gstreamer_option.disabled.ml))
  (select
   inotify_option.ml
   from
   (inotify -> inotify_option.enabled.ml)
   (-> inotify_option.disabled.ml))
  (select
   irc_option.ml
   from
   (liquidsoap_irc -> irc_option.enabled.ml)
   (-> irc_option.disabled.ml))
  (select
   jemalloc_option.ml
   from
   (liquidsoap_jemalloc -> jemalloc_option.enabled.ml)
   (-> jemalloc_option.disabled.ml))
  (select
   ladspa_option.ml
   from
   (liquidsoap_ladspa -> ladspa_option.enabled.ml)
   (-> ladspa_option.disabled.ml))
  (select
   lame_option.ml
   from
   (liquidsoap_lame -> lame_option.enabled.ml)
   (-> lame_option.disabled.ml))
  (select
   lastfm_option.ml
   from
   (liquidsoap_lastfm -> lastfm_option.enabled.ml)
   (-> lastfm_option.disabled.ml))
  (select
   lilv_option.ml
   from
   (liquidsoap_lilv -> lilv_option.enabled.ml)
   (-> lilv_option.disabled.ml))
  (select
   lo_option.ml
   from
   (liquidsoap_lo -> lo_option.enabled.ml)
   (-> lo_option.disabled.ml))
  (select
   mad_option.ml
   from
   (liquidsoap_mad -> mad_option.enabled.ml)
   (-> mad_option.disabled.ml))
  (select
   mem_usage_option.ml
   from
   (liquidsoap_mem_usage -> mem_usage_option.enabled.ml)
   (-> mem_usage_option.disabled.ml))
  (select
   memtrace_option.ml
   from
   (liquidsoap_memtrace -> memtrace_option.enabled.ml)
   (-> memtrace_option.disabled.ml))
  (select
   ogg_option.ml
   from
   (liquidsoap_ogg -> ogg_option.enabled.ml)
   (-> ogg_option.disabled.ml))
  (select
   opus_option.ml
   from
   (liquidsoap_opus -> opus_option.enabled.ml)
   (-> opus_option.disabled.ml))
  (select
   osc_option.ml
   from
   (liquidsoap_osc -> osc_option.enabled.ml)
   (-> osc_option.disabled.ml))
  (select
   oss_option.ml
   from
   (liquidsoap_oss -> oss_option.enabled.ml)
   (-> oss_option.disabled.ml))
  (select
   portaudio_option.ml
   from
   (liquidsoap_portaudio -> portaudio_option.enabled.ml)
   (-> portaudio_option.disabled.ml))
  (select
   posix_time_option.ml
   from
   (liquidsoap_posix_time -> posix_time_option.enabled.ml)
   (-> posix_time_option.disabled.ml))
  (select
   prometheus_option.ml
   from
   (liquidsoap_prometheus -> prometheus_option.enabled.ml)
   (-> prometheus_option.disabled.ml))
  (select
   pulseaudio_option.ml
   from
   (liquidsoap_pulseaudio -> pulseaudio_option.enabled.ml)
   (-> pulseaudio_option.disabled.ml))
  (select
   samplerate_option.ml
   from
   (liquidsoap_samplerate -> samplerate_option.enabled.ml)
   (-> samplerate_option.disabled.ml))
  (select
   sdl_option.ml
   from
   (liquidsoap_sdl -> sdl_option.enabled.ml)
   (-> sdl_option.disabled.ml))
  (select
   imagelib_option.ml
   from
   (liquidsoap_imagelib -> imagelib_option.enabled.ml)
   (-> imagelib_option.disabled.ml))
  (select
   shine_option.ml
   from
   (liquidsoap_shine -> shine_option.enabled.ml)
   (-> shine_option.disabled.ml))
  (select
   soundtouch_option.ml
   from
   (liquidsoap_soundtouch -> soundtouch_option.enabled.ml)
   (-> soundtouch_option.disabled.ml))
  (select
   speex_option.ml
   from
   (liquidsoap_speex -> speex_option.enabled.ml)
   (-> speex_option.disabled.ml))
  (select
   srt_option.ml
   from
   (liquidsoap_srt -> srt_option.enabled.ml)
   (-> srt_option.disabled.ml))
  (select
   ssl_option.ml
   from
   (liquidsoap_ssl -> ssl_option.enabled.ml)
   (-> ssl_option.disabled.ml))
  (select
   stereotool_option.ml
   from
   (liquidsoap_stereotool -> stereotool_option.enabled.ml)
   (-> stereotool_option.disabled.ml))
  (select
   taglib_option.ml
   from
   (liquidsoap_taglib -> taglib_option.enabled.ml)
   (-> taglib_option.disabled.ml))
  (select
   theora_option.ml
   from
   (liquidsoap_theora -> theora_option.enabled.ml)
   (-> theora_option.disabled.ml))
  (select
   tls_option.ml
   from
   (liquidsoap_tls -> tls_option.enabled.ml)
   (-> tls_option.disabled.ml))
  (select
   vorbis_option.ml
   from
   (liquidsoap_vorbis -> vorbis_option.enabled.ml)
   (-> vorbis_option.disabled.ml))
  (select
   winsvc_option.ml
   from
   (winsvc -> winsvc_option.enabled.ml)
   (-> winsvc_option.disabled.ml))
  (select
   yaml_option.ml
   from
   (liquidsoap_yaml -> yaml_option.enabled.ml)
   (-> yaml_option.disabled.ml))
  (select
   xmlplaylist_option.ml
   from
   (liquidsoap_xmlplaylist -> xmlplaylist_option.enabled.ml)
   (-> xmlplaylist_option.disabled.ml))))
