commit:     73b87ef1bb28bd52657bcbb89e22c32e4a46579f
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 23 11:46:26 2020 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Wed Dec 23 11:48:41 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73b87ef1

sci-geosciences/osm2pgsql: migrate to lua-single.eclass

The usual CMake deal. According to upstream scripts supports all the Lua
implementations currently in the tree, I have confirmed that it builds
and installs (tests are restricted) fine against: lua5.1, lua5.4, and luajit.

Both the latest release and the live ebuild.

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

 profiles/package.mask                              |  1 +
 .../files/osm2pgsql-1.4.0-cmake_lua_version.patch  | 11 +++++
 .../osm2pgsql/osm2pgsql-1.4.0-r100.ebuild          | 55 ++++++++++++++++++++++
 .../osm2pgsql/osm2pgsql-99999999.ebuild            | 22 +++++++--
 4 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/profiles/package.mask b/profiles/package.mask
index 57ad788e0fe..94a353fc484 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -522,6 +522,7 @@ kde-apps/kdebase-meta:5
 >=net-mail/dovecot-2.3.11.3-r100
 >=net-p2p/eiskaltdcpp-2.2.10-r100
 >=sci-astronomy/celestia-1.7.0_pre20200316-r100
+>=sci-geosciences/osm2pgsql-1.4.0-r100
 >=sci-libs/libsc-2.2-r100
 >=sci-libs/p4est-2.2-r100
 >=sci-libs/plplot-5.15.0-r100

diff --git 
a/sci-geosciences/osm2pgsql/files/osm2pgsql-1.4.0-cmake_lua_version.patch 
b/sci-geosciences/osm2pgsql/files/osm2pgsql-1.4.0-cmake_lua_version.patch
new file mode 100644
index 00000000000..d7f35345ef5
--- /dev/null
+++ b/sci-geosciences/osm2pgsql/files/osm2pgsql-1.4.0-cmake_lua_version.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -185,7 +185,7 @@
+         include_directories(SYSTEM ${LUAJIT_INCLUDE_DIR})
+         set(HAVE_LUAJIT 1)
+     else()
+-        find_package(Lua REQUIRED)
++        find_package(Lua ${LUA_VERSION} EXACT REQUIRED)
+         include_directories(SYSTEM ${LUA_INCLUDE_DIR})
+     endif()
+     set(HAVE_LUA 1)

diff --git a/sci-geosciences/osm2pgsql/osm2pgsql-1.4.0-r100.ebuild 
b/sci-geosciences/osm2pgsql/osm2pgsql-1.4.0-r100.ebuild
new file mode 100644
index 00000000000..ac4caa5df5a
--- /dev/null
+++ b/sci-geosciences/osm2pgsql/osm2pgsql-1.4.0-r100.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..4} luajit )
+
+inherit cmake lua-single
+
+DESCRIPTION="Converts OSM planet.osm data to a PostgreSQL/PostGIS database"
+HOMEPAGE="https://osm2pgsql.org/";
+SRC_URI="https://github.com/openstreetmap/${PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+lua"
+REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
+
+COMMON_DEPEND="
+       app-arch/bzip2
+       dev-db/postgresql:=
+       dev-libs/expat
+       sci-libs/proj:=
+       sys-libs/zlib
+       lua? ( ${LUA_DEPS} )
+"
+DEPEND="${COMMON_DEPEND}
+       dev-libs/boost
+"
+RDEPEND="${COMMON_DEPEND}
+       dev-db/postgis
+"
+
+# Tries to connect to local postgres server and other shenanigans
+RESTRICT="test"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.0-cmake_lua_version.patch
+)
+
+src_configure() {
+       # Setting WITH_LUAJIT without "if use lua" guard is safe, upstream
+       # CMakeLists.txt only evaluates it if WITH_LUA is true.
+       local mycmakeargs=(
+               -DWITH_LUA=$(usex lua)
+               -DWITH_LUAJIT=$(usex lua_single_target_luajit)
+               -DBUILD_TESTS=OFF
+       )
+       # To prevent the "unused variable" QA warning
+       if use lua && ! use lua_single_target_luajit; then
+               mycmakeargs+=( -DLUA_VERSION="$(lua_get_version)" )
+       fi
+       cmake_src_configure
+}

diff --git a/sci-geosciences/osm2pgsql/osm2pgsql-99999999.ebuild 
b/sci-geosciences/osm2pgsql/osm2pgsql-99999999.ebuild
index 1d3ae485824..96c27e44b3c 100644
--- a/sci-geosciences/osm2pgsql/osm2pgsql-99999999.ebuild
+++ b/sci-geosciences/osm2pgsql/osm2pgsql-99999999.ebuild
@@ -3,7 +3,9 @@
 
 EAPI=7
 
-inherit cmake git-r3
+LUA_COMPAT=( lua5-{1..4} luajit )
+
+inherit cmake git-r3 lua-single
 
 EGIT_REPO_URI="https://github.com/openstreetmap/${PN}.git";
 
@@ -14,7 +16,8 @@ SRC_URI=""
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS=""
-IUSE="+lua luajit"
+IUSE="+lua"
+REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
 
 COMMON_DEPEND="
        app-arch/bzip2
@@ -22,8 +25,7 @@ COMMON_DEPEND="
        dev-libs/expat
        sci-libs/proj:=
        sys-libs/zlib
-       lua? ( dev-lang/lua:0= )
-       luajit? ( dev-lang/luajit:= )
+       lua? ( ${LUA_DEPS} )
 "
 DEPEND="${COMMON_DEPEND}
        dev-libs/boost
@@ -35,11 +37,21 @@ RDEPEND="${COMMON_DEPEND}
 # Tries to connect to local postgres server and other shenanigans
 RESTRICT="test"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.0-cmake_lua_version.patch
+)
+
 src_configure() {
+       # Setting WITH_LUAJIT without "if use lua" guard is safe, upstream
+       # CMakeLists.txt only evaluates it if WITH_LUA is true.
        local mycmakeargs=(
                -DWITH_LUA=$(usex lua)
-               -DWITH_LUAJIT=$(usex luajit)
+               -DWITH_LUAJIT=$(usex lua_single_target_luajit)
                -DBUILD_TESTS=OFF
        )
+       # To prevent the "unused variable" QA warning
+       if use lua && ! use lua_single_target_luajit; then
+               mycmakeargs+=( -DLUA_VERSION="$(lua_get_version)" )
+       fi
        cmake_src_configure
 }

Reply via email to