From dda4b40dbcaf255448af076f20ac593bb0969055 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 1 Oct 2016 16:52:00 +0200 Subject: [PATCH] games-strategy/openra: prepare for SLOTting --- .../openra/openra-20160508-r1.exheres-0 | 163 ------------------ .../openra/openra-20160508-r2.exheres-0 | 55 ++++++ .../games-strategy/openra/openra-build.exlib | 157 +++++++++++++++++ 3 files changed, 212 insertions(+), 163 deletions(-) delete mode 100644 packages/games-strategy/openra/openra-20160508-r1.exheres-0 create mode 100644 packages/games-strategy/openra/openra-20160508-r2.exheres-0 create mode 100644 packages/games-strategy/openra/openra-build.exlib diff --git a/packages/games-strategy/openra/openra-20160508-r1.exheres-0 b/packages/games-strategy/openra/openra-20160508-r1.exheres-0 deleted file mode 100644 index 6b8e333b..00000000 --- a/packages/games-strategy/openra/openra-20160508-r1.exheres-0 +++ /dev/null @@ -1,163 +0,0 @@ -# Copyright 2015-2016 Julian Ospald -# Distributed under the terms of the GNU General Public License v2 - -require desktop-utils gtk-icon-cache freedesktop-desktop freedesktop-mime -require lua [ whitelist="5.1" multibuild=false ] -require github [ user=OpenRA project=OpenRA tag=release-${PV} ] - -SUMMARY="A free RTS engine supporting games like Command & Conquer and Red Alert" -HOMEPAGE="http://www.openra.net/" - -## this is a massive amount of 3rd party deps that would otherwise -## be fetched during build time -NG_SRC="https://nuget.org/api/v2/package" -# 3rd party deps -StyleCopPlus_MSBuild="${NG_SRC}/StyleCopPlus.MSBuild/4.7.49.5 -> StyleCopPlus_MSBuild-4.7.49.5.zip" -StyleCop_MSBuild="${NG_SRC}/StyleCop.MSBuild/4.7.49.0 -> StyleCop_MSBuild-4.7.49.0.zip" -SharpZipLib="${NG_SRC}/SharpZipLib/0.86.0 -> SharpZipLib-0.86.0.zip" -MaxMind_Db="${NG_SRC}/MaxMind.Db/1.1.0.0 -> MaxMind_Db-1.1.0.0.zip" -Newtonsoft_Json="${NG_SRC}/Newtonsoft.Json/7.0.1 -> Newtonsoft_Json-7.0.1.zip" -RestSharp="${NG_SRC}/RestSharp/105.2.3 -> RestSharp-105.2.3.zip" -MaxMind_GeoIP2="${NG_SRC}/MaxMind.GeoIP2/2.3.1 -> MaxMind_GeoIP2-2.3.1.zip" -SharpFont="${NG_SRC}/SharpFont/3.1.0 -> SharpFont-3.1.0.zip" -NUnit="${NG_SRC}/NUnit/3.0.1 -> NUnit-3.0.1.zip" -NUnit_Console="${NG_SRC}/NUnit.Console/3.0.1 -> NUnit_Console-3.0.1.zip" -Mono_Nat="${NG_SRC}/Mono.Nat/1.2.24 -> Mono_Nat-1.2.24.zip" -FuzzyLogicLibrary="${NG_SRC}/FuzzyLogicLibrary/1.2.0 -> FuzzyLogicLibrary-1.2.0.zip" -SDL2CS="https://github.com/OpenRA/SDL2-CS/releases/download/20150709/SDL2-CS.dll -> SDL2-CS.dll.20150709" -Eluant="https://github.com/OpenRA/Eluant/releases/download/20140425/Eluant.dll -> Eluant.dll.20140425" -SmartIrc4net="${NG_SRC}/SmartIrc4net/0.4.5.1 -> SmartIrc4net-0.4.5.1.zip" -# unfortunately, this may randomly change -GEO_IP_DB="http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz -> GeoLite2-Country-2015-10-18.mmdb.gz" -OpenAL_CS="https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll -> OpenAL-CS-20151227.dll" -OpenAL_CS_config="https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll.config -> OpenAL-CS-20151227.dll.config" - -DOWNLOADS="${DOWNLOADS} -${StyleCopPlus_MSBuild} -${StyleCop_MSBuild} -${SharpZipLib} -${MaxMind_Db} -${Newtonsoft_Json} -${RestSharp} -${MaxMind_GeoIP2} -${SharpFont} -${NUnit} -${NUnit_Console} -${Mono_Nat} -${FuzzyLogicLibrary} -${SDL2CS} -${Eluant} -${SmartIrc4net} -${GEO_IP_DB} -${OpenAL_CS} -${OpenAL_CS_config} -" - -LICENCES="GPL-3" -SLOT="0" -PLATFORMS="~amd64 ~x86" - -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: - x11-apps/xdg-utils - suggestion: - gnome-desktop/zenity [[ description = [ Graphical error dialogs ] ]] -" - -WORK=${WORKBASE}/OpenRA-release-${PV} - -src_unpack() { - unpack openra-release-${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 -} - -src_configure() { :; } - -src_prepare() { - # register game-version - emake VERSION="release-${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}"/ -} - -src_compile() { - emake VERSION="release-${PV}" core tools -} - -src_install() { - emake \ - datadir="/usr/share" \ - bindir="/usr/$(exhost --target)/bin" \ - libdir="/usr/$(exhost --target)/libexec" \ - VERSION="release-${PV}" \ - DESTDIR="${IMAGE}" \ - install-all install-linux-scripts install-linux-mime install-linux-icons - - exeinto /usr/$(exhost --target)/libexec/openra - doexe Eluant.dll.config - - # desktop entries - install_desktop_entry "Exec=${PN} Game.Mod=cnc" "Name=OpenRA CNC" - install_desktop_entry "Exec=${PN} Game.Mod=ra" "Name=OpenRA RA" - install_desktop_entry "Exec=${PN} Game.Mod=d2k" "Name=OpenRA Dune2k" - install_desktop_entry "Exec=${PN}-editor" "Name=OpenRA Map Editor" -} - -pkg_postinst() { - gtk-icon-cache_pkg_postinst - freedesktop-mime_pkg_postinst - freedesktop-desktop_pkg_postinst -} - -pkg_postrm() { - gtk-icon-cache_pkg_postrm - freedesktop-desktop_pkg_postrm - freedesktop-mime_pkg_postrm -} - diff --git a/packages/games-strategy/openra/openra-20160508-r2.exheres-0 b/packages/games-strategy/openra/openra-20160508-r2.exheres-0 new file mode 100644 index 00000000..29e2f094 --- /dev/null +++ b/packages/games-strategy/openra/openra-20160508-r2.exheres-0 @@ -0,0 +1,55 @@ +# Copyright 2015-2016 Julian Ospald +# Distributed under the terms of the GNU General Public License v2 + +require lua [ whitelist="5.1" multibuild=false ] +require github [ user=OpenRA project=OpenRA tag=release-${PV} ] +require openra-build + +## this is a massive amount of 3rd party deps that would otherwise +## be fetched during build time +NG_SRC="https://nuget.org/api/v2/package" +# 3rd party deps +StyleCopPlus_MSBuild="${NG_SRC}/StyleCopPlus.MSBuild/4.7.49.5 -> StyleCopPlus_MSBuild-4.7.49.5.zip" +StyleCop_MSBuild="${NG_SRC}/StyleCop.MSBuild/4.7.49.0 -> StyleCop_MSBuild-4.7.49.0.zip" +SharpZipLib="${NG_SRC}/SharpZipLib/0.86.0 -> SharpZipLib-0.86.0.zip" +MaxMind_Db="${NG_SRC}/MaxMind.Db/1.1.0.0 -> MaxMind_Db-1.1.0.0.zip" +Newtonsoft_Json="${NG_SRC}/Newtonsoft.Json/7.0.1 -> Newtonsoft_Json-7.0.1.zip" +RestSharp="${NG_SRC}/RestSharp/105.2.3 -> RestSharp-105.2.3.zip" +MaxMind_GeoIP2="${NG_SRC}/MaxMind.GeoIP2/2.3.1 -> MaxMind_GeoIP2-2.3.1.zip" +SharpFont="${NG_SRC}/SharpFont/3.1.0 -> SharpFont-3.1.0.zip" +NUnit="${NG_SRC}/NUnit/3.0.1 -> NUnit-3.0.1.zip" +NUnit_Console="${NG_SRC}/NUnit.Console/3.0.1 -> NUnit_Console-3.0.1.zip" +Mono_Nat="${NG_SRC}/Mono.Nat/1.2.24 -> Mono_Nat-1.2.24.zip" +FuzzyLogicLibrary="${NG_SRC}/FuzzyLogicLibrary/1.2.0 -> FuzzyLogicLibrary-1.2.0.zip" +SDL2CS="https://github.com/OpenRA/SDL2-CS/releases/download/20150709/SDL2-CS.dll -> SDL2-CS.dll.20150709" +Eluant="https://github.com/OpenRA/Eluant/releases/download/20140425/Eluant.dll -> Eluant.dll.20140425" +SmartIrc4net="${NG_SRC}/SmartIrc4net/0.4.5.1 -> SmartIrc4net-0.4.5.1.zip" +# unfortunately, this may randomly change +GEO_IP_DB="http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz -> GeoLite2-Country-2015-10-18.mmdb.gz" +OpenAL_CS="https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll -> OpenAL-CS-20151227.dll" +OpenAL_CS_config="https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll.config -> OpenAL-CS-20151227.dll.config" + +DOWNLOADS="${DOWNLOADS} +${StyleCopPlus_MSBuild} +${StyleCop_MSBuild} +${SharpZipLib} +${MaxMind_Db} +${Newtonsoft_Json} +${RestSharp} +${MaxMind_GeoIP2} +${SharpFont} +${NUnit} +${NUnit_Console} +${Mono_Nat} +${FuzzyLogicLibrary} +${SDL2CS} +${Eluant} +${SmartIrc4net} +${GEO_IP_DB} +${OpenAL_CS} +${OpenAL_CS_config} +" + +SLOT="release" +PLATFORMS="~amd64 ~x86" + diff --git a/packages/games-strategy/openra/openra-build.exlib b/packages/games-strategy/openra/openra-build.exlib new file mode 100644 index 00000000..dac9db63 --- /dev/null +++ b/packages/games-strategy/openra/openra-build.exlib @@ -0,0 +1,157 @@ +# Copyright 2016 Julian Ospald +# 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: + !games-strategy/openra:0 + x11-apps/xdg-utils + suggestion: + gnome-desktop/zenity [[ description = [ Graphical error dialogs ] ]] +" + +WORK=${WORKBASE}/OpenRA-${SLOT}-${PV} + +MV_FILES=( + /usr/share/applications/openra.desktop + /usr/share/applications/openra-replays.desktop + /usr/share/applications/openra-join-servers.desktop + /usr/share/icons/hicolor/128x128/apps/openra.png + /usr/share/icons/hicolor/16x16/apps/openra.png + /usr/share/icons/hicolor/32x32/apps/openra.png + /usr/share/icons/hicolor/48x48/apps/openra.png + /usr/share/icons/hicolor/64x64/apps/openra.png + /usr/share/icons/hicolor/scalable/apps/openra.svg +) + +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() { + emake VERSION="${SLOT}-${PV}" core tools +} + +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}" \ + install-all install-linux-scripts install-linux-mime \ + 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 \ + -e "s#^Name=.*#Name=OpenRA (${SLOT})#" \ + -e "/^Exec=/s#openra#openra-${SLOT}#" \ + -e "s#^Icon=.*#Icon=openra-${SLOT}#" \ + "${IMAGE%/}"/usr/share/applications/*.desktop + + # make sure slots don't have file collisions + local i + for i in /usr/$(exhost --target)/bin/openra \ + /usr/$(exhost --target)/bin/openra-server \ + /usr/share/mime/packages/openra.xml \ + /usr/share/appdata/openra.appdata.xml + 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} \ + /usr/$(exhost --target)/bin/openra{,-${SLOT}} \ + /usr/$(exhost --target)/bin/openra-server{,-${SLOT}} \ + /usr/share/appdata/openra.appdata.xml{,-${SLOT}} \ + /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 +} +