| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  | # Copyright 2016 Julian Ospald <hasufell@posteo.de> | 
					
						
							|  |  |  | # Distributed under the terms of the GNU General Public License v2 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require desktop-utils gtk-icon-cache freedesktop-desktop freedesktop-mime | 
					
						
							|  |  |  | require alternatives | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export_exlib_phases src_unpack src_prepare src_configure src_compile src_install pkg_postinst pkg_postrm | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SUMMARY="A free RTS engine supporting games like Command & Conquer and Red Alert" | 
					
						
							|  |  |  | HOMEPAGE="http://www.openra.net/" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | LICENCES="GPL-3" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MYOPTIONS="
 | 
					
						
							|  |  |  |     ( providers: ijg-jpeg jpeg-turbo ) [[ number-selected = exactly-one ]] | 
					
						
							|  |  |  | "
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DEPENDENCIES="
 | 
					
						
							|  |  |  |     build: | 
					
						
							|  |  |  |         virtual/unzip | 
					
						
							|  |  |  |     build+run: | 
					
						
							|  |  |  |         dev-dotnet/libgdiplus | 
					
						
							|  |  |  |         dev-lang/mono[>=4.2] | 
					
						
							|  |  |  |         media-libs/SDL:2[X] | 
					
						
							|  |  |  |         media-libs/freetype:2 | 
					
						
							|  |  |  |         media-libs/openal | 
					
						
							|  |  |  |         x11-dri/mesa | 
					
						
							|  |  |  |         providers:ijg-jpeg? ( media-libs/jpeg:= ) | 
					
						
							|  |  |  |         providers:jpeg-turbo? ( media-libs/libjpeg-turbo ) | 
					
						
							|  |  |  |     run: | 
					
						
							| 
									
										
										
										
											2016-10-03 10:44:23 +00:00
										 |  |  |         !games-strategy/openra:0 [[ | 
					
						
							|  |  |  |             description = [ File conflict with new SLOT layout ] | 
					
						
							|  |  |  |             resolution = [ uninstall-blocked-after ] | 
					
						
							|  |  |  |         ]] | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  |         x11-apps/xdg-utils | 
					
						
							|  |  |  |     suggestion: | 
					
						
							|  |  |  |         gnome-desktop/zenity [[ description = [ Graphical error dialogs ] ]] | 
					
						
							|  |  |  | "
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WORK=${WORKBASE}/OpenRA-${SLOT}-${PV} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MV_FILES=( | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |     /usr/share/applications/openra-cnc.desktop | 
					
						
							|  |  |  |     /usr/share/applications/openra-ra.desktop | 
					
						
							|  |  |  |     /usr/share/applications/openra-d2k.desktop | 
					
						
							|  |  |  |     /usr/share/applications/openra-cnc-join-servers.desktop | 
					
						
							|  |  |  |     /usr/share/applications/openra-ra-join-servers.desktop | 
					
						
							|  |  |  |     /usr/share/applications/openra-d2k-join-servers.desktop | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/128x128/apps/openra-cnc.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/16x16/apps/openra-cnc.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/32x32/apps/openra-cnc.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/48x48/apps/openra-cnc.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/64x64/apps/openra-cnc.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/scalable/apps/openra-cnc.svg | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/16x16/apps/openra-ra.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/32x32/apps/openra-ra.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/48x48/apps/openra-ra.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/64x64/apps/openra-ra.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/scalable/apps/openra-ra.svg | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/16x16/apps/openra-d2k.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/32x32/apps/openra-d2k.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/48x48/apps/openra-d2k.png | 
					
						
							|  |  |  |     /usr/share/icons/hicolor/64x64/apps/openra-d2k.png | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_src_unpack() { | 
					
						
							|  |  |  |     unpack openra-${SLOT}-${PV}.tar.gz | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # this is pure crapshit, but it will successfully die | 
					
						
							|  |  |  |     # if upstream has added/changed files | 
					
						
							|  |  |  |     edo cd "${WORK}"/thirdparty | 
					
						
							|  |  |  |     edo sed -i \
 | 
					
						
							|  |  |  |         -e 's/get()/furz()/' \
 | 
					
						
							|  |  |  |         -e 's|curl |: |' \
 | 
					
						
							|  |  |  |         fetch-thirdparty-deps.sh | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     edo mkdir "${WORK}"/thirdparty/download | 
					
						
							|  |  |  |     get() { | 
					
						
							|  |  |  |         # don't add dies here | 
					
						
							|  |  |  |         local archive="${1/./_}" | 
					
						
							|  |  |  |         local version="${2}" | 
					
						
							|  |  |  |         mkdir -p "${WORK}"/thirdparty/download/${1} | 
					
						
							|  |  |  |         unzip -o -qq "${FETCHEDDIR}"/${archive}-${version}.zip \
 | 
					
						
							|  |  |  |             -d "${WORK}"/thirdparty/download/${1} | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     export -f get | 
					
						
							|  |  |  |     edo ./fetch-thirdparty-deps.sh | 
					
						
							|  |  |  |     unset get | 
					
						
							|  |  |  |     edo cd "${WORK}"/thirdparty/download | 
					
						
							|  |  |  |     edo cp "${FETCHEDDIR}"/${SDL2CS##* } ./SDL2-CS.dll | 
					
						
							|  |  |  |     edo cp "${FETCHEDDIR}"/${Eluant##* } ./Eluant.dll | 
					
						
							|  |  |  |     edo cp "${FETCHEDDIR}"/${GEO_IP_DB##* } ./GeoLite2-Country.mmdb.gz | 
					
						
							|  |  |  |     edo cp "${FETCHEDDIR}"/${OpenAL_CS##* } ./OpenAL-CS.dll | 
					
						
							|  |  |  |     edo cp "${FETCHEDDIR}"/${OpenAL_CS_config##* } ./OpenAL-CS.dll.config | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_src_configure() { :; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_src_prepare() { | 
					
						
							|  |  |  |     # register game-version | 
					
						
							|  |  |  |     emake VERSION="${SLOT}-${PV}" version | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     edo sed \
 | 
					
						
							|  |  |  |         -e "s/@LIBLUA51@/liblua5.1.so/" \
 | 
					
						
							|  |  |  |         "${WORK}"/thirdparty/Eluant.dll.config.in > Eluant.dll.config | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     edo cd "${WORK}"/thirdparty/download | 
					
						
							|  |  |  |     edo cp *.dll *.dll.config GeoLite2-Country.mmdb.gz "${WORK}"/ | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_src_compile() { | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |     emake VERSION="${SLOT}-${PV}" core | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_src_install() { | 
					
						
							|  |  |  |     emake \
 | 
					
						
							|  |  |  |         datadir="/usr/share" \
 | 
					
						
							|  |  |  |         bindir="/usr/$(exhost --target)/bin" \
 | 
					
						
							|  |  |  |         libdir="/usr/$(exhost --target)/libexec" \
 | 
					
						
							|  |  |  |         gameinstalldir="/usr/$(exhost --target)/libexec/${PN}-${SLOT}" \
 | 
					
						
							|  |  |  |         VERSION="${SLOT}-${PV}" \
 | 
					
						
							|  |  |  |         DESTDIR="${IMAGE}" \
 | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |         install install-linux-scripts install-linux-mime \
 | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  |         install-linux-icons install-linux-desktop install-linux-appdata | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     exeinto /usr/$(exhost --target)/libexec/${PN}-${SLOT} | 
					
						
							|  |  |  |     doexe Eluant.dll.config | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # fix desktop files | 
					
						
							|  |  |  |     edo sed -i \
 | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |             -e "/^Name=/s#\$# (${SLOT})#" \
 | 
					
						
							|  |  |  |             -e "/^Exec=/s#\$#-${SLOT}#" \
 | 
					
						
							|  |  |  |             -e "/^Icon=/s#\$#-${SLOT}#" \
 | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  |             "${IMAGE%/}"/usr/share/applications/*.desktop | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # make sure slots don't have file collisions | 
					
						
							|  |  |  |     local i | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |     for i in /usr/$(exhost --target)/bin/openra-{ra,cnc,d2k} \
 | 
					
						
							|  |  |  |              /usr/$(exhost --target)/bin/openra-{ra,cnc,d2k}-server \
 | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  |              /usr/share/mime/packages/openra.xml \
 | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |              /usr/share/appdata/openra-{ra,cnc,d2k}.appdata.xml | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  |     do | 
					
						
							|  |  |  |         edo mv "${IMAGE%/}"${i} "${IMAGE%/}"${i}-${SLOT} | 
					
						
							|  |  |  |     done | 
					
						
							|  |  |  |     unset i | 
					
						
							|  |  |  |     for i in ${MV_FILES[@]} | 
					
						
							|  |  |  |     do | 
					
						
							|  |  |  |         edo mv "${IMAGE%/}"${i} "${IMAGE%/}"${i%.*}-${SLOT}.${i##*.} | 
					
						
							|  |  |  |     done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # set up alternatives | 
					
						
							|  |  |  |     alternatives_for _openra ${SLOT} ${PV} \
 | 
					
						
							| 
									
										
										
										
											2017-10-14 14:41:56 +00:00
										 |  |  |         /usr/$(exhost --target)/bin/openra-cnc{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/$(exhost --target)/bin/openra-cnc-server{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/$(exhost --target)/bin/openra-ra{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/$(exhost --target)/bin/openra-ra-server{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/$(exhost --target)/bin/openra-d2k{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/$(exhost --target)/bin/openra-d2k-server{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/share/appdata/openra-cnc.appdata.xml{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/share/appdata/openra-ra.appdata.xml{,-${SLOT}} \
 | 
					
						
							|  |  |  |         /usr/share/appdata/openra-d2k.appdata.xml{,-${SLOT}} \
 | 
					
						
							| 
									
										
										
										
											2016-10-01 14:52:00 +00:00
										 |  |  |         /usr/share/mime/packages/openra.xml{,-${SLOT}} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_pkg_postinst() { | 
					
						
							|  |  |  |     alternatives_pkg_postinst | 
					
						
							|  |  |  |     gtk-icon-cache_pkg_postinst | 
					
						
							|  |  |  |     freedesktop-mime_pkg_postinst | 
					
						
							|  |  |  |     freedesktop-desktop_pkg_postinst | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | openra-build_pkg_postrm() { | 
					
						
							|  |  |  |     gtk-icon-cache_pkg_postrm | 
					
						
							|  |  |  |     freedesktop-desktop_pkg_postrm | 
					
						
							|  |  |  |     freedesktop-mime_pkg_postrm | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 |