#!/bin/sh -e

export CC="${CC:-cc}"
export CXX="${CXX:-c++}"

patch -p1 < fix-busybox-diff.patch

# Remove the perl requirement from configure
# as we have removed the perl requirement
# ourselves :-).
sed -i 's/perl/:/g' configure

./configure \
    --prefix=/usr \
    --enable-vp8 \
    --enable-vp9 \
    --enable-experimental \
    --enable-runtime-cpu-detect \
    --target=x86_64-linux-gcc \
    --enable-shared \
    --enable-postproc \
    --enable-pic \
    --disable-tools \
    --disable-examples \
    --disable-docs \
    --disable-unit-tests \
    --disable-install-docs \
    --disable-install-srcs \
    --disable-install-bins \
    --as=nasm

make
make DESTDIR="$1" install
