Added build script for makemkv
[bluplayer] / build-makemkv.sh
1 #!/bin/bash
2
3 set -e
4
5 if [ -z "$1" ]; then
6 echo "Usage: $0 [makemkv-version]"
7 exit 1
8 fi
9
10 makemkv_ext=".tar.gz"
11 makemkv_bin_dir="makemkv-bin-${1}"
12 makemkv_oss_dir="makemkv-oss-${1}"
13 makemkv_bin_url="http://www.makemkv.com/download/${makemkv_bin_dir}${makemkv_ext}"
14 makemkv_oss_url="http://www.makemkv.com/download/${makemkv_oss_dir}${makemkv_ext}"
15
16 base_dir="${HOME}/.makemkv_install/v${1}"
17 build_dir="${base_dir}/build"
18 install_dir="${base_dir}/install"
19
20
21 mkdir -p "${build_dir}/unpack-bin/" "${build_dir}/unpack-oss/"
22 mkdir -p "${install_dir}/bin/" "${install_dir}/lib/"
23
24
25 pushd "${build_dir}/unpack-bin/"
26 wget "${makemkv_bin_url}"
27 tar zxf "$(basename "${makemkv_bin_url}")"
28 cp "${makemkv_bin_dir}/bin/amd64/makemkvcon" "${install_dir}/bin/"
29 chmod +x "${install_dir}/bin/makemkvcon"
30 popd
31
32
33 pushd "${build_dir}/unpack-oss/"
34 wget "${makemkv_oss_url}"
35 tar zxf "$(basename "${makemkv_oss_url}")"
36 cd "${makemkv_oss_dir}/"
37 make -f makefile.linux
38 cp out/libdriveio.so.0 out/libmakemkv.so.1 "${install_dir}/lib/"
39 cp out/makemkv "${install_dir}/bin/"
40 popd
41
42
43 makemkvcon_wrap="${install_dir}/bin/makemkvcon.wrap"
44 cat > "${makemkvcon_wrap}" <<EOT
45 #!/bin/bash
46 export LD_LIBRARY_PATH="${install_dir}/lib"
47 "${install_dir}/bin/makemkvcon" "\$@"
48 EOT
49 chmod +x "${makemkvcon_wrap}"
50
51
52 mkdir -p "${HOME}/bin"
53 ln -sf "${makemkvcon_wrap}" "${HOME}/bin/makemkvcon"
54