#!/bin/bash

# add SDL CFLAGS + LDFLAGS here.
if [[ `uname` = "Linux" ]]; then
  export CPPFLAGS="${CPPFLAGS} -I${PREFIX}/include"
  export LDFLAGS="-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro \
      -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-z,noexecstack \
      -Wl,-rpath,$PREFIX/lib -Wl,-rpath-link,$PREFIX/lib -L${PREFIX}/lib"
fi

autoreconf -vfi
mkdir build-${HOST} && pushd build-${HOST}
${SRC_DIR}/configure --prefix=${PREFIX}  \
                     --with-zlib         \
                     --with-bz2lib       \
                     --with-iconv        \
                     --with-lz4          \
                     --with-lzma         \
                     --with-lzo2         \
                     --with-zstd         \
                     --without-cng       \
                     --with-openssl      \
                     --without-nettle    \
                     --with-xml2         \
                     --without-expat
make -j${CPU_COUNT} ${VERBOSE_AT}
make install
popd
