Skip to content

Commit

Permalink
media-video/makemkv: Use the l10n eclass to select locales
Browse files Browse the repository at this point in the history
Upstream uses non-standard locale names so map them with an
associative array and perform some tricks.

Thanks to Jan Chren for the initial work on this.

Package-Manager: portage-2.2.28
  • Loading branch information
chewi committed May 8, 2016
1 parent ae9c0f2 commit c1c9e26
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions media-video/makemkv/makemkv-1.9.10.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ RDEPEND="
"
DEPEND="${RDEPEND}"

# Upstream uses non-standard locale names so map them with this
# associative array and perform some tricks below.
declare -A MY_LOCALES
MY_LOCALES=(
[zh]=chi
[da]=dan
[de]=deu
[nl]=dut
[fr]=fra
[it]=ita
[ja]=jpn
[no]=nor
[fa]=per
[pl]=pol
[pt_BR]=ptb
[es]=spa
[sv]=swe
)

PLOCALES="${!MY_LOCALES[@]}"
inherit l10n

S="${WORKDIR}/makemkv-oss-${PV}"

src_prepare() {
Expand All @@ -57,6 +79,9 @@ src_prepare() {
PATCHES+=( "${FILESDIR}"/${PN}-qt5.patch )
fi

# Check for locale changes against the non-standard names.
PLOCALES="${MY_LOCALES[@]}" l10n_find_plocales_changes "${WORKDIR}"/${MY_PB}/src/share makemkv_ .mo.gz

default
}

Expand Down Expand Up @@ -103,24 +128,29 @@ src_install() {
make_desktop_entry ${PN} MakeMKV ${PN} 'Qt;AudioVideo;Video'
fi

# install bin package
pushd "${WORKDIR}"/${MY_PB}/bin >/dev/null
cd "${WORKDIR}"/${MY_PB} || die

# install prebuilt bins
if use x86; then
dobin i386/{makemkvcon,mmdtsdec}
dobin bin/i386/{makemkvcon,mmdtsdec}
elif use amd64; then
dobin amd64/makemkvcon
use multilib && dobin i386/mmdtsdec
dobin bin/amd64/makemkvcon
use multilib && dobin bin/i386/mmdtsdec
fi
popd >/dev/null

# install license and default profile
pushd "${WORKDIR}"/${MY_PB}/src/share >/dev/null
insinto /usr/share/MakeMKV
doins *.{gz,xml}
popd >/dev/null

# install profiles
doins src/share/*.xml

# install locales
local locale
for locale in $(l10n_get_locales); do
doins src/share/makemkv_${MY_LOCALES[${locale}]}.mo.gz
done
}

pkg_preinst() { gnome2_icon_savelist; }
pkg_preinst() { gnome2_icon_savelist; }

pkg_postinst() {
gnome2_icon_cache_update
Expand Down

0 comments on commit c1c9e26

Please sign in to comment.