#!/bin/sh -e

# Remove -pie from ldflags because it breaks builds.
LDFLAGS="$(echo $LDFLAGS|sed 's/-pie//')"

export DESTDIR="$1"

sed -i "/subdir('tests')/d" meson.build

meson \
    --prefix=/usr \
    --sysconfdir=/etc \
    --mandir=/usr/share/man \
    -Dgir=false \
    -Djasper=false \
    -Dpng=true \
    -Ddocs=false \
    -Dman=false \
    -Dgio_sniffing=false \
    -Dinstalled_tests=false \
    -Dbuiltin_loaders=all \
    . output

ninja -C output
ninja -C output install
