Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iortcw (wolfenstein) ebuild ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gamers & Players
View previous topic :: View next topic  
Author Message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 347
Location: Ásgarðr

PostPosted: Sat Oct 02, 2021 4:57 am    Post subject: iortcw (wolfenstein) ebuild ? Reply with quote

Hi,
I'm looking for an ebuild for iortcw, this is an engine for the classic Return to Castle Wolfenstein.
https://github.com/iortcw/iortcw

Does anyone have an ebuild to share ? Unfortunately, it is not available on zugaina.
Thanks !
Back to top
View user's profile Send private message
Strange_Attractor
n00b
n00b


Joined: 07 Mar 2011
Posts: 41
Location: Sweden

PostPosted: Sat Oct 09, 2021 10:12 am    Post subject: Reply with quote

I modified an older ebuild that I found online. sys-libs/minizip-ng is not in portage, you can probably just remove the dependency.

Code:
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit desktop unpacker xdg-utils

DESCRIPTION="Return to Castle Wolfenstein - IORTCW Project"
HOMEPAGE="http://games.activision.com/games/wolfenstein/"
if [[ "${PV}" = 9999 ]] ; then
   inherit git-r3
   EGIT_REPO_URI="https://github.com/iortcw/iortcw.git"
   RELEASE="${PN}-1.51c"
else
   SRC_URI="https://github.com/iortcw/iortcw/archive/${PV}.tar.gz -> ${P}.tar.gz"
   S="${WORKDIR}/iortcw-${PV}"
   KEYWORDS="~amd64 ~x86"
   RELEASE="${PN}-${PV}"
fi

WOLF_POINTRELEASE="wolf-linux-1.41b.x86.run"
PATCH_DATA="patch-data-141.zip"
SRC_URI+=" mirror://idsoftware/wolf/linux/${WOLF_POINTRELEASE}
   https://github.com/iortcw/iortcw/releases/download/1.51c/patch-data-141.zip -> ${RELEASE}-${PATCH_DATA}"
# iortcw is GPL-2 but the point release files still have the original copyrights
# from ID-software
LICENSE="GPL-2 RTCW"
SLOT="0"
IUSE="+client curl mumble openal opus server truetype voip vorbis"

REQUIRED_USE="|| ( client server )
      voip? ( opus )"

CDEPEND="
   || (
      >=sys-libs/zlib-1.2.11[minizip(-)]
      sys-libs/minizip-ng
   )
"

DEPEND="${CDEPEND}
   client? (
      media-libs/libsdl2
      x11-libs/libX11
      x11-libs/libXau
      x11-libs/libXdmcp
      x11-libs/libXext
      virtual/opengl
   )"

RDEPEND="${CDEPEND}
   client? ( media-libs/libsdl2
      virtual/opengl
      virtual/jpeg:0
      curl? ( net-misc/curl )
      mumble? ( media-sound/mumble )
      openal? ( media-libs/openal )
      opus? ( media-libs/libogg
         media-libs/opus
         media-libs/opusfile )
      truetype? ( media-libs/freetype )
      vorbis? ( media-libs/libogg
         media-libs/libvorbis ) )"
   #voip? ( media-libs/speex )"

dir="/opt/${PN}"

use_switch() {
   local flag="${1}" cfg_option="${2}" cfg_val=0
   local makefile="${S}/SP/Makefile.local"
   [[ -z "${flag}" ]] && die
   [[ -z "${cfg_option}" ]] && die

   use ${flag} && cfg_val=1

   if grep -q "^${cfg_option}=" ${makefile} ; then
      sed "/${cfg_option}=/s@[[:digit:]]@${cfg_val}@" -i ${makefile} \
         || die
   else
      echo "${cfg_option}=${cfg_val}" >> ${makefile}
   fi
}

PATCHES=(
   "${FILESDIR}/${PN}-1.51c-zlib.patch"
)

src_unpack() {
   unpack "${RELEASE}-${PATCH_DATA}"

   if [[ "${PV}" = 9999 ]] ; then
      git-r3_src_unpack
   else
      default
   fi

   unpack_makeself "${DISTDIR}/${WOLF_POINTRELEASE}"
}

