our opensuse %meson macro does:
export LANG=C.UTF-8
export CFLAGS="${CFLAGS:--fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g}"
export CXXFLAGS="${CXXFLAGS:--fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g}"
export FFLAGS="${FFLAGS:--fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g}"
export FCFLAGS="${FCFLAGS:--fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g}"
/usr/bin/meson \
--buildtype=plain \
--prefix=/usr \
--libdir=/usr/lib64 \
--libexecdir=/usr/lib \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--includedir=/usr/include \
--datadir=/usr/share \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localedir=/usr/share/locale \
--sysconfdir=/etc \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--wrap-mode=nodownload \
. build \
so @Elle was actually correct just instead of the -Dprefix=... you need --prefix=...