linamh/games-rpg/baldursgate/baldursgate-2.5.26498.ebuild

657 lines
26 KiB
Bash
Raw Normal View History

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils games multilib
LANGUAGES="linguas_fr linguas_it linguas_es linguas_de"
MY_PV=${PV//.}
UPDATE_BASEURL="http://downloads.bioware.com/baldursgate2/"
SOA_ENGLISH="Baldur%27sGateII-ShadowsofAmnPatchENGLISH.exe"
SOA_EUROPE="Baldur%27sGateII-ShadowsofAmnPatchEUROPE.exe"
TOB_ENGLISH="BGII-ThroneofBhaal_Patch_26498_ENGLISH.exe"
TOB_EUROPE="BGII-ThroneofBhaal_Patch_26498_EUROPEAN.exe"
LINGUAS_SRC_URI="linguas_fr? (
tob? ( ${UPDATE_BASEURL}/${TOB_EUROPE} )
${UPDATE_BASEURL}/${SOA_EUROPE} )
linguas_it? (
tob? ( ${UPDATE_BASEURL}/${TOB_EUROPE} )
${UPDATE_BASEURL}/${SOA_EUROPE} )
linguas_es? (
tob? ( ${UPDATE_BASEURL}/${TOB_EUROPE} )
${UPDATE_BASEURL}/${SOA_EUROPE} )
linguas_es? (
tob? ( ${UPDATE_BASEURL}/${TOB_EUROPE} )
${UPDATE_BASEURL}/${SOA_EUROPE} )
linguas_de? (
tob? ( ${UPDATE_BASEURL}/${TOB_EUROPE} )
${UPDATE_BASEURL}/${SOA_EUROPE} )
tob? ( ${UPDATE_BASEURL}/${TOB_ENGLISH} )
${UPDATE_BASEURL}/${SOA_ENGLISH}"
DESCRIPTION="Baldurs Gate SOA TOB"
HOMEPAGE="http://www.bioware.com/games/shadows_amn/ http://www.bioware.com/games/throne_bhaal/"
SRC_URI="http://www.tamacom.com/pathconvert/pathconvert.tar.gz
http://www.iconarchive.com/icons/3xhumed/mega-games-pack-25/Baldur-s-Gate-2-Shadows-of-Amn-2-128x128.png
tob? ( http://www.iconarchive.com/icons/3xhumed/mega-games-pack-25/Baldur-s-Gate-2-Throne-of-Bhaal-2-128x128.png )
${LINGUAS_SRC_URI}"
LICENSE="BG2-EULA"
SLOT="2"
KEYWORDS="~amd64 x86"
IUSE="tob videos ${LANGUAGES}"
RESTRICT="strip mirror"
RDEPEND=">=games-engines/gemrb-0.5.0"
DEPEND="${RDEPEND}
app-arch/unshield
app-arch/p7zip"
GAMES_LICENSE_CHECK=yes
launcher=${S}/BaldursGate${SLOT}
dir=${GAMES_PREFIX_OPT}/BioWare/BaldursGate${SLOT}
Ddir=${D}/${dir}
LNDIR="${S}"/pathconvert/lndir/lndir
BG2_SET=
# This is my fun section where I try to determine which CD/DVD set we have.
# Expect this to be very messy and ugly, and hopefully it all works as we want
# it to on all of the various media.
get_bg2_set() {
# First we check to see if we have CD_ROOT defined already. If we do,
# this will make our lives so much easier.
if [[ -n "${CD_ROOT}" ]]
then
if [[ -f "${CD_ROOT}"/CD4/Data/CD4CreAn.bif ]] && [[ -f "${CD_ROOT}"/data1.hdr ]]
then
BG2_SET="dvd"
einfo "Baldurs Gate II: Shadows of Amn DVD found..."
elif [[ -f "${CD_ROOT}"/data1.hdr ]]
then
BG2_SET="original_cd"
einfo "Baldurs Gate II: Shadows of Amn CD set found..."
fi
# Now we check to see if we have CD_ROOT_1 set, which means we have a CD
# set, or even a DVD set.
elif [[ -n "${CD_ROOT_1}" ]]
then
if [[ -f "${CD_ROOT_1}"/CD4/Data/CD4CreAn.bif ]] && [[ -f "${CD_ROOT_1}"/data1.hdr ]]
then
BG2_SET="dvd"
einfo "Baldurs Gate II: Shadows of Amn DVD found..."
elif [[ -f "${CD_ROOT_1}"/data1.hdr ]]
then
BG2_SET="original_cd"
einfo "Baldurs Gate II: Shadows of Amn CD set found..."
fi
# OK. Neither were set, so now we're going to start our detection and try
# to figure out what we have to work from.
else
local mline=
for mline in $(mount | egrep -e '(iso|cdrom|udf)' | awk '{print $3}')
do
if [[ -f "${mline}"/CD4/Data/CD4CreAn.bif ]] && [[ -f "${mline}"/data1.hdr ]]
then
BG2_SET="dvd"
einfo "Baldurs Gate II: Shadows of Amn DVD found..."
elif [[ -f "${mline}"/data1.hdr ]]
then
BG2_SET="original_cd"
einfo "Baldurs Gate II: Shadows of Amn CD set found..."
fi
done
fi
}
get_cd_set() {
while `[[ -z "${BG2_SET}" ]]`
do
echo "Please insert your first Baldurs Gate II: Shadows of Amn CD/DVD into your drive and"
echo "press any key to continue"
read -n 1
get_bg2_set
done
# Here is where we start our CD/DVD detection for changing disks.
case "${BG2_SET}" in
dvd)
export CDROM_NAME_1="DVD1"
einfo "Both Shadows of Undrentide and Hordes of the Underdark will"
einfo "be installed from your DVD along with Neverwinter Nights."
if use tob
then
einfo "You will also need the SoU CD for this installation."
export CDROM_NAME_2="ToB"
cdrom_get_cds CD4/Data/CD4CreAn.bif CD5/movies/25Movies.bif
else
cdrom_get_cds CD4/Data/CD4CreAn.bif
fi
;;
original_cd)
export CDROM_NAME_1="CD1" CDROM_NAME_2="CD2" CDROM_NAME_3="CD3" CDROM_NAME_4="CD4"
touch .metadata/orig || die "touch orig"
if use tob
then
einfo "You will also need the SoU CD for this installation."
export CDROM_NAME_5="ToB"
cdrom_get_cds data1.hdr CD2/Data/MovHD0.bif \
CD3/Data/CD3CreAn.bif CD4/Data/CD4CreAn.bif CD5/movies/25Movies.bif
else
cdrom_get_cds data1.hdr CD2/Data/MovHD0.bif \
CD3/Data/CD3CreAn.bif CD4/Data/CD4CreAn.bif
fi
;;
esac
}
src_unpack() {
mkdir -p "${S}"
cd "${S}"
# We create this .metadata directory so we can keep track of what we have
# installed without needing to keep all of these multiple USE flags in all
# of the ebuilds.
mkdir -p .metadata || die "Creating .metadata"
# Since we dont *always* want to do this, we check for USE=cdinstall
# Here, we determine which CD/DVD set that we have. This will seem a
# bit odd, since well be doing the detection a few times.
get_bg2_set
# Now that we know what were looking for, lets look for the media.
get_cd_set
mkdir -p "${S}"/patches
cd "${S}"/patches
einfo "Unpacking Patch ${SOA_ENGLISH} files..."
7z x -osoa-en -y ${DISTDIR}/${SOA_ENGLISH} || die "unpacking"
unshield -L -d soa-en x "${S}"/patches/soa-en/data?.* || die "unshield"
if use tob
then
einfo "Unpacking Patch ${TOB_ENGLISH} files..."
7z x -otob-en -y ${DISTDIR}/${TOB_ENGLISH} || die "unpacking"
unshield -L -d tob-en x "${S}"/patches/tob-en/data?.* || die "unshield"
fi
if use linguas_fr
then
einfo "Unpacking Patch ${SOA_EUROPE} files..."
7z x -osoa-eu -y ${DISTDIR}/${SOA_EUROPE} || die "unpacking"
unshield -L -d soa-eu x "${S}"/patches/soa-eu/data?.* || die "unshield"
if use tob
then
einfo "Unpacking Patch ${TOB_EUROPE} files..."
7z x -otob-eu -y ${DISTDIR}/${TOB_EUROPE} || die "unpacking"
unshield -L -d tob-eu x "${S}"/patches/tob-eu/data?.* || die "unshield"
fi
fi
if use linguas_it
then
einfo "Unpacking Patch ${SOA_EUROPE} files..."
7z x -osoa-eu -y ${DISTDIR}/${SOA_EUROPE} || die "unpacking"
unshield -L -d soa-eu x "${S}"/patches/soa-eu/data?.* || die "unshield"
if use tob
then
einfo "Unpacking Patch ${TOB_EUROPE} files..."
7z x -otob-eu -y ${DISTDIR}/${TOB_EUROPE} || die "unpacking"
unshield -L -d tob-eu x "${S}"/patches/tob-eu/data?.* || die "unshield"
fi
fi
if use linguas_es
then
einfo "Unpacking Patch ${SOA_EUROPE} files..."
7z x -osoa-eu -y ${DISTDIR}/${SOA_EUROPE} || die "unpacking"
unshield -L -d soa-eu x "${S}"/patches/soa-eu/data?.* || die "unshield"
if use tob
then
einfo "Unpacking Patch ${TOB_EUROPE} files..."
7z x -otob-eu -y ${DISTDIR}/${TOB_EUROPE} || die "unpacking"
unshield -L -d tob-eu x "${S}"/patches/tob-eu/data?.* || die "unshield"
fi
fi
if use linguas_de
then
einfo "Unpacking Patch ${SOA_EUROPE} files..."
7z x -osoa-eu -y ${DISTDIR}/${SOA_EUROPE} || die "unpacking"
unshield -L -d soa-eu x "${S}"/patches/soa-eu/data?.* || die "unshield"
if use tob
then
einfo "Unpacking Patch ${TOB_EUROPE} files..."
7z x -otob-eu -y ${DISTDIR}/${TOB_EUROPE} || die "unpacking"
unshield -L -d tob-eu x "${S}"/patches/tob-eu/data?.* || die "unshield"
fi
fi
case ${BG2_SET} in
dvd)
mkdir -p "${S}"/shared-soa
cd "${S}"
# We dont give the user the option to install SoU/HotU. While some
# people might complain about this, most newer NWN stuff requires
# them both anyway, so it makes no sense not to install them.
einfo "Unpacking files..."
unshield -L -d shared-soa x "${CDROM_ROOT}"/data?.* || die "unpacking"
# We have to adjust the files after unpacking the cab file.
mkdir -p "${S}"/cd1
einfo "Copying CD1 files..."
[[ -d "${CDROM_ROOT}"/English ]] && cp -rv "${CDROM_ROOT}"/English cd1
if use linguas_fr
then
[[ -d "${CDROM_ROOT}"/French ]] && cp -rv "${CDROM_ROOT}"/French cd1
fi
if use linguas_it
then
[[ -d "${CDROM_ROOT}"/Italian ]] && cp -rv "${CDROM_ROOT}"/Italian cd1
fi
if use linguas_es
then
[[ -d "${CDROM_ROOT}"/Spanish ]] && cp -rv "${CDROM_ROOT}"/Spanish cd1
fi
if use linguas_de
then
[[ -d "${CDROM_ROOT}"/German ]] && cp -rv "${CDROM_ROOT}"/German cd1
fi
einfo "Copying CD2 files..."
mkdir -p "${S}"/cd2
cp -rv "${CDROM_ROOT}"/CD2/* cd2
einfo "Copying CD3 files..."
mkdir -p "${S}"/cd3
cp -rv "${CDROM_ROOT}"/CD3/* cd3
einfo "Copying CD4 files..."
mkdir -p "${S}"/cd4
cp -rv "${CDROM_ROOT}"/CD4/* cd4
if use tob
then
mkdir -p "${S}"/shared-tob
cdrom_load_next_cd
einfo "Unpacking files..."
unshield -L -d shared-tob x "${CDROM_ROOT}"/data?.* || die "unpacking"
einfo "Copying CD5 (ToB) files..."
mkdir -p "${S}"/cd5
cp -rv "${CDROM_ROOT}"/CD5/* cd5
fi
;;
original_cd)
mkdir -p "${S}"/shared-soa
cd "${S}"
# We dont give the user the option to install SoU/HotU. While some
# people might complain about this, most newer NWN stuff requires
# them both anyway, so it makes no sense not to install them.
einfo "Unpacking files..."
unshield -L -d shared-soa x "${CDROM_ROOT}"/data?.* || die "unpacking"
# We have to adjust the files after unpacking the cab file.
mkdir -p "${S}"/cd1
einfo "Copying CD1 files..."
[[ -d "${CDROM_ROOT}"/English ]] && cp -rv "${CDROM_ROOT}"/English cd1
if use linguas_fr
then
[[ -d "${CDROM_ROOT}"/French ]] && cp -rv "${CDROM_ROOT}"/French cd1
fi
if use linguas_it
then
[[ -d "${CDROM_ROOT}"/Italian ]] && cp -rv "${CDROM_ROOT}"/Italian cd1
fi
if use linguas_es
then
[[ -d "${CDROM_ROOT}"/Spanish ]] && cp -rv "${CDROM_ROOT}"/Spanish cd1
fi
if use linguas_de
then
[[ -d "${CDROM_ROOT}"/German ]] && cp -rv "${CDROM_ROOT}"/German cd1
fi
cdrom_load_next_cd
einfo "Copying CD2 files..."
mkdir -p "${S}"/cd2
cp -rv "${CDROM_ROOT}"/CD2/* cd2
cdrom_load_next_cd
einfo "Copying CD3 files..."
mkdir -p "${S}"/cd3
cp -rv "${CDROM_ROOT}"/CD3/* cd3
cdrom_load_next_cd
einfo "Copying CD4 files..."
mkdir -p "${S}"/cd4
cp -rv "${CDROM_ROOT}"/CD4/* cd4
if use tob
then
mkdir -p "${S}"/shared-tob
cdrom_load_next_cd
einfo "Unpacking files..."
unshield -L -d shared-tob x "${CDROM_ROOT}"/data?.* || die "unpacking"
einfo "Copying CD5 (ToB) files..."
mkdir -p "${S}"/cd5
cp -rv "${CDROM_ROOT}"/CD5/* cd5
fi
;;
esac
# We unpack this for all media sets.
unpack pathconvert.tar.gz
}
src_compile() {
cd "${S}"/pathconvert
make -C lib
cp lib/libpathconvert.a .
cd "${S}"/pathconvert/lndir
xmkmf
make lndir
}
src_install() {
mkdir -p "${Ddir}/Shared"
mv -fv "${S}"/shared-soa/hd0_cab/* "${Ddir}/Shared"
mkdir -p "${Ddir}"/Shared/cache
mv -fv "${S}"/shared-soa/hd0_cache/* "${Ddir}"/Shared/cache
mkdir -p "${Ddir}"/Shared/data
mv -fv "${S}"/shared-soa/hd0_data/* "${Ddir}"/Shared/data
mkdir -p "${Ddir}"/Shared/music
mv -fv "${S}"/shared-soa/hd0_music/* "${Ddir}"/Shared/music
mkdir -p "${Ddir}"/Shared/override
mv -fv "${S}"/shared-soa/hd0_override/* "${Ddir}"/Shared/override
mkdir -p "${Ddir}"/Shared/scripts
mv -fv "${S}"/shared-soa/hd0_scripts/* "${Ddir}"/Shared/scripts
mv -fv "${S}"/patches/soa-en/main/override/* "${Ddir}"/Shared/override
mkdir -p "${Ddir}"/cd1/English/data
mv -fv "${S}"/cd1/English/[Dd]ata/* "${Ddir}"/cd1/English/data
mkdir -p "${Ddir}"/cd1/English/movies
mv -fv "${S}"/cd1/English/[Mm]ovies/* "${Ddir}"/cd1/English/movies
mkdir -p "${Ddir}/Shared-English"
[[ -d "${S}"/shared-soa/hd0_cab_english ]] && mv -fv "${S}"/shared-soa/hd0_cab_english/* "${Ddir}"/Shared-English
[[ -d "${S}"/shared-soa/_support_english_os_independent_files ]] && mv -fv "${S}"/shared-soa/_support_english_os_independent_files/* "${Ddir}"/Shared-English
[[ -d "${S}"/patches/soa-en/english_files ]] && mv -fv "${S}"/patches/soa-en/english_files/* "${Ddir}"/Shared-English
mkdir -p "${Ddir}/Shared-English/sounds"
[[ -d "${S}"/shared-soa/hd0_sound_english ]] && mv -fv "${S}"/shared-soa/hd0_sound_english/* "${Ddir}"/Shared-English/sounds
mkdir -p "${Ddir}/Shared-English/characters"
[[ -d "${S}"/shared-soa/hd0_characters_english ]] && mv -fv "${S}"/shared-soa/hd0_characters_english/* "${Ddir}"/Shared-English/characters
mkdir -p "${Ddir}/Shared-English/data"
[[ -d "${S}"/shared-soa/hd0_data_english ]] && mv -fv "${S}"/shared-soa/hd0_data_english/* "${Ddir}"/Shared-English/data
if use tob
then
mv -fv "${S}"/shared-tob/hd0/* "${Ddir}/Shared"
mv -fv "${S}"/shared-tob/minimum_25_data/* "${Ddir}"/Shared/data
mv -fv "${S}"/shared-tob/hd025music/* "${Ddir}"/Shared/music
mv -fv "${S}"/shared-tob/hd0_override/* "${Ddir}"/Shared/override
mv -fv "${S}"/patches/tob-en/main/override/* "${Ddir}"/Shared/override
[[ -d "${S}"/patches/tob-eu/language_independent/override ]] && mv -fv "${S}"/patches/tob-eu/language_independent/override/* "${Ddir}"/Shared/override
[[ -d "${S}"/shared-tob/_support_language_independent_os_independent_files ]] && mv -fv "${S}"/shared-tob/_support_language_independent_os_independent_files/* "${Ddir}"/Shared
[[ -d "${S}"/shared-tob/hd0_english ]] && mv -fv "${S}"/shared-tob/hd0_english/* "${Ddir}"/Shared-English
[[ -d "${S}"/shared-tob/_support_english_os_independent_files ]] && mv -fv "${S}"/shared-tob/_support_english_os_independent_files/* "${Ddir}"/Shared-English
[[ -d "${S}"/patches/tob-en/main ]] && mv -fv "${S}"/patches/tob-en/main/*.* "${Ddir}"/Shared-English
[[ -d "${S}"/shared-tob/minimum_25_sound_english ]] && mv -fv "${S}"/shared-tob/minimum_25_sound_english/* "${Ddir}"/Shared-English/sounds
[[ -d "${S}"/shared-tob/minimum_25_characters_english ]] && mv -fv "${S}"/shared-tob/minimum_25_characters_english/* "${Ddir}"/Shared-English/characters
[[ -d "${S}"/shared-tob/minimum_25_data_english ]] && mv -fv "${S}"/shared-tob/minimum_25_data_english/* "${Ddir}"/Shared-English/data
fi
if use linguas_fr
then
mv -fv "${S}"/patches/soa-eu/main/override/* "${Ddir}"/Shared/override
mkdir -p "${Ddir}"/cd1/French/data
mv -fv "${S}"/cd1/French/[Dd]ata/* "${Ddir}"/cd1/French/data
mkdir -p "${Ddir}"/cd1/French/movies
mv -fv "${S}"/cd1/French/[Mm]ovies/* "${Ddir}"/cd1/French/movies
mkdir -p "${Ddir}/Shared-French"
[[ -d "${S}"/shared-soa/hd0_cab_french ]] && mv -fv "${S}"/shared-soa/hd0_cab_french/* "${Ddir}"/Shared-French
[[ -d "${S}"/shared-soa/_support_french_\(standard\)_os_independent_files ]] && mv -fv "${S}"/shared-soa/_support_french_\(standard\)_os_independent_files/* "${Ddir}"/Shared-French
[[ -d "${S}"/patches/soa-eu/french ]] && mv -fv "${S}"/patches/soa-eu/french/* "${Ddir}"/Shared-French
mkdir -p "${Ddir}/Shared-French/sounds"
[[ -d "${S}"/shared-soa/hd0_sound_french ]] && mv -fv "${S}"/shared-soa/hd0_sound_french/* "${Ddir}"/Shared-French/sounds
mkdir -p "${Ddir}/Shared-French/characters"
[[ -d "${S}"/shared-soa/hd0_characters_french ]] && mv -fv "${S}"/shared-soa/hd0_characters_french/* "${Ddir}"/Shared-French/characters
mkdir -p "${Ddir}/Shared-French/data"
[[ -d "${S}"/shared-soa/hd0_data_french ]] && mv -fv "${S}"/shared-soa/hd0_data_french/* "${Ddir}"/Shared-French/data
if use tob
then
[[ -d "${S}"/shared-tob/hd0_french ]] && mv -fv "${S}"/shared-tob/hd0_french/* "${Ddir}"/Shared-French
[[ -d "${S}"/shared-tob/_support_french_\(standard\)_os_independent_files ]] && mv -fv "${S}"/shared-tob/_support_french_\(standard\)_os_independent_files/* "${Ddir}"/Shared-French
[[ -d "${S}"/patches/tob-eu/french ]] && mv -fv "${S}"/patches/tob-eu/french/*.* "${Ddir}"/Shared-French
[[ -d "${S}"/shared-tob/minimum_25_sound_french ]] && mv -fv "${S}"/shared-tob/minimum_25_sound_french/* "${Ddir}"/Shared-French/sounds
[[ -d "${S}"/shared-tob/minimum_25_characters_french ]] && mv -fv "${S}"/shared-tob/minimum_25_characters_french/* "${Ddir}"/Shared-French/characters
[[ -d "${S}"/shared-tob/minimum_25_data_french ]] && mv -fv "${S}"/shared-tob/minimum_25_data_french/* "${Ddir}"/Shared-French/data
fi
fi
if use linguas_it
then
mv -fv "${S}"/patches/soa-eu/main/override/* "${Ddir}"/Shared/override
mkdir -p "${Ddir}"/cd1/Italian/data
mv -fv "${S}"/cd1/Italian/[Dd]ata/* "${Ddir}"/cd1/Italian/data
mkdir -p "${Ddir}"/cd1/Italian/movies
mv -fv "${S}"/cd1/Italian/[Mm]ovies/* "${Ddir}"/cd1/Italian/movies
mkdir -p "${Ddir}/Shared-Italian"
[[ -d "${S}"/shared-soa/hd0_cab_italian ]] && mv -fv "${S}"/shared-soa/hd0_cab_italian/* "${Ddir}"/Shared-Italian
[[ -d "${S}"/shared-soa/_support_italian_os_independent_files ]] && mv -fv "${S}"/shared-soa/_support_italian_os_independent_files/* "${Ddir}"/Shared-Italian
[[ -d "${S}"/patches/soa-eu/italian ]] && mv -fv "${S}"/patches/soa-eu/italian/* "${Ddir}"/Shared-Italian
mkdir -p "${Ddir}/Shared-Italian/sounds"
[[ -d "${S}"/shared-soa/hd0_sound_italian ]] && mv -fv "${S}"/shared-soa/hd0_sound_italian/* "${Ddir}"/Shared-Italian/sounds
mkdir -p "${Ddir}/Shared-Italian/characters"
[[ -d "${S}"/shared-soa/hd0_characters_italian ]] && mv -fv "${S}"/shared-soa/hd0_characters_italian/* "${Ddir}"/Shared-Italian/characters
mkdir -p "${Ddir}/Shared-Italian/data"
[[ -d "${S}"/shared-soa/hd0_data_italian ]] && mv -fv "${S}"/shared-soa/hd0_data_italian/* "${Ddir}"/Shared-Italian/data
if use tob
then
[[ -d "${S}"/shared-tob/hd0_italian ]] && mv -fv "${S}"/shared-tob/hd0_italian/* "${Ddir}"/Shared-Italian
[[ -d "${S}"/shared-tob/_support_italian_os_independent_files ]] && mv -fv "${S}"/shared-tob/_support_italian_os_independent_files/* "${Ddir}"/Shared-Italian
[[ -d "${S}"/patches/tob-eu/italian ]] && mv -fv "${S}"/patches/tob-eu/italian/*.* "${Ddir}"/Shared-Italian
[[ -d "${S}"/shared-tob/minimum_25_sound_italian ]] && mv -fv "${S}"/shared-tob/minimum_25_sound_italian/* "${Ddir}"/Shared-Italian/sounds
[[ -d "${S}"/shared-tob/minimum_25_characters_italian ]] && mv -fv "${S}"/shared-tob/minimum_25_characters_italian/* "${Ddir}"/Shared-Italian/characters
[[ -d "${S}"/shared-tob/minimum_25_data_italian ]] && mv -fv "${S}"/shared-tob/minimum_25_data_italian/* "${Ddir}"/Shared-Italian/data
fi
fi
if use linguas_es
then
mv -fv "${S}"/patches/soa-eu/main/override/* "${Ddir}"/Shared/override
mkdir -p "${Ddir}"/cd1/Spanish/data
mv -fv "${S}"/cd1/Spanish/[Dd]ata/* "${Ddir}"/cd1/Spanish/data
mkdir -p "${Ddir}"/cd1/Spanish/movies
mv -fv "${S}"/cd1/Spanish/[Mm]ovies/* "${Ddir}"/cd1/Spanish/movies
mkdir -p "${Ddir}/Shared-Spanish"
[[ -d "${S}"/shared-soa/hd0_cab_spanish ]] && mv -fv "${S}"/shared-soa/hd0_cab_spanish/* "${Ddir}"/Shared-Spanish
[[ -d "${S}"/shared-soa/_support_spanish_os_independent_files ]] && mv -fv "${S}"/shared-soa/_support_spanish_os_independent_files/* "${Ddir}"/Shared-Spanish
[[ -d "${S}"/patches/soa-eu/spanish ]] && mv -fv "${S}"/patches/soa-eu/spanish/* "${Ddir}"/Shared-Spanish
mkdir -p "${Ddir}/Shared-Spanish/sounds"
[[ -d "${S}"/shared-soa/hd0_sound_spanish ]] && mv -fv "${S}"/shared-soa/hd0_sound_spanish/* "${Ddir}"/Shared-Spanish/sounds
mkdir -p "${Ddir}/Shared-Spanish/characters"
[[ -d "${S}"/shared-soa/hd0_characters_spanish ]] && mv -fv "${S}"/shared-soa/hd0_characters_spanish/* "${Ddir}"/Shared-Spanish/characters
[[ -d "${S}"/patches/soa-eu/spanish/characters ]] && mv -fv "${S}"/patches/soa-eu/spanish/characters/* "${Ddir}"/Shared-Spanish/characters
mkdir -p "${Ddir}/Shared-Spanish/data"
[[ -d "${S}"/shared-soa/hd0_data_spanish ]] && mv -fv "${S}"/shared-soa/hd0_data_spanish/* "${Ddir}"/Shared-Spanish/data
if use tob
then
[[ -d "${S}"/shared-tob/hd0_spanish ]] && mv -fv "${S}"/shared-tob/hd0_spanish/* "${Ddir}"/Shared-Spanish
[[ -d "${S}"/shared-tob/_support_spanish_os_independent_files ]] && mv -fv "${S}"/shared-tob/_support_spanish_os_independent_files/* "${Ddir}"/Shared-Spanish
[[ -d "${S}"/patches/tob-eu/spanish ]] && mv -fv "${S}"/patches/tob-eu/spanish/*.* "${Ddir}"/Shared-Spanish
[[ -d "${S}"/shared-tob/minimum_25_sound_spanish ]] && mv -fv "${S}"/shared-tob/minimum_25_sound_spanish/* "${Ddir}"/Shared-Spanish/sounds
[[ -d "${S}"/shared-tob/minimum_25_characters_spanish ]] && mv -fv "${S}"/shared-tob/minimum_25_characters_spanish/* "${Ddir}"/Shared-Spanish/characters
[[ -d "${S}"/shared-tob/minimum_25_data_spanish ]] && mv -fv "${S}"/shared-tob/minimum_25_data_spanish/* "${Ddir}"/Shared-Spanish/data
fi
fi
if use linguas_de
then
mv -fv "${S}"/patches/soa-eu/main/override/* "${Ddir}"/Shared/override
mkdir -p "${Ddir}"/cd1/German/data
mv -fv "${S}"/cd1/German/[Dd]ata/* "${Ddir}"/cd1/German/data
mkdir -p "${Ddir}"/cd1/German/movies
mv -fv "${S}"/cd1/German/[Mm]ovies/* "${Ddir}"/cd1/German/movies
mkdir -p "${Ddir}/Shared-German"
[[ -d "${S}"/shared-soa/hd0_cab_german ]] && mv -fv "${S}"/shared-soa/hd0_cab_german/* "${Ddir}"/Shared-German
[[ -d "${S}"/shared-soa/_support_german_os_independent_files ]] && mv -fv "${S}"/shared-soa/_support_german_os_independent_files/* "${Ddir}"/Shared-German
[[ -d "${S}"/patches/soa-eu/german ]] && mv -fv "${S}"/patches/soa-eu/german/* "${Ddir}"/Shared-German
mkdir -p "${Ddir}/Shared-German/sounds"
[[ -d "${S}"/shared-soa/hd0_sound_german ]] && mv -fv "${S}"/shared-soa/hd0_sound_german/* "${Ddir}"/Shared-German/sounds
mkdir -p "${Ddir}/Shared-German/characters"
[[ -d "${S}"/shared-soa/hd0_characters_german ]] && mv -fv "${S}"/shared-soa/hd0_characters_german/* "${Ddir}"/Shared-German/characters
mkdir -p "${Ddir}/Shared-German/data"
[[ -d "${S}"/shared-soa/hd0_data_german ]] && mv -fv "${S}"/shared-soa/hd0_data_german/* "${Ddir}"/Shared-German/data
if use tob
then
[[ -d "${S}"/shared-tob/hd0_german ]] && mv -fv "${S}"/shared-tob/hd0_german/* "${Ddir}"/Shared-German
[[ -d "${S}"/shared-tob/_support_german_os_independent_files ]] && mv -fv "${S}"/shared-tob/_support_german_os_independent_files/* "${Ddir}"/Shared-German
[[ -d "${S}"/patches/tob-eu/german ]] && mv -fv "${S}"/patches/tob-eu/german/*.* "${Ddir}"/Shared-German
[[ -d "${S}"/shared-tob/minimum_25_sound_german ]] && mv -fv "${S}"/shared-tob/minimum_25_sound_german/* "${Ddir}"/Shared-German/sounds
[[ -d "${S}"/shared-tob/minimum_25_characters_german ]] && mv -fv "${S}"/shared-tob/minimum_25_characters_german/* "${Ddir}"/Shared-German/characters
[[ -d "${S}"/shared-tob/hd0_german/characters ]] && mv -fv "${S}"/shared-tob/hd0_german/characters/* "${Ddir}"/Shared-German/characters
[[ -d "${S}"/shared-tob/minimum_25_data_german ]] && mv -fv "${S}"/shared-tob/minimum_25_data_german/* "${Ddir}"/Shared-German/data
fi
fi
for d in cd2 cd3 cd4 cd5
do
if [[ -d ${d} ]]
then
mkdir -p "${Ddir}"/${d}/data
mv -fv "${S}"/${d}/[Dd]ata/AREA*.* "${Ddir}"/${d}/data
mv -fv "${S}"/${d}/[Dd]ata/*.* "${Ddir}"/Shared/data
mkdir -p "${Ddir}"/${d}/movies
mv -fv "${S}"/${d}/[Mm]ovies/*.* "${Ddir}"/${d}/movies
fi
done
if ! use videos
then
rm -rf "${S}"/movies/*
fi
cd "${Ddir}"
for d in cd1/English cd1/French cd1/Italian cd1/Spanish cd1/German cd2 cd3 cd4 cd5 Shared Shared-English Shared-French Shared-Italian Shared-Spanish Shared-German
do
if [[ -d ${d} ]]
then
( cd ${d}
for f in $(find . -name '*.*') ; do
lcf=$(echo ${f} | tr [:upper:] [:lower:])
if [[ ${f} != ${lcf} ]] && [[ -f ${f} ]]
then
mv ${f} ${lcf}
fi
done )
fi
done
find "${Ddir}" -iname "*.exe" -exec rm {} \; 2> /dev/null
find "${Ddir}" -iname "*.dll" -exec rm {} \; 2> /dev/null
find "${Ddir}" -iname "*.pdf" -exec rm {} \; 2> /dev/null
find "${Ddir}" -iname "*.url" -exec rm {} \; 2> /dev/null
cat > ${launcher} <<-EOF
#!/bin/bash
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# Automatically generated by ${CATEGORY}/${PF}
# Exec the BaldursGate${SLOT} script for the language chosen in
# LC_ALL/LC_MESSAGES/LANG (first found takes precedence, as in glibc)
L=\${LC_ALL}
L=\${L:-\${LC_MESSAGES}}
L=\${L:-\${LANG}}
[[ ! -d ~/.bioware/bg2/save ]] && mkdir -p ~/.bioware/bg2/save
if [[ -f ~/.bioware/bg2/GemRB.cfg ]]
then
exec gemrb -c ~/.bioware/bg2/GemRB.cfg
else
case \${L} in
EOF
mkdir -p "${Ddir}"/English
${LNDIR} "${Ddir}"/cd1/English English
${LNDIR} "${Ddir}"/Shared-English English
${LNDIR} "${Ddir}"/Shared English
echo "en*) exec cp ${dir}/English/GemRB.cfg ~/.bioware/bg2/GemRB.cfg;;" >> ${launcher}
sed -e "s!@DESTDIR@!${dir}!g" \
-e "s!@LANG@!English!g" \
-e "s!@LIBDIR@!$(get_libdir)!g" < ${FILESDIR}/GemRB${SLOT}.cfg > ${Ddir}/English/GemRB.cfg
if use linguas_fr
then
mkdir -p "${Ddir}"/French
${LNDIR} "${Ddir}"/cd1/French French
${LNDIR} "${Ddir}"/Shared-French French
${LNDIR} "${Ddir}"/Shared French
echo "fr*) exec cp ${dir}/French/GemRB.cfg ~/.bioware/bg2/GemRB.cfg;;" >> ${launcher}
sed -e "s!@DESTDIR@!${dir}!g" \
-e "s!@LANG@!French!g" \
-e "s!@LIBDIR@!$(get_libdir)!g" < ${FILESDIR}/GemRB${SLOT}.cfg > ${Ddir}/French/GemRB.cfg
fi
if use linguas_it
then
mkdir -p "${Ddir}"/Italian
${LNDIR} "${Ddir}"/cd1/Italian Italian
${LNDIR} "${Ddir}"/Shared-Italian Italian
${LNDIR} "${Ddir}"/Shared Italian
echo "it*) exec cp ${dir}/Italian/GemRB.cfg ~/.bioware/bg2/GemRB.cfg;;" >> ${launcher}
sed -e "s!@DESTDIR@!${dir}!g" \
-e "s!@LANG@!Italian!g" \
-e "s!@LIBDIR@!$(get_libdir)!g" < ${FILESDIR}/GemRB${SLOT}.cfg > ${Ddir}/Italian/GemRB.cfg
fi
if use linguas_es
then
mkdir -p "${Ddir}"/Spanish
${LNDIR} "${Ddir}"/cd1/Spanish Spanish
${LNDIR} "${Ddir}"/Shared-Spanish Spanish
${LNDIR} "${Ddir}"/Shared Spanish
echo "es*) exec cp ${dir}/Spanish/GemRB.cfg ~/.bioware/bg2/GemRB.cfg;;" >> ${launcher}
sed -e "s!@DESTDIR@!${dir}!g" \
-e "s!@LANG@!Spanish!g" \
-e "s!@LIBDIR@!$(get_libdir)!g" < ${FILESDIR}/GemRB${SLOT}.cfg > ${Ddir}/Spanish/GemRB.cfg
fi
if use linguas_de
then
mkdir -p "${Ddir}"/German
${LNDIR} "${Ddir}"/cd1/German German
${LNDIR} "${Ddir}"/Shared-German German
${LNDIR} "${Ddir}"/Shared German
echo "de*) exec cp ${dir}/German/GemRB.cfg ~/.bioware/bg2/GemRB.cfg;;" >> ${launcher}
sed -e "s!@DESTDIR@!${dir}!g" \
-e "s!@LANG@!German!g" \
-e "s!@LIBDIR@!$(get_libdir)!g" < ${FILESDIR}/GemRB${SLOT}.cfg > ${Ddir}/German/GemRB.cfg
fi
cat >> ${launcher} <<-EOF
*) exec cp ${dir}/English/GemRB.cfg ~/.bioware/bg2/GemRB.cfg;;
esac
exec gemrb -c ~/.bioware/bg2/GemRB.cfg
fi
EOF
newicon "${DISTDIR}"/Baldur-s-Gate-2-Shadows-of-Amn-2-128x128.png Baldur-s-Gate-2-Shadows-of-Amn.png
make_desktop_entry BaldursGate${SLOT} "Baldur's Gate II - Shadows of Amn ${PV}" Baldur-s-Gate-2-Shadows-of-Amn.png
if use tob
then
newicon "${DISTDIR}"/Baldur-s-Gate-2-Throne-of-Bhaal-2-128x128.png Baldur-s-Gate-2-Throne-of-Bhaal.png
make_desktop_entry BaldursGate${SLOT} "Baldur's Gate II - Throne of Bhaal ${PV}" Baldur-s-Gate-2-Throne-of-Bhaal.png
fi
dobin ${launcher}
prepgamesdirs
chmod g+rwX ${Ddir} || die "could not chmod"
# die
}