2013-09-15 22:28:08

How to package Battle Chess (and GOG dosbox games)

I own a lot of games from GOG. Today I played Battle Chess again and I think to myself: "Why I'm running CrossOver to run dosbox.exe to run BC.EXE when I can run dosbox natively in Fedora?"

So I tried to investigate how this can be done. I usually document this stuff. At least for myself. So I created spec file (because this is best documentation tool for this purpose) and created rpm package. Since I could not publish results directly (because game is not free) I will just publish those steps I made, so you can do it as well.

If you never packaged software before - run:

sudo yum install rpmdevtools rpm-build
rpmdev-setuptree

Then run:

cd ~/.cxgames/Battle_chess_2/drive_c/GOG\ Games/Battle\ Chess\ Special\ Edition/Battle\ Chess
tar czvf dosbox-bc.tar.gz *
mv dosbox-bc.tar.gz ~/rpmbuild/SOURCES/

Then open file ~/rpmbuild/SPECS/battle-chess.spec and put there:

Name:           battle-chess
Version:        1994
Release:        1%{?dist}
Summary:        Battle Chess Special Edition

Group:          Amusements/Games
License:        Proprietary
URL:            https://secure.gog.com/game/battle_chess_special_edition
Source0:        dosbox-bc.tar.gz
BuildArch:      noarch

Requires:       dosbox

%description
The most challenging game on Earth comes to life in Battle Chess. An entire
medieval world at war is reflected on the checkered field.

Everyone who's ever had a knight take a pawn, has seen that capture as more
than one piece replacing another on the board. In players' minds, the bold
knight, resplendent in his armor of silver or ebon, sallies forth and slays
the foul foot soldier. Combat, mortal combat, lies in the heart and soul of
chess, but this aspect of it could only live in the mind's eye – until now!

It took 2000 years for someone to make chess better! 

%prep
%setup -q -c


%build
#nothing to do here

%install
install -d %{buildroot}%{_datarootdir}/games/battle-chess
install -d %{buildroot}%{_bindir}/

cp -a * %{buildroot}%{_datarootdir}/games/battle-chess/

# we will overwrite original dosboxBC_single.conf with new path for mount
cat <<EOF > %{buildroot}%{_datarootdir}/games/battle-chess/dosboxBC_single.conf
[ipx]
# ipx -- Enable ipx over UDP/IP emulation.

ipx=false

[autoexec]
# Lines in this section will be run at startup.
mount C "%{_datarootdir}/games/battle-chess/"
c:
cls
bc
exit
EOF

# the command line is extacted from *.lnk provided by GOG
cat <<EOF >  %{buildroot}%{_bindir}/battle-chess
#!/usr/bin/bash
/usr/bin/dosbox -conf "%{_datarootdir}/games/battle-chess/dosboxBC.conf" -conf "%{_datarootdir}/games/battle-chess/dosboxBC_single.conf" -noconsole  -c exit
EOF
chmod a+x %{buildroot}%{_bindir}/battle-chess

%files
%{_bindir}/battle-chess
%{_datarootdir}/games/battle-chess

%changelog

and then you run:

rpmbuild -ba ~/rpmbuild/SPEC/battle-chess.spec

And you are done, just install the package:

sudo yum localinstall /home/mirek/rpmbuild/RPMS/noarch/battle-chess-1-1.fc19.noarch.rpm

And now you can run the game:

battle-chess

You can easily apply this steps for every dosbox game from GOG.


Posted by Miroslav Suchý | Permanent link
Comments
comments powered by Disqus