src_prepare(){
   default
   cp "${FILESDIR}/Makefile.local" "${S}/SP/" || die

   # remove bundled libs
   local bundled_libs bundle bdir tdir

   bundled_libs=(
      AL # openal
      SDL2
      curl-7.54.0
      freetype-2.6.4
      jpeg-8c
      libogg-1.3.2
      libvorbis-1.3.5
      opus-1.1.4
      opusfile-0.8
      zlib-1.2.11
   )
   for bundle in ${bundled_libs[@]} ; do
      for tdir in MP SP ; do
         bdir="${tdir}/code/${bundle}"
         if [[ -d "${bdir}" ]] ; then
            rm -r ${bdir} || die
         fi
      done
   done

   local makefile="SP/Makefile.local"

   sed "/^CFLAGS=/s@=.*\$@=${CFLAGS}@" -i ${makefile} || die

   echo "V=1" >> ${makefile}

   use_switch client BUILD_CLIENT
   use_switch curl USE_CURL
   use_switch mumble USE_MUMBLE
   use_switch openal USE_OPENAL
   use_switch opus USE_CODEC_OPUS
   use_switch server BUILD_SERVER
   use_switch truetype USE_FREETYPE
   use_switch vorbis USE_CODEC_VORBIS
   use_switch voip USE_VOIP

   use curl && echo "USE_CURL_DLOPEN=0" >> ${makefile}
   use openal && echo "USE_OPENAL_DLOPEN=0" >> ${makefile}
}

src_compile() {
   cd "${S}/SP/"
   ARCH="$(uname -m)" emake
}

src_install() {
   cd "${S}/SP/"
   ARCH="$(uname -m)" \
   COPYDIR="${D}/${dir}" \
   emake copyfiles

   sed "s@%dir%@${dir}@g;s@%exe%@iowolfsp.$(uname -m)@" \
      "${FILESDIR}"/rtcw-wrapper > "${T}"/rtcwsp || die
   dobin "${T}"/rtcwsp

   #if use server; then
   #   games_make_wrapper wolf-ded ./wolfded.x86 "${dir}" "${dir}"
   #   newinitd "${FILESDIR}"/wolf-ded.rc wolf-ded
   #   sed -i \
   #      -e "s:GENTOO_DIR:${dir}:" \
   #      "${D}"/etc/init.d/wolf-ded \
   #      || die
   #fi

   # install pk3 files from the point release
   insinto "${dir}"/main
   doins "${WORKDIR}"/main/*.pk3
   doins -r "${WORKDIR}"/main/scripts

   doicon -s scalable misc/iortcw.svg
   make_desktop_entry rtcwsp "Return to Castle Wolfenstein (SP)" iortcw
}

pkg_postinst() {
   xdg_icon_cache_update
   elog "You need to copy pak0.pk3, mp_pak0.pk3 and sp_pak1.pk3 from a"
   elog "Window installation or your install media into ${dir}/main/"
   elog
   elog "To play the game run:"
   elog " rtcwsp (single-player)"
   #elog " rtcwmp (multi-player)"
   elog
#   if use server
#   then
#      elog "To start a dedicated server run:"
#      elog " /etc/init.d/wolf-ded start"
#      elog
#      elog "To run the dedicated server at boot, type:"
#      elog " rc-update add wolf-ded default"
#      elog
#      elog "The dedicated server is started under the ${GAMES_USER_DED} user account"
#      echo
#   fi
}

pkg_postrm() {
   xdg_icon_cache_update
}
Back to top
View user's profile Send private message
Section_8
l33t
l33t


Joined: 22 May 2004
Posts: 607

PostPosted: Sat Oct 09, 2021 9:23 pm    Post subject: Reply with quote

There is also an ebuild here: https://bugs.gentoo.org/525536
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 347
Location: Ásgarðr

PostPosted: Tue Oct 12, 2021 7:09 am    Post subject: Reply with quote

Thanks Strange_Attractor & Section_8, I will try that :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gamers & Players All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum