build-makemkv.sh supports v1.8.7
[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 if [ -f makefile.linux ]; then
38 # v1.8.6 and older
39 make -f makefile.linux
40 else
41 # v1.8.7 and newer
42 ./configure
43 make
44 fi
45 rm out/*.full
46 cp out/lib* "${install_dir}/lib/"
47 cp out/makemkv "${install_dir}/bin/"
48 popd
49
50
51 makemkvcon_wrap="${install_dir}/bin/makemkvcon.wrap"
52 cat > "${makemkvcon_wrap}" <<EOT
53 #!/bin/bash
54 export LD_LIBRARY_PATH="${install_dir}/lib"
55 "${install_dir}/bin/makemkvcon" "\$@"
56 EOT
57 chmod +x "${makemkvcon_wrap}"
58
59
60 mkdir -p "${HOME}/bin"
61 ln -sf "${makemkvcon_wrap}" "${HOME}/bin/makemkvcon"
62