Package fheroes2: Specfile

Name: fheroes2-data
Version: 1996demo
#Version: 1996dos
#Version: 1996buka
#Version: 1996gog
#Version: 1996gold
Release: alt1
Summary: game data for fheroes2
License: Non-free
Group: Games/Strategy
BuildArch: noarch
BuildRequires: unzip

Source: h2demo.zip
#Source: heroes2-data-gold.zip
#Source: heroes2-data-buka.zip

%description
game data for fheroes2 (Heroes of the Might and Magic II free engine)

%prep
%setup -c -n %name

%build
# DATA MAPS are required
# ANIM (dos,gog) or MUSIC (gold) are optional
# ANIM2 (buka) are optional

if [ ! -d DATA -a ! -d Data -a ! -d data -o ! -d MAPS -a ! -d Maps -a ! -d maps ]; then
    echo "Invalid source: expected ./DATA/ and ./MAPS/ or ./data/ and ./maps/"
    exit 1
fi

%install
mkdir -p %buildroot%_gamesdatadir/fheroes2/
cp -r -f -t %buildroot%_gamesdatadir/fheroes2/ anim2 anim data maps music ||:
for resdir_upcase in ANIM2 ANIM DATA MAPS Anim2 Anim Data Maps MUSIC Music; do
    if [ -d $resdir_upcase ]; then
	lcasename=$(echo $resdir_upcase | tr '[:upper:]' '[:lower:]')
	mkdir -p %buildroot%_gamesdatadir/fheroes2/$lcasename
	cp -f $resdir_upcase/* %buildroot%_gamesdatadir/fheroes2/$lcasename/
    fi
done

%files
%_gamesdatadir/fheroes2

%changelog
* Sat Aug 08 2020 Igor Vlasenko <viy@altlinux.ru> 1996demo-alt1
- music support