|
| 1 | +# Copyright 1999-2020 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=7 |
| 5 | + |
| 6 | +inherit desktop flag-o-matic xdg cmake |
| 7 | + |
| 8 | +if [[ ${PV} == *9999 ]] ; then |
| 9 | + EGIT_REPO_URI="https://github.com/CelestiaProject/Celestia.git" |
| 10 | + inherit git-r3 |
| 11 | +else |
| 12 | + if [[ ${PV} == *_p* ]] ; then |
| 13 | + COMMIT_ID="df508a0c597a3d96c1c039fa4a973e294021cfba" |
| 14 | + SRC_URI="https://github.com/${PN^}Project/${PN^}/archive/${COMMIT_ID}.tar.gz -> ${P}.tar.gz" |
| 15 | + S="${WORKDIR}/${PN^}-${COMMIT_ID}" |
| 16 | + KEYWORDS="~amd64 ~x86" |
| 17 | + else |
| 18 | + SRC_URI="https://github.com/${PN^}Project/${PN^}/archive/${PV/_/-}.tar.gz -> ${P}.tar.gz" |
| 19 | + KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" |
| 20 | + fi |
| 21 | +fi |
| 22 | + |
| 23 | +DESCRIPTION="OpenGL 3D space simulator" |
| 24 | +HOMEPAGE="https://celestia.space" |
| 25 | + |
| 26 | +LICENSE="GPL-2+" |
| 27 | +SLOT="0" |
| 28 | +IUSE="glut lua nls +qt5 theora" |
| 29 | +REQUIRED_USE="|| ( glut qt5 )" |
| 30 | + |
| 31 | +BDEPEND=" |
| 32 | + dev-cpp/eigen |
| 33 | + virtual/pkgconfig |
| 34 | + nls? ( sys-devel/gettext ) |
| 35 | +" |
| 36 | +DEPEND=" |
| 37 | + dev-libs/libfmt:= |
| 38 | + media-libs/glew:0 |
| 39 | + media-libs/libpng:0= |
| 40 | + sys-libs/zlib:= |
| 41 | + virtual/glu |
| 42 | + virtual/jpeg:0 |
| 43 | + virtual/opengl |
| 44 | + glut? ( media-libs/freeglut ) |
| 45 | + lua? ( dev-lang/lua:* ) |
| 46 | + qt5? ( |
| 47 | + dev-qt/qtcore:5 |
| 48 | + dev-qt/qtgui:5 |
| 49 | + dev-qt/qtwidgets:5 |
| 50 | + ) |
| 51 | + theora? ( |
| 52 | + media-libs/libogg |
| 53 | + media-libs/libtheora |
| 54 | + ) |
| 55 | +" |
| 56 | +RDEPEND="${DEPEND}" |
| 57 | + |
| 58 | +PATCHES=( |
| 59 | + # make better desktop files |
| 60 | + "${FILESDIR}"/${PN}-1.5.0-desktop.patch |
| 61 | + # add a ~/.celestia for extra directories |
| 62 | + "${FILESDIR}"/${PN}-1.6.99-cfg.patch |
| 63 | +) |
| 64 | + |
| 65 | +src_prepare() { |
| 66 | + cmake_src_prepare |
| 67 | + |
| 68 | + ### This version of Celestia has a bug in the font rendering and |
| 69 | + ### requires -fsigned-char. We should be able to force this flag |
| 70 | + ### on all architectures. See bug #316573. |
| 71 | + append-flags "-fsigned-char" |
| 72 | +} |
| 73 | + |
| 74 | +src_configure() { |
| 75 | + local mycmakeargs=( |
| 76 | + -DENABLE_CELX="$(usex lua)" |
| 77 | + -DENABLE_NLS="$(usex nls)" |
| 78 | + -DENABLE_GLUT="$(usex glut)" |
| 79 | + -DENABLE_GTK=OFF |
| 80 | + -DENABLE_QT="$(usex qt5)" |
| 81 | + -DENABLE_WIN=OFF |
| 82 | + -DENABLE_THEORA="$(usex theora)" |
| 83 | + ) |
| 84 | + cmake_src_configure |
| 85 | +} |
| 86 | + |
| 87 | +src_install() { |
| 88 | + cmake_src_install |
| 89 | + |
| 90 | + local size |
| 91 | + for size in 16 22 32 48 ; do |
| 92 | + newicon -s ${size} "${S}"/src/celestia/kde/data/hi${size}-app-${PN}.png ${PN}.png |
| 93 | + done |
| 94 | + newicon -s 128 "${S}"/src/celestia/gtk/data/${PN}-logo.png ${PN}.png |
| 95 | + doicon -s scalable "${S}"/src/celestia/gtk/data/${PN}.svg |
| 96 | + |
| 97 | + use glut && domenu ${PN}.desktop |
| 98 | + if use qt5 ; then |
| 99 | + sed \ |
| 100 | + -e "/^Name/s@\$@ (qt5 interface)@" \ |
| 101 | + -e "/^Exec/s@${PN}@${PN}-qt@" \ |
| 102 | + ${PN}.desktop > "${T}"/${PN}-qt5.desktop || die |
| 103 | + domenu "${T}"/${PN}-qt5.desktop |
| 104 | + fi |
| 105 | + dodoc AUTHORS README TRANSLATORS *.txt |
| 106 | +} |
0 commit comments