#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("/lib/create_component.lib.yml", "single_build_component")

#@ source_url = "https://www.freedesktop.org/software/libinput/libinput-1.16.3.tar.xz"

#@yaml/text-templated-strings
---
#@ def libinput_args():
license: source/COPYING
configure: |
  mkdir -p "$BUILD_DIR" "$BUILD_DIR/source"
  extract.sh --into "$BUILD_DIR/source" "(@= source_url @)"
  find "$BUILD_DIR/source/" -name meson.build -exec sed -i "s|install\s*:\s*|install_rpath : '$RPATH_PLACEHOLDER/lib', \0|" {} \;

  export CC=clang
  export CXX=/bin/false
  meson setup \
    --buildtype plain \
    --libdir=lib \
    --prefix "$ORCHESTRA_ROOT" \
    --wrap-mode nodownload \
    -Ddebug-gui=false \
    -Ddocumentation=false \
    -Dlibwacom=false \
    -Dtests=false \
    -Dudev-dir=/lib/udev \
    -Dc_args="-Dstatic_assert=_Static_assert -w" \
    "$BUILD_DIR" \
    "$BUILD_DIR/source"
build_system: ninja
build_dependencies:
  - host-c-toolchain
#@ end

#@overlay/match by=overlay.all, expects=1
#@overlay/match-child-defaults missing_ok=True
---
components:
  ui/libinput: #@ single_build_component(**libinput_args())