# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /games-rpg/vegastrike/vegastrike-0.5.0.ebuild $ inherit flag-o-matic eutils games DESCRIPTION="A 3D space simulator that allows you to trade and bounty hunt" HOMEPAGE="http://vegastrike.sourceforge.net/" SRC_URI="http://downloads.sourceforge.net/sourceforge/${PN}/${PN}-linux-${PV}.tar.bz2 http://downloads.sourceforge.net/sourceforge/${PN}/${PN}-src-${PV}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64" IUSE="stencil-buffer gtk no-sound sdl debug" RDEPEND=" dev-lang/python virtual/opengl media-libs/jpeg media-libs/libpng dev-libs/expat media-libs/openal sdl? ( media-libs/libsdl ) !no-sound? ( media-libs/libvorbis media-libs/libogg sdl? ( media-libs/sdl-mixer ) ) virtual/glut virtual/glu gtk? ( x11-libs/gtk+ ) !games-rpg/vegastrike-ded " DEPEND=" ${RDEPEND} dev-lang/perl " # I consider the upstream naming buggy S="${WORKDIR}/${PN}-source-${PV}" # where to install the game data # (from *-linux-*.tar.bz2) VS_DATA="${GAMES_DATADIR}/${PN}" WORK_DATA="${PN}-data" pkg_setup() { games_pkg_setup einfo "If compiling fails for you on gl_globals.h, try to replace your" einfo "glext.h (usually found in /usr/include/GL/ with this one" einfo "http://oss.sgi.com/projects/ogl-sample/ABI/glext.h" einfo "remember to make backup of the original though" } src_unpack() { unpack "${PN}-linux-${PV}.tar.bz2" mv "${P}" "${WORK_DATA}" \ || die "Renaming data directory failed" unpack "${PN}-src-${PV}.tar.bz2" # We don't need any precompiled stuff rm -r "${WORK_DATA}/bin" \ || die "Removing precompiled binaries failed" # Sort out directory references sed -i \ -e "s!/usr/local/share/doc!/usr/share/doc!" \ -e "s!/usr/local/share/vegastrike!${VS_DATA}!" \ -e "s!/usr/games/vegastrike!${VS_DATA}!" \ -e "s!/usr/local/bin!${GAMES_BINDIR}!" \ -e "s!/usr/local/lib/man!/usr/share/man!" \ "${WORK_DATA}/documentation/vegastrike.1" \ || die "sed ${WORK_DATA}/documentation/vegastrike.1 failed" cd "$S" epatch "${FILESDIR}/${PN}-gcc44.patch" epatch "${FILESDIR}/${PN}_libpng-1.4.patch" ## This whole excursion isn't necessary with the current version anymore, ## commenting it out #cd "${S}/${P}" # cd "${WORKDIR}/vegastrike-source-0.5.0" # seems to run even without fixing these paths, are they actually # used any more at all? # sed -i \ # -e "s!/usr/games/vegastrike!${VS_DATA}!" \ # -e "s!/usr/local/bin!${GAMES_BINDIR}!" \ # launcher/saveinterface.cpp \ # || die "sed launcher/saveinterface.cpp failed" # not necessary if configure is called with correct --prefix # sed -i \ # "s!/usr/local/share/vegastrike!${VS_DATA}!" \ # src/common/common.cpp \ # || die "sed src/common/common.cpp failed" # fixed already in the source # sed -i \ # "s!/usr/share/local/vegastrike!${VS_DATA}!" \ # src/vsfilesystem.cpp \ # || die "sed src/filesys.cpp failed" # Makefile.am: only needed for svn building # sed -i \ # -e '/^SUBDIRS =/s:tools::' \ # Makefile.am \ # || die "sed Makefile.am failed" # bootstrap isn't needed for prepacked tarballs (it's equivalent to # autogen.sh found in other projects) # # is not possible here to use built in function subversion_bootstrap: it # # won't work as expected: ./bootstrap isn't in main compile dir # ./bootstrap-sh # cd .. ## End of sed'ing } src_compile() { local conf_opts=" ${conf_opts} --disable-dependency-tracking --with-data-dir=${VS_DATA} " if use debug; then conf_opts="${conf_opts} --enable-debug" else conf_opts="${conf_opts} --enable-release=2" fi if ! use gtk; then conf_opts="${conf_opts} --disable-gtk" fi CONFIGURE_OPTIONS=" $(use_enable stencil-buffer) $(use_enable sdl) $(use_enable !no-sound sound) ${conf_opts}" egamesconf $CONFIGURE_OPTIONS \ || die "egamesconf failed" # it causes corruptions filter-flags -ffast-math # Let's optimize, removing also broken -ffast-math if ! use debug; then sed -i -e "s/-ffast-math/${CXXFLAGS}/g" Makefile \ || die "sed of CXXFLAGS failed" fi emake || die "emake failed" } src_install() { # Does the easy way work already? emake DESTDIR="${D}" install || die "Install failed" # The contents of this directory should not be needed by ordinary users # https://sourceforge.net/tracker/?func=detail&aid=2918312&group_id=19507&atid=119507 rm -r "${D}/usr/games/objconv/" \ || die "Deleting obsolete objconv directory failed" cd ${WORKDIR} doicon "${WORK_DATA}/vegastrike.xpm" "${WORK_DATA}/vslogo.xpm" doman ${WORK_DATA}/documentation/*.1 || die "doman failed" dodoc ${WORK_DATA}/documentation/*.{txt,pdf,jpg} || die "dodoc failed" dodir "${VS_DATA}" ( shopt -s dotglob; cp -r ${WORK_DATA}/* "${D}/${GAMES_DATADIR}/${PN}/" || die "cp failed (data)" ) prepgamesdirs return ## I don't believe we need vsinstall & friends any more cd ${S} cat << EOF > vsinstall #!/bin/sh ( mkdir \${HOME}/.${PN} 2> /dev/null ln -s \${HOME}/.${PN} \${HOME}/.${P} cd \${HOME}/.${PN} cp ${GAMES_DATADIR}/${PN}/data/setup.config . cp -r ${GAMES_DATADIR}/${PN}/data/.${P}/* . cp ${GAMES_DATADIR}/${PN}/data/vegastrike.config . #${GAMES_BINDIR}/vssetup vssetup ) echo "If you wish to have your own music edit ~/.vegastrike/*.m3u" echo "Each playlist represents a place or situation in Vega Strike" exit 0 EOF dogamesbin vegastrike \ || die "Creation of vegastrike (the binary) failed" dogamesbin vsinstall \ || die "Creation of vsinstall failed" dogamesbin vegaserver \ || die "Creation of vegaserver failed" dogamesbin mesher \ || die "Creation of vegaserver failed" if use gtk; then newgamesbin vssetup vssetup || die "newgamesbin failed" fi cp vsinstall data/bin/vsinstall || die "cp failed" doicon "${S}/data/vegastrike.xpm" make_desktop_entry "vegastrike" "Vegastrike" "vegastrike.xpm" doman ${S}/data/documentation/*.1 || die "doman failed" dodoc ${S}/data/documentation/*.txt || die "dodoc failed" dodir "${GAMES_DATADIR}/${PN}" cp -r data/ "${D}/${GAMES_DATADIR}/${PN}/" || die "cp failed (data)" prepgamesdirs } pkg_postinst() { games_pkg_postinst einfo "run vsinstall to setup your Account," einfo "then run vegastrike (or the deprecated vslauncher)" einfo " to start Vega Strike;" einfo "or run vssetup to set up Vega Strike." einfo "to start Vega Strike Server run vegaserver." }