commit:     1e16f00ebe854302532ed3d504e33062bd17afe8
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 29 19:20:59 2020 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Sun Nov 29 19:41:58 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e16f00e

sci-astronomy/celestia: migrate to lua-single.eclass

Both the release and the live ebuild.

Closes: https://bugs.gentoo.org/752828
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 profiles/package.mask                                 |  1 +
 ....ebuild => celestia-1.7.0_pre20200316-r100.ebuild} | 19 ++++++++++++++++---
 sci-astronomy/celestia/celestia-9999.ebuild           | 19 ++++++++++++++++---
 .../files/celestia-1.7.0-cmake_lua_version.patch      | 11 +++++++++++
 4 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/profiles/package.mask b/profiles/package.mask
index 94c62c87a59..1f8a52a3556 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -559,6 +559,7 @@ dev-lua/luacrypto
 >=net-analyzer/suricata-6.0.0-r100
 >=net-im/swift-4.0.2-r100
 >=net-p2p/eiskaltdcpp-2.2.10-r100
+>=sci-astronomy/celestia-1.7.0_pre20200316-r100
 >=sci-libs/plplot-5.15.0-r100
 >=sci-visualization/gnuplot-5.4.0-r100
 >=sci-visualization/fityk-1.3.1-r100

diff --git a/sci-astronomy/celestia/celestia-9999.ebuild 
b/sci-astronomy/celestia/celestia-1.7.0_pre20200316-r100.ebuild
similarity index 79%
copy from sci-astronomy/celestia/celestia-9999.ebuild
copy to sci-astronomy/celestia/celestia-1.7.0_pre20200316-r100.ebuild
index c38a6c82ab3..dd539877e82 100644
--- a/sci-astronomy/celestia/celestia-9999.ebuild
+++ b/sci-astronomy/celestia/celestia-1.7.0_pre20200316-r100.ebuild
@@ -3,7 +3,9 @@
 
 EAPI=7
 
-inherit desktop flag-o-matic xdg cmake
+LUA_COMPAT=( lua5-{1..3} luajit )
+
+inherit desktop flag-o-matic lua-single xdg cmake
 
 if [[ ${PV} == *9999 ]] ; then
        EGIT_REPO_URI="https://github.com/CelestiaProject/Celestia.git";
@@ -26,7 +28,8 @@ HOMEPAGE="https://celestia.space";
 LICENSE="GPL-2+"
 SLOT="0"
 IUSE="glut lua nls +qt5 theora"
-REQUIRED_USE="|| ( glut qt5 )"
+REQUIRED_USE="|| ( glut qt5 )
+       lua? ( ${LUA_REQUIRED_USE} )"
 
 BDEPEND="
        dev-cpp/eigen
@@ -42,7 +45,7 @@ DEPEND="
        virtual/jpeg:0
        virtual/opengl
        glut? ( media-libs/freeglut )
-       lua? ( dev-lang/lua:* )
+       lua? ( ${LUA_DEPS} )
        qt5? (
                dev-qt/qtcore:5
                dev-qt/qtgui:5
@@ -60,6 +63,8 @@ PATCHES=(
        "${FILESDIR}"/${PN}-1.5.0-desktop.patch
        # add a ~/.celestia for extra directories
        "${FILESDIR}"/${PN}-1.6.99-cfg.patch
+       # allow forcing CMake to look for a specific Lua version instead of the 
newest branch installed
+       "${FILESDIR}"/${PN}-1.7.0-cmake_lua_version.patch
 )
 
 src_prepare() {
@@ -81,6 +86,14 @@ src_configure() {
                -DENABLE_WIN=OFF
                -DENABLE_THEORA="$(usex theora)"
        )
+       # Upstream always looks for LuaJIT first unless stopped, and we only 
need
+       # the version specification when linking against PUC Lua
+       if use lua && ! use lua_single_target_luajit; then
+               mycmakeargs+=(
+                       -DCMAKE_DISABLE_FIND_PACKAGE_LuaJIT=ON
+                       -DLUA_VERSION=$(lua_get_version)
+               )
+       fi
        cmake_src_configure
 }
 

diff --git a/sci-astronomy/celestia/celestia-9999.ebuild 
b/sci-astronomy/celestia/celestia-9999.ebuild
index c38a6c82ab3..dd539877e82 100644
--- a/sci-astronomy/celestia/celestia-9999.ebuild
+++ b/sci-astronomy/celestia/celestia-9999.ebuild
@@ -3,7 +3,9 @@
 
 EAPI=7
 
-inherit desktop flag-o-matic xdg cmake
+LUA_COMPAT=( lua5-{1..3} luajit )
+
+inherit desktop flag-o-matic lua-single xdg cmake
 
 if [[ ${PV} == *9999 ]] ; then
        EGIT_REPO_URI="https://github.com/CelestiaProject/Celestia.git";
@@ -26,7 +28,8 @@ HOMEPAGE="https://celestia.space";
 LICENSE="GPL-2+"
 SLOT="0"
 IUSE="glut lua nls +qt5 theora"
-REQUIRED_USE="|| ( glut qt5 )"
+REQUIRED_USE="|| ( glut qt5 )
+       lua? ( ${LUA_REQUIRED_USE} )"
 
 BDEPEND="
        dev-cpp/eigen
@@ -42,7 +45,7 @@ DEPEND="
        virtual/jpeg:0
        virtual/opengl
        glut? ( media-libs/freeglut )
-       lua? ( dev-lang/lua:* )
+       lua? ( ${LUA_DEPS} )
        qt5? (
                dev-qt/qtcore:5
                dev-qt/qtgui:5
@@ -60,6 +63,8 @@ PATCHES=(
        "${FILESDIR}"/${PN}-1.5.0-desktop.patch
        # add a ~/.celestia for extra directories
        "${FILESDIR}"/${PN}-1.6.99-cfg.patch
+       # allow forcing CMake to look for a specific Lua version instead of the 
newest branch installed
+       "${FILESDIR}"/${PN}-1.7.0-cmake_lua_version.patch
 )
 
 src_prepare() {
@@ -81,6 +86,14 @@ src_configure() {
                -DENABLE_WIN=OFF
                -DENABLE_THEORA="$(usex theora)"
        )
+       # Upstream always looks for LuaJIT first unless stopped, and we only 
need
+       # the version specification when linking against PUC Lua
+       if use lua && ! use lua_single_target_luajit; then
+               mycmakeargs+=(
+                       -DCMAKE_DISABLE_FIND_PACKAGE_LuaJIT=ON
+                       -DLUA_VERSION=$(lua_get_version)
+               )
+       fi
        cmake_src_configure
 }
 

diff --git 
a/sci-astronomy/celestia/files/celestia-1.7.0-cmake_lua_version.patch 
b/sci-astronomy/celestia/files/celestia-1.7.0-cmake_lua_version.patch
new file mode 100644
index 00000000000..80fba5d447a
--- /dev/null
+++ b/sci-astronomy/celestia/files/celestia-1.7.0-cmake_lua_version.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -179,7 +179,7 @@
+ 
+   find_package(LuaJIT)
+   if(NOT LUAJIT_FOUND)
+-    find_package(Lua REQUIRED)
++    find_package(Lua ${LUA_VERSION} EXACT REQUIRED)
+   endif()
+   include_directories(${LUA_INCLUDE_DIR})
+   link_libraries(${LUA_LIBRARIES})

Reply via email to