Skip to content

Instantly share code, notes, and snippets.

@Sheridan
Last active December 7, 2018 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sheridan/90c0426d7f91395c76bc0bd7a1b1aa26 to your computer and use it in GitHub Desktop.
Save Sheridan/90c0426d7f91395c76bc0bd7a1b1aa26 to your computer and use it in GitHub Desktop.
urho3d-9999.ebuild
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=6
SCM="git-r3"
EGIT_REPO_URI="https://github.com/urho3d/Urho3D.git"
inherit eutils cmake-utils multilib ${SCM} flag-o-matic
DESCRIPTION="Urho3D game engine"
HOMEPAGE="http://urho3d.github.io/"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~arm"
X86_CPU_FEATURES_RAW=( 3dnow mmx sse )
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
IUSE="${X86_CPU_FEATURES[@]%:*}
abi_mips_n64 sound alsa pulseaudio
automated-testing static static-libs
-pch -docs -angelscript +lua -lua-jit
-network -sqlite +recastnavigation +urho2d +physix +opengl
+samples -extras +tools -clang-tools -debug-raw-script-loader
+filewatcher -bindings logging profiling threads
debug inverse-kinematics +sdl"
REQUIRED_USE="
clang-tools? ( !pch !static )
cpu_flags_x86_mmx? ( !cpu_flags_x86_sse )
cpu_flags_x86_3dnow? ( !cpu_flags_x86_3dnow !cpu_flags_x86_mmx )
opengl
static? ( static-libs )
static-libs? ( static )
lua-jit? ( lua )
alsa? ( sound threads )
sound? ( threads alsa )
"
RDEPEND="
x11-libs/libX11
x11-apps/xrandr
alsa? ( media-libs/libsdl2[alsa,sound?,threads?]
media-libs/alsa-lib )
media-libs/libsdl2[X,opengl?]
opengl? ( media-libs/glew )
!opengl? ( media-gfx/mojoshader )
media-libs/freetype
app-arch/lz4
dev-libs/pugixml
dev-libs/rapidjson
pulseaudio? ( media-sound/pulseaudio )
"
DEPEND="${RDEPEND}
dev-util/cmake"
pkg_setup() {
if use debug; then
if [[ ! ( ${FEATURES} =~ "nostrip" ) ]]; then
die Emerge again with FEATURES="nostrip" or remove the debug use flag
fi
fi
glxinfo | grep EXT_framebuffer_object &>/dev/null
if [[ "$?" != "0" ]]; then
die "Video card not supported. Your machine does not meet the minimum requirements."
fi
glxinfo | grep EXT_packed_depth_stencil &>/dev/null
if [[ "$?" != "0" ]]; then
die "Video card not supported. Your machine does not meet the minimum requirements."
fi
cat /proc/cpuinfo | grep sse &>/dev/null
if [[ "$?" != "0" ]]; then
die "CPU not supported. Your machine does not meet the minimum requirements."
fi
}
src_configure() {
append-cxxflags -std=c++11
local mycmakeargs=(
-DSDL_ATOMIC=$(usex sdl)
-DSDL_AUDIO=$(usex sdl)
-DSDL_CPUINFO=$(usex sdl)
-DSDL_DLOPEN=$(usex sdl)
-DSDL_EVENTS=$(usex sdl)
-DSDL_FILE=$(usex sdl)
-DSDL_FILESYSTEM=$(usex sdl)
-DSDL_HAPTIC=$(usex sdl)
-DSDL_JOYSTICK=$(usex sdl)
-DSDL_LOADSO=$(usex sdl)
-DSDL_POWER=$(usex sdl)
-DSDL_RENDER:=$(usex sdl)
-DSDL_SHARED:=$(usex sdl)
-DSDL_STATIC=$(usex sdl)
-DSDL_STATIC_PIC:=$(usex sdl)
-DSDL_THREADS=$(usex sdl)
-DSDL_TIMERS=$(usex sdl)
-DSDL_VIDEO=$(usex sdl)
-DURHO3D_WEBP=OFF
-DURHO3D_CLANG_TOOLS=$(usex clang-tools)
-DURHO3D_DEPLOYMENT_TARGET=native
-DURHO3D_IK=$(usex inverse-kinematics)
-DURHO3D_PACKAGING=OFF
-DURHO3D_PLAYER=ON
-DURHO3D_LUA=$(usex lua)
-DURHO3D_LUAJIT=$(usex lua-jit)
-DURHO3D_NETWORK=$(usex network)
-DURHO3D_DATABASE_ODBC=OFF
-DURHO3D_PHYSICS=$(usex physix)
-DURHO3D_URHO2D=$(usex urho2d)
-DURHO3D_ANGELSCRIPT=$(usex angelscript)
-DURHO3D_NAVIGATION=$(usex recastnavigation)
-DURHO3D_SAFE_LUA=$(usex debug)
-DURHO3D_LUA_RAW_SCRIPT_LOADER=$(usex debug-raw-script-loader)
-DURHO3D_SAMPLES=$(usex samples)
-DURHO3D_TOOLS=$(usex tools)
-DURHO3D_EXTRAS=$(usex extras)
-DURHO3D_DOCS=$(usex docs)
-DURHO3D_DATABASE_SQLITE=$(usex sqlite)
-DURHO3D_DATABASE=$(usex sqlite)
-DURHO3D_PCH=$(usex pch)
-DURHO3D_FILEWATCHER=$(usex filewatcher)
-DURHO3D_BINDINGS=$(usex bindings)
-DURHO3D_LOGGING=$(usex logging)
-DURHO3D_PROFILING=$(usex profiling)
-DURHO3D_TESTING=$(usex automated-testing)
-DURHO3D_THREADING=$(usex threads)
)
if use opengl ; then
mycmakeargs+=( -DURHO3D_OPENGL=TRUE )
fi
if use abi_x86_64 ; then
mycmakeargs+=( -DURHO3D_64BIT=1 )
elif use cpu_flags_x86_sse ; then
mycmakeargs+=( -DURHO3D_SSE=1 )
elif use cpu_flags_x86_mmx ; then
mycmakeargs+=( -DURHO3D_MMX=1 )
elif use cpu_flags_x86_3dnow ; then
mycmakeargs+=( -DURHO3D_3DNOW=1 )
fi
if use static; then
mycmakeargs+=( -DURHO3D_LIB_TYPE=STATIC )
else
mycmakeargs+=( -DURHO3D_LIB_TYPE=SHARED )
fi
cmake-utils_src_configure
}
src_compile() {
MAKEOPTS="-j1" \
cmake-utils_src_compile
}
src_install() {
cmake-utils_src_install
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment