Added build script for makemkv
authorJames Bunton <jamesbunton@delx.net.au>
Sun, 17 Feb 2013 11:43:52 +0000 (22:43 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Sun, 17 Feb 2013 11:43:52 +0000 (22:43 +1100)
build-makemkv.sh [new file with mode: 0755]

diff --git a/build-makemkv.sh b/build-makemkv.sh
new file mode 100755 (executable)
index 0000000..55461d6
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$1" ]; then
+       echo "Usage: $0 [makemkv-version]"
+       exit 1
+fi
+
+makemkv_ext=".tar.gz"
+makemkv_bin_dir="makemkv-bin-${1}"
+makemkv_oss_dir="makemkv-oss-${1}"
+makemkv_bin_url="http://www.makemkv.com/download/${makemkv_bin_dir}${makemkv_ext}"
+makemkv_oss_url="http://www.makemkv.com/download/${makemkv_oss_dir}${makemkv_ext}"
+
+base_dir="${HOME}/.makemkv_install/v${1}"
+build_dir="${base_dir}/build"
+install_dir="${base_dir}/install"
+
+
+mkdir -p "${build_dir}/unpack-bin/" "${build_dir}/unpack-oss/"
+mkdir -p "${install_dir}/bin/" "${install_dir}/lib/"
+
+
+pushd "${build_dir}/unpack-bin/"
+wget "${makemkv_bin_url}"
+tar zxf "$(basename "${makemkv_bin_url}")"
+cp "${makemkv_bin_dir}/bin/amd64/makemkvcon" "${install_dir}/bin/"
+chmod +x "${install_dir}/bin/makemkvcon"
+popd
+
+
+pushd "${build_dir}/unpack-oss/"
+wget "${makemkv_oss_url}"
+tar zxf "$(basename "${makemkv_oss_url}")"
+cd "${makemkv_oss_dir}/"
+make -f makefile.linux
+cp out/libdriveio.so.0 out/libmakemkv.so.1 "${install_dir}/lib/"
+cp out/makemkv "${install_dir}/bin/"
+popd
+
+
+makemkvcon_wrap="${install_dir}/bin/makemkvcon.wrap"
+cat > "${makemkvcon_wrap}" <<EOT
+#!/bin/bash
+export LD_LIBRARY_PATH="${install_dir}/lib"
+"${install_dir}/bin/makemkvcon" "\$@"
+EOT
+chmod +x "${makemkvcon_wrap}"
+
+
+mkdir -p "${HOME}/bin"
+ln -sf "${makemkvcon_wrap}" "${HOME}/bin/makemkvcon"
+