#!/bin/bash

#
# lame
#
LAME_VERSION=3.99.5

if [ ! -d lame-$LAME_VERSION ]
then
    if [ ! -f lame-$LAME_VERSION.tar.gz ]
    then
        wget https://freefr.dl.sourceforge.net/project/lame/lame/3.99/lame-$LAME_VERSION.tar.gz
    fi
    tar xf lame-$LAME_VERSION.tar.gz
fi

pushd lame-$LAME_VERSION
./configure \
 --prefix="$BUILD_DIR" \
 --libdir="$BUILD_DIR/lib" \
 --enable-shared \
 --disable-static \
 --disable-decoder \
 --disable-frontend \
 --disable-mp3x \
 --disable-mp3rtp \
 --disable-dynamic-frontends
sed -i -e 's/libmp3lame\.la/libmp3lame-nimble.la/' libmp3lame/Makefile
make -j 4
make install
popd
