1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils games cdrom
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} )
16 http://ompldr.org/vOWptOA/FAQ-${PV}.html"
18 LICENSE="GPL-2 Hasbro-EULA"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="lordbrazen nocd"
23 DEPEND="|| ( media-gfx/graphicsmagick media-gfx/imagemagick )"
24 RDEPEND="games-emulation/dosbox"
26 destDir="${GAMES_PREFIX_OPT}/${PN}"
27 fullGameName="Master of Orion II: Battle at Antares"
29 Unfortunately, several differing versions of the Master of Orion II: Battle at
30 Antares CD-ROM have been released and this ebuild does not have specific
31 support yours and may fail. Please help out! Visit
32 http://bugs.gentoo.org/show_bug.cgi?id=341859 and post the result of this
33 ebuild along with a full directory listing of your CD-ROM, the contents of the
34 the README.TXT file and any other info you think might be helpful.
39 cdrom_get_cds ORION95.EXE
41 # Workaround to bug #342269
42 test -e "${CDROM_ROOT}/ORION95.EXE" ||
43 die "CD_ROOT does not point to the ${fullGameName} CD"
45 # Try to determine Which version of the CD-ROM we have. These tests are
46 # far from perfect, but will work on the two currently known versions.
47 if [[ -e "${CDROM_ROOT}/Patch13.lbx" ]]; then
48 # Hasboro v1.31 minus DOS support
50 elif [[ -e "${CDROM_ROOT}/INSTALL.EXE" ]]; then
51 # Original MicroProse v1.2
54 # There may be others out there
56 ewarn "${unsupportedMsg}"
63 sed "s:__MOO2DIR__:${destDir}:g" "${FILESDIR}/${PVR}/moo2" > moo2 ||
66 mkdir -p patches docs || die
69 # First, unpack the MicroProse official 1.31 patch
70 unpack ${OFFICIAL_PATCH} || die
72 # Add unofficial patch if use flag set, although it has to be run in dosbox,
73 # so it will actually run the first time the user lanuches the game.
74 if use lordbrazen; then
75 unpack ${LB_PATCH} || die
79 # Move docs out of install dir
80 # Readme.txt from 1.31 patch
81 mv patches/Readme.txt docs/MicroProse-1.31-Readme.txt || die "mv failed"
83 # Docs in unofficial patch
84 if use lordbrazen; then
85 mv patches/{MOO2v140_readme.txt,ChangeLog.txt} docs || die "mv failed"
88 # Find an icon and convert it to png
91 # Original MicroProse icon
92 if [ -e ORION2.ICO ]; then
95 # The only icon file on the Hasboro CD
96 elif [ -e SIMTEX.ICO ]; then
99 # Can we find any icon?
101 srcIcon="$(ls -1 *.ICO *.ico 2>/dev/null | awk '{print $1}')"
102 test -s "$srcIcon" || die "Can't find an icon on your CD-ROM to use."
105 convert "${srcIcon}" "${WORKDIR}/${PN}.png" || die "convert failed"
112 dogamesbin "${WORKDIR}/moo2" || die
114 # Supporting Bash function libs & default config file
116 doins "${FILESDIR}/${PVR}/"{moo2rc,utils.sh,backup.sh} || die
118 # Copy CD or create symlink. Having either a "cdfiles" directory or a
119 # "cdlink" symlink in addition to a "cd" symlink that points to one of them
120 # is really kinda stupid, but it's a work-around for problems that occur
121 # when remerging and changing the nocd option without unmerging first. If
122 # you remove this mechanism, retest! (portage may fix it one day)
126 # Copy the CD to disk
127 insinto "${destDir}/cdfiles"
128 pushd "${CDROM_ROOT}" || die
129 ebegin "Copying CD-ROM files to disk"
130 # ebuild complains about directx drivers, so omit them
131 doins -r $(ls -1 | egrep -v 'DIRECTX') || die
137 # Create symlink to the CD. If the user has more than one CD-ROM drive
138 # or mount point, this can break later, but they can just re-install or
140 dosym "${CDROM_ROOT}" "${destDir}/cdlink" || die
143 # Create universal symlink for CD
144 dosym "${destDir}/${cdDir}" "${destDir}/cd" || die
146 # Simulate DOS INSTALL.EXE.
147 insinto "${destDir}/MPS/ORION2"
149 # If USE=nocd, we use symlinks instead of copying files to save space. Hard
150 # links would work better, but dohard doesn't appear to work if the target
151 # does not already exist outside of the sandbox. (bug in dohard or intended
154 for f in $(cat "${FILESDIR}/installList.txt"); do
155 dosym "${destDir}/cd/${f}" "${destDir}/MPS/ORION2/$f" || die
158 pushd "${CDROM_ROOT}" || die
159 # This step can be slow
160 ebegin "Simulating DOS INSTALL.EXE program"
161 doins $(cat "${FILESDIR}/installList.txt") || die
167 doins patches/* || die
169 # Install pre-configured .INI files (hardware is simulated, so it's all the
171 doins "${FILESDIR}/"*.INI || die
173 # Icons & menu entries
174 doicon "${WORKDIR}/${PN}.png" || die
175 make_desktop_entry "${PN}" "${fullGameName}" || die
178 dodoc "${WORKDIR}/docs/"* || die
180 # FAQ covering both official and unofficial patched versions.
181 newdoc "${DISTDIR}/FAQ-${PV}.html" FAQ.html || die
183 # README.TXT on all CD-ROMs
184 dodoc "${CDROM_ROOT}/README.TXT" || die
186 # Manual on Hasboro CD-ROM
187 if [[ $cdVersion == H1.31 ]]; then
188 dodoc "${CDROM_ROOT}/Manual/MOO2manual.pdf" || die
196 A user-level install will be performed the 1st time you run the game. To
197 change your startup options, edit your ~/.moo2/moo2rc file. See
198 file:///usr/share/doc/${PF}/FAQ.html for command-line options.
199 To change your dosbox environment, see the dosbox man page and edit