#!/bin/sh

if [ -z ${CROSS_FILE} ]
then
  if [ -z ${NEED_WINE} ]
  then
    CROSS_FILE=/usr/share/mingw/toolchain-@TRIPLE@.meson
  else
    CROSS_FILE=/usr/share/mingw/toolchain-@TRIPLE@-wine.meson
  fi
fi


meson setup \
  --prefix         /usr/@TRIPLE@ \
  --libdir         /usr/@TRIPLE@/lib \
  --libexecdir     /usr/@TRIPLE@/lib \
  --bindir         /usr/@TRIPLE@/bin \
  --sbindir        /usr/@TRIPLE@/bin \
  --includedir     /usr/@TRIPLE@/include \
  --datadir        /usr/@TRIPLE@/share \
  --mandir         /usr/@TRIPLE@/share/man \
  --infodir        /usr/@TRIPLE@/share/info \
  --localedir      /usr/@TRIPLE@/share/locale \
  --sysconfdir     /usr/@TRIPLE@/etc \
  --localstatedir  /var \
  --sharedstatedir /var/lib \
  --buildtype      release \
  --wrap-mode      nofallback \
  --strip \
  --cross-file ${CROSS_FILE} \
  --default-library shared \
  "$@" \
  -D               b_lto=true
