Skip to content

Commit

Permalink
sci-astronomy/celestia: Switched from autotools to cmake
Browse files Browse the repository at this point in the history
- Adjusted dependencies
- Added qt5 USE flag
- Added glew USE flag
- Install different icon sizes
- Install correct .desktop files

Package-Manager: Portage-2.3.53, Repoman-2.3.12
Signed-off-by: Lars Wendler <[email protected]>
  • Loading branch information
Lars Wendler committed Jan 2, 2019
1 parent f1daac5 commit a05acb0
Showing 1 changed file with 52 additions and 44 deletions.
96 changes: 52 additions & 44 deletions sci-astronomy/celestia/celestia-9999.ebuild
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 1999-2018 Gentoo Foundation
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit autotools flag-o-matic xdg-utils
inherit cmake-utils desktop flag-o-matic gnome2-utils xdg-utils

DESCRIPTION="OpenGL 3D space simulator"
HOMEPAGE="https://celestia.space"
Expand All @@ -18,23 +18,40 @@ fi

LICENSE="GPL-2"
SLOT="0"
IUSE="cairo gtk nls pch theora threads"
IUSE="glut gtk nls +qt5 theora"

REQUIRED_USE="|| ( glut gtk qt5 )"

RDEPEND="
>=dev-lang/lua-5.1:*
dev-libs/libfmt
media-libs/glew:0
virtual/glu
virtual/opengl
virtual/jpeg:0
media-libs/libpng:0=
>=dev-lang/lua-5.1:*
glut? ( media-libs/freeglut )
gtk? (
x11-libs/gtk+:2
>=x11-libs/gtkglext-1.0
x11-libs/gdk-pixbuf:2
x11-libs/pango
)
qt5? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
theora? (
media-libs/libogg
media-libs/libtheora
)
!gtk? ( media-libs/freeglut )
cairo? ( x11-libs/cairo )
theora? ( media-libs/libtheora )"
"

DEPEND="${RDEPEND}
virtual/pkgconfig"
dev-cpp/eigen
virtual/pkgconfig
nls? ( sys-devel/gettext )"

PATCHES=(
# make better desktop files
Expand All @@ -43,31 +60,9 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.6.99-cfg.patch
)

pkg_setup() {
# Check for one for the following use flags to be set.
if use gtk; then
einfo "USE=\"gtk\" detected."
CELESTIA_GUI="gtk"
else
ewarn "If you want to use the full gui, set USE=\"gtk\""
ewarn "Defaulting to glut support (no GUI)."
CELESTIA_GUI="glut"
fi
}

src_prepare() {
default

# remove flags to let the user decide
local cf
for cf in -O2 -ffast-math \
-fexpensive-optimizations \
-fomit-frame-pointer; do
sed -i \
-e "s/${cf}//g" \
configure.ac admin/* || die "sed failed"
done
eautoreconf
filter-flags "-funroll-loops -frerun-loop-opt"

### This version of Celestia has a bug in the font rendering and
Expand All @@ -77,35 +72,48 @@ src_prepare() {
}

src_configure() {
# force lua in 1.6.1. seems to be inevitable
local myeconfargs=(
--disable-rpath
--with-${CELESTIA_GUI}
--with-lua
$(use_enable cairo)
$(use_enable threads threading)
$(use_enable nls)
$(use_enable pch)
$(use_enable theora)
# force lua. Seems still to be inevitable
local mycmakeargs=(
#-DENABLE_CELX="$(usex lua)"
-DENABLE_CELX=ON
-DENABLE_NLS="$(usex nls)"
-DENABLE_GLUT="$(usex glut)"
-DENABLE_GTK="$(usex gtk)"
-DENABLE_QT="$(usex qt5)"
-DENABLE_WIN=OFF
-DENABLE_THEORA="$(usex theora)"
)
econf "${myeconfargs[@]}"
cmake-utils_src_configure
}

src_install() {
emake DESTDIR="${D}" install
cmake-utils_src_install

local size
for size in 16 22 32 48 ; do
newicon "${S}"/src/celestia/kde/data/hi${size}-app-${PN}.png ${PN}.png
newicon -s ${size} "${S}"/src/celestia/kde/data/hi${size}-app-${PN}.png ${PN}.png
done

[[ ${CELESTIA_GUI} == glut ]] && domenu celestia.desktop
use glut && domenu ${PN}.desktop
local ui
for ui in gtk qt5 ; do
if use ${ui} ; then
sed \
-e "/^Name/s@\$@ (${ui} interface)@" \
-e "/^Exec/s@${PN}@${PN}-${ui/qt5/qt}@" \
${PN}.desktop > "${T}"/${PN}-${ui}.desktop || die
domenu "${T}"/${PN}-${ui}.desktop
fi
done
dodoc AUTHORS README TRANSLATORS *.txt
}

pkg_postinst() {
gnome2_icon_cache_update
xdg_desktop_database_update
}

pkg_postrm() {
gnome2_icon_cache_update
xdg_desktop_database_update
}

0 comments on commit a05acb0

Please sign in to comment.