#!/usr/bin/env bash

set -euo pipefail

VERSION=1.17.4
mkdir -p src
pushd src || exit 1
curl -OL "https://www.makemkv.com/download/makemkv-bin-$VERSION.tar.gz"
curl -OL "https://www.makemkv.com/download/makemkv-oss-$VERSION.tar.gz"
tar zxvf "makemkv-bin-$VERSION.tar.gz"
tar zxvf "makemkv-oss-$VERSION.tar.gz"
pushd "makemkv-oss-$VERSION" || exit 1
./configure --prefix="$HOME/.local"
make
sudo make PREFIX="$HOME/.local" install
popd || exit 1
pushd "makemkv-bin-$VERSION" || exit 1
make PREFIX="$HOME/.local" install
popd || exit 1
popd || exit 1
