1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
7 inherit cdrom estack eutils
9 # Not possible to apply official 1.2 patch under Linux. A Gentoo user
10 # created Xdelta patches and the DXX-Rebirth project kindly hosted them.
11 MY_PATCH="http://www.dxx-rebirth.com/download/dxx/misc/d2xptch12.tgz"
14 MY_EXE="setup_descent_2_1.1_(16596).exe"
16 DESCRIPTION="Data files for Descent 2"
17 HOMEPAGE="http://www.interplay.com/games/descent.php"
18 SRC_URI="cdinstall? ( ${MY_PATCH} )
19 !cdinstall? ( ${MY_EXE} )"
20 LICENSE="descent-data"
22 KEYWORDS="~amd64 ~x86"
24 RESTRICT="bindist !cdinstall? ( fetch )"
26 # <d2x-0.2.5-r3 may include the data.
27 RDEPEND="!<games-action/d2x-0.2.5-r3
28 !games-action/descent2-demodata"
41 elog "You must place a copy of, or symlink to, the GOG setup package in your"
42 elog "distfiles directory."
44 elog "If you wish to install from CD-ROM instead, please enable the cdinstall flag."
48 if use cdinstall; then
50 cdrom_get_cds d2data/descent2.sow:descent2.hog
54 einfo "Found Descent 2 CD"
55 unarj e "${CDROM_ABSMATCH}" || die ;;
57 einfo "Found Descent 2 installation"
58 cd "${CDROM_ABSMATCH%/*}" || die ;;
61 einfo "Unpacking ${MY_EXE}. This will take a while..."
62 innoextract -e -s -p1 -L -I app -d gog "${DISTDIR}/${MY_EXE}" || die
63 cd "${WORKDIR}/gog/app" || die
66 eshopts_push -s globstar nocaseglob nullglob
70 # d2{-2plyr,chaos}.* into data/missions
71 # *.dem into data/demos
72 # Documentation into doc
74 # Exclude Vertigo files
80 --xform='s:.*:\L\0:x' \
81 --xform='s:^d2(-2plyr|chaos)\.:data/missions/\0:x' \
82 --xform='s:.*\.dem$:data/demos/\0:x' \
83 --xform='s:.*\.(pdf|txt)$:doc/\0:x' \
84 --xform='s:^[^/]+$:data/\0:x' \
86 --exclude='hoard.ham' \
88 --exclude="$(use doc || echo '*.pdf')" \
89 --exclude="$(use videos || echo '*.mvl')" \
90 *.{txt,pdf} *-h.mvl **/*.{ham,hog,mn2,pig,s11,s22} \
91 | tar x -C "${WORKDIR}"
98 # Patch to 1.2 if necessary
99 if use cdinstall; then
100 if [[ $(md5sum data/descent2.ham) != 7f30c3d7d4087b8584b49012a53ce022* ]]; then
102 for i in *.xdelta; do
103 xdelta3 -d -s data/"${i%.*}" "${i}" data/"${i%.*}".new || die
104 mv data/"${i%.*}"{.new,} || die
113 insinto /usr/share/games/d2x
115 [[ -d doc ]] && dodoc doc/*
119 elog "A client is needed to run the game, e.g. games-action/dxx-rebirth."