1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 OFFICIAL_PATCH="moo2v131.zip"
10 LB_PATCH="Moo2v140b24.zip"
12 DESCRIPTION="A classic 4X turn-based space strategy game"
13 HOMEPAGE="http://lordbrazen.blogspot.com"
14 SRC_URI="ftp://ftp.infogrames.net/patches/moo2/${OFFICIAL_PATCH}
15 lordbrazen? ( http://www.spheriumnorth.com/blog-images/${LB_PATCH} )"
17 LICENSE="GPL-2 Hasbro-EULA"
19 KEYWORDS="~amd64 ~x86"
20 IUSE="nocd lordbrazen"
22 DEPEND="|| ( media-gfx/graphicsmagick media-gfx/imagemagick )"
23 RDEPEND="games-emulation/dosbox"
25 destDir="${GAMES_PREFIX_OPT}/${PN}"
26 fullGameName="Master of Orion II: Battle at Antares"
28 Unfortunately, several differing versions of the Master of Orion II: Battle at
29 Antares CD-ROM have been released and this ebuild does not have specific
30 support yours and may fail. Please help out! Visit
31 http://bugs.gentoo.org/show_bug.cgi?id=341859 and post the result of this
32 ebuild along with a full directory listing of your CD-ROM, the contents of the
33 the README.TXT file and any other info you think might be helpful.
38 cdrom_get_cds ORION95.EXE
40 # Workaround to bug #342269
41 test -e "${CDROM_ROOT}/ORION95.EXE" ||
42 die "CD_ROOT does not point to the ${fullGameName} CD"
44 # Try to determine Which version of the CD-ROM we have. These tests are
45 # far from perfect, but will work on the two currently known versions.
46 if [[ -e "${CDROM_ROOT}/Patch13.lbx" ]]; then
47 # Hasboro v1.31 minus DOS support
49 elif [[ -e "${CDROM_ROOT}/INSTALL.EXE" ]]; then
50 # Original MicroProse v1.2
53 # There may be others out there
55 ewarn "${unsupportedMsg}"
62 sed "s:__MOO2DIR__:${destDir}:g" "${FILESDIR}/${PVR}/moo2" > moo2 ||
65 mkdir -p patches docs || die
68 # First, unpack the MicroProse official 1.31 patch
69 unpack ${OFFICIAL_PATCH} || die
71 # Add unofficial patch if use flag set, although it has to be run in dosbox,
72 # so it will actually run the first time the user lanuches the game.
73 if use lordbrazen; then
74 unpack ${LB_PATCH} || die
78 # Move docs out of install dir
79 # Readme.txt from 1.31 patch
80 mv patches/Readme.txt docs/MicroProse-1.31-Readme.txt || die "mv failed"
82 # Docs in unofficial patch
83 if use lordbrazen; then
84 mv patches/{MOO2v140_readme.txt,ChangeLog.txt} docs || die "mv failed"
87 # Find an icon and convert it to png
90 # Original MicroProse icon
91 if [ -e ORION2.ICO ]; then
94 # The only icon file on the Hasboro CD
95 elif [ -e SIMTEX.ICO ]; then
98 # Can we find any icon?
100 srcIcon="$(ls -1 *.ICO *.ico 2>/dev/null | awk '{print $1}')"
101 test -s "$srcIcon" || die "Can't find an icon on your CD-ROM to use."
104 convert "${srcIcon}" "${WORKDIR}/${PN}.png" || die "convert failed"
111 dogamesbin "${WORKDIR}/moo2" || die
113 # Supporting Bash function libs & default config file
115 doins "${FILESDIR}/${PVR}/"{moo2rc,utils.sh,backup.sh} || die
117 # Copy CD or create symlink. Having either a "cdfiles" directory or a
118 # "cdlink" symlink in addition to a "cd" symlink that points to one of them
119 # is really kinda stupid, but it's a work-around for problems that occur
120 # when remerging and changing the nocd option without unmerging first. If
121 # you remove this mechanism, retest! (portage may fix it one day)
125 # Copy the CD to disk
126 insinto "${destDir}/cdfiles"
127 pushd "${CDROM_ROOT}" || die
128 ebegin "Copying CD-ROM files to disk"
129 # ebuild complains about directx drivers, so omit them
130 doins -r $(ls -1 | egrep -v 'DIRECTX') || die
136 # Create symlink to the CD. If the user has more than one CD-ROM drive
137 # or mount point, this can break later, but they can just re-install or
139 dosym "${CDROM_ROOT}" "${destDir}/cdlink" || die
142 # Create universal symlink for CD
143 dosym "${destDir}/${cdDir}" "${destDir}/cd" || die
145 # Simulate DOS INSTALL.EXE.
146 insinto "${destDir}/MPS/ORION2"
148 # If USE=nocd, we use symlinks instead of copying files to save space. Hard
149 # links would work better, but dohard doesn't appear to work if the target
150 # does not already exist outside of the sandbox. (bug in dohard or intended
153 for f in $(cat "${FILESDIR}/installList.txt"); do
154 dosym "${destDir}/cd/${f}" "${destDir}/MPS/ORION2/$f" || die
157 pushd "${CDROM_ROOT}" || die
158 # This step can be slow
159 ebegin "Simulating DOS INSTALL.EXE program"
160 doins $(cat "${FILESDIR}/installList.txt") || die
166 doins patches/* || die
168 # Install pre-configured .INI files (hardware is simulated, so it's all the
170 doins "${FILESDIR}/"*.INI || die
172 # Icons & menu entries
173 doicon "${WORKDIR}/${PN}.png" || die
174 make_desktop_entry "${PN}" "${fullGameName}" || die
177 dodoc "${WORKDIR}/docs/"* || die
179 # FAQ covering both official and unofficial patched versions.
180 dodoc "${FILESDIR}/${PVR}/FAQ.html" || die
182 # README.TXT on all CD-ROMs
183 dodoc "${CDROM_ROOT}/README.TXT" || die
185 # Manual on Hasboro CD-ROM
186 if [[ $cdVersion == H1.31 ]]; then
187 dodoc "${CDROM_ROOT}/Manual/MOO2manual.pdf" || die
195 A user-level install will be performed the 1st time you run the game. To
196 change your startup options, edit your ~/.moo2/moo2rc file. See
197 file:///usr/share/doc/${PF}/FAQ.html for command-line options.
198 To change your dosbox environment, see the dosbox man page and edit