Skip to content

Commit

Permalink
games-simulation/openttd: add 13.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sam James <[email protected]>
  • Loading branch information
thesamesam committed Feb 8, 2023
1 parent 18badc9 commit eb0dc80
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions games-simulation/openttd/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST openttd-12.2-source.tar.xz 7377496 BLAKE2B a2c0192a2d4ed149f7c6584032b46483eb74d2d7d2ced16f1d0d3e638c4acef184cd8b013b855a01750dbb570d37bb6ed95f04d16c1580e4b3777ea3b90cfee1 SHA512 577792faee1d5e0c19fbfe31501dab3359f8e1327caa87e6378bb3e616ab6b2c64d02044c6ac99f7c40397df7bc6847a6b432852a5318a2db574203ddebfaef6
DIST openttd-13.0-source.tar.xz 7422316 BLAKE2B 8aa384847681a61c74e1d56c86600fe7ba273d4721bf2b290dcbdced830e7b6872ae458d02d986877c92d5027bbfe8e9eccbcc74b791b3e9332c142fbc078953 SHA512 a2436eb8aae6967e1e3bcf5f67c2346a8f80af723509d668157e785424c2245086b10077783857acf8840068a37a0e9094f04fda36887ef7e799f360075a8e8a
131 changes: 131 additions & 0 deletions games-simulation/openttd/openttd-13.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake xdg

DESCRIPTION="A clone of Transport Tycoon Deluxe"
HOMEPAGE="https://www.openttd.org/"
SRC_URI="https://cdn.openttd.org/openttd-releases/${PV}/${P}-source.tar.xz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
IUSE="allegro cpu_flags_x86_sse debug dedicated +fluidsynth icu +lzma lzo +openmedia +png +sdl timidity +truetype +zlib"
REQUIRED_USE="!dedicated? ( || ( allegro sdl ) )"

RDEPEND="
dedicated? (
acct-group/openttd
acct-user/openttd
app-misc/dtach
)
!dedicated? (
allegro? ( media-libs/allegro:5 )
fluidsynth? ( media-sound/fluidsynth )
icu? (
dev-libs/icu-layoutex:=
dev-libs/icu-le-hb
>=dev-libs/icu-58.1:=
)
sdl? ( media-libs/libsdl2[sound,video] )
truetype? (
media-libs/fontconfig
media-libs/freetype:2
sys-libs/zlib:=
)
)
lzma? ( app-arch/xz-utils )
lzo? ( dev-libs/lzo:2 )
png? ( media-libs/libpng:= )
zlib? ( sys-libs/zlib:= )
"
DEPEND="${RDEPEND}"
BDEPEND="
>=games-util/grfcodec-6.0.6_p20210310
virtual/pkgconfig
"
PDEPEND="
!dedicated? (
openmedia? (
>=games-misc/openmsx-0.4.0
>=games-misc/opensfx-1.0.1
)
)
openmedia? ( >=games-misc/opengfx-0.6.1 )
timidity? ( media-sound/timidity++ )
"

DOCS=( docs/directory_structure.md )

PATCHES=(
"${FILESDIR}/${PN}-1.11.2_dont_compress_man.patch"
)

src_prepare() {
# Drop automagic LTO usage
sed -i -e '/check_ipo_supported(RESULT IPO_FOUND)/d' CMakeLists.txt || die

# Don't force _FORTIFY_SOURCE via CMake
# (we already set it in the toolchain by default with a minimum level
# of _FORTIFY_SOURCE=2)
sed -i -e '/-D_FORTIFY_SOURCE/d' cmake/CompileFlags.cmake || die

cmake_src_prepare
}

src_configure() {
local mycmakeargs=(
-DCMAKE_INSTALL_BINDIR=bin
-DCMAKE_INSTALL_DATADIR=share
-DOPTION_DEDICATED=$(usex dedicated)
-DOPTION_USE_ASSERTS=$(usex debug)
-DCMAKE_DISABLE_FIND_PACKAGE_Allegro=$(usex !allegro)
-DCMAKE_DISABLE_FIND_PACKAGE_Freetype=$(usex !truetype)
-DCMAKE_DISABLE_FIND_PACKAGE_Fontconfig=$(usex !truetype)
-DCMAKE_DISABLE_FIND_PACKAGE_Fluidsynth=$(usex !fluidsynth)
-DCMAKE_DISABLE_FIND_PACKAGE_ICU=$(usex !icu)
-DCMAKE_DISABLE_FIND_PACKAGE_LibLZMA=$(usex !lzma)
-DCMAKE_DISABLE_FIND_PACKAGE_LZO=$(usex !lzo)
-DCMAKE_DISABLE_FIND_PACKAGE_PNG=$(usex !png)
# N.B. regarding #807364 and #828984: CMAKE_DISABLE_FIND_PACKAGE_SDL is used only
# with USE="allegro -sdl" combination flags. There no other way to
# completely disable SDL1 support.
-DCMAKE_DISABLE_FIND_PACKAGE_SDL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_SDL2=$(usex !sdl)
-DCMAKE_DISABLE_FIND_PACKAGE_SSE=$(usex !cpu_flags_x86_sse)
-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=$(usex !zlib)
)

cmake_src_configure
}

src_install() {
cmake_src_install

if use dedicated ; then
newconfd "${FILESDIR}"/openttd.confd-r1 openttd
newinitd "${FILESDIR}"/openttd.initd-r3 openttd
fi
}

pkg_postinst() {
xdg_pkg_postinst

if ! use openmedia ; then
elog
elog "OpenTTD was compiled without the 'openmedia' USE flag."
elog
elog "In order to play, you must at least install"
elog "games-misc/opengfx, and games-misc/opensfx, or copy the "
elog "following 6 files from a version of Transport Tycoon Deluxe"
elog "(Windows or DOS) to shared or personal location."
elog "See ${EROOT}/usr/share/doc/${PF}/directory_structure.md for more info."
elog
elog "From the Windows version you need: "
elog "sample.cat trg1r.grf trgcr.grf trghr.grf trgir.grf trgtr.grf"
elog "OR from the DOS version you need: "
elog "SAMPLE.CAT TRG1.GRF TRGC.GRF TRGH.GRF TRGI.GRF TRGT.GRF"
fi
}

0 comments on commit eb0dc80

Please sign in to comment.