From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1199436-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id BA41F138359
	for <garchives@archives.gentoo.org>; Mon, 24 Aug 2020 13:42:42 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 68AD4E086B;
	Mon, 24 Aug 2020 13:42:41 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 423E2E086B
	for <gentoo-commits@lists.gentoo.org>; Mon, 24 Aug 2020 13:42:41 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 671CD340D4D
	for <gentoo-commits@lists.gentoo.org>; Mon, 24 Aug 2020 13:42:39 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 775EF332
	for <gentoo-commits@lists.gentoo.org>; Mon, 24 Aug 2020 13:42:36 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1598276511.4a186793a1a0fdb0336bcb41432c1c5f51a8df5f.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/openvdb/
X-VCS-Repository: repo/gentoo
X-VCS-Files: media-gfx/openvdb/metadata.xml media-gfx/openvdb/openvdb-4.0.2-r3.ebuild media-gfx/openvdb/openvdb-5.2.0-r1.ebuild
X-VCS-Directories: media-gfx/openvdb/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 4a186793a1a0fdb0336bcb41432c1c5f51a8df5f
X-VCS-Branch: master
Date: Mon, 24 Aug 2020 13:42:36 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 139306aa-2503-47f7-bbf1-bcbfacff22c5
X-Archives-Hash: b9e9e6e2836f251a1230629d564b3cc8

commit:     4a186793a1a0fdb0336bcb41432c1c5f51a8df5f
Author:     Adrian Grigo <agrigo2001 <AT> yahoo <DOT> com <DOT> au>
AuthorDate: Tue Aug 18 04:49:14 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 24 13:41:51 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a186793

media-gfx/openvdb: Ensure user chooses appropriate abi version

The initial ebuilds for openvdb assumed that they would build the same
abi as the major version, unless abiX-compat was given to force
building against a legacy version.

This makes it difficult for other ebuilds to determine which ABI
openvdb supports as they can not rely on a USE flag being set to
ensure that openvdb uses the same version they are building against.

Starting with openvdb 5, openvdb also requires
OPENVDB_ABI_VERSION_NUMBER to be set with the version to build against.
This is also hard to determine if the user does not have a USE flag
to determine which version is being built against.

To fix these problems, I am using abiX-compat where x is 3,4,5...
to determine the appropriate number for OPENVDB_ABI_VERSION_NUMBER
and other ebuilds can use these flags to determine which openvdb
abi to build against. It is required that openvdb and all programs
linking with it build against the same openvdb version.

These use flags are no longer set by default in the ebuild, so
the user must ensure they set abiX-compat in package.use for openvdb
and any other package using openvdb (which will be the new versions
of blender and openimageio).

These use flags must be set even if the user wants to build againt the
latest supported abi version (eg abi5-compat for openvdb-5.2.0), which
is a change from the old behaviour.

I personally think this would be better hidden away inside an eclass
and a USE_EXPAND variable. I have submitted a proposal and would
be happy to prepare a PR if desired. This can be found at https://
archives.gentoo.org/gentoo-dev/message/1df75c608c83530b43c6ea67e1db8930

Signed-off-by: Adrian Grigo <agrigo2001 <AT> yahoo.com.au>
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-gfx/openvdb/metadata.xml            | 11 +++++++----
 media-gfx/openvdb/openvdb-4.0.2-r3.ebuild | 17 +++++++++++++++--
 media-gfx/openvdb/openvdb-5.2.0-r1.ebuild | 20 +++++++++++++++++---
 3 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/media-gfx/openvdb/metadata.xml b/media-gfx/openvdb/metadata.xml
index 74706159594..43363d09c1a 100644
--- a/media-gfx/openvdb/metadata.xml
+++ b/media-gfx/openvdb/metadata.xml
@@ -15,11 +15,14 @@
 		Chance of Meatballs2' and 'How to Train Your Dragon 2'. 
 	</longdescription>
 	<use>
-		<flag restrict="&lt;media-gfx/openvdb-5.0.0" name="abi3-compat">
-			Disables newer features to maintain compatibility with ABI3. Enabled by default.
+		<flag name="abi3-compat">
+			Disables newer features to maintain compatibility with ABI3.
 		</flag>
-		<flag restrict="&gt;=media-gfx/openvdb-5.0.0" name="abi4-compat">
-			Disables newer features to maintain compatibility with ABI4. Enabled by default.
+		<flag restrict="&gt;=media-gfx/openvdb-4.0.0" name="abi4-compat">
+			Disables newer features to maintain compatibility with ABI4.
+		</flag>
+		<flag restrict="&gt;=media-gfx/openvdb-5.0.0" name="abi5-compat">
+			Disables newer features to maintain compatibility with ABI5.
 		</flag>
 	</use>
 	<upstream>

diff --git a/media-gfx/openvdb/openvdb-4.0.2-r3.ebuild b/media-gfx/openvdb/openvdb-4.0.2-r3.ebuild
index 7a9db2c7125..a34fc012d95 100644
--- a/media-gfx/openvdb/openvdb-4.0.2-r3.ebuild
+++ b/media-gfx/openvdb/openvdb-4.0.2-r3.ebuild
@@ -15,9 +15,13 @@ SRC_URI="https://github.com/AcademySoftwareFoundation/${PN}/archive/v${PV}.tar.g
 LICENSE="MPL-2.0"
 SLOT="0"
 KEYWORDS="amd64 ~x86"
-IUSE="+abi3-compat doc python test"
+IUSE="abi3-compat abi4-compat doc python test"
 RESTRICT="!test? ( test )"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	^^ ( abi3-compat abi4-compat )
+"
 
 RDEPEND="
 	dev-libs/boost:=
@@ -71,6 +75,15 @@ src_configure() {
 	# To stay in sync with Boost
 	append-cxxflags -std=c++14
 
+	local version
+	if use abi3-compat; then
+		version=3
+	elif use abi4-compat; then
+		version=4
+	else
+		die "Openvdb abi version is not compatible"
+	fi
+
 	local mycmakeargs=(
 		-DBLOSC_LOCATION="${myprefix}"
 		-DCMAKE_INSTALL_DOCDIR="share/doc/${PF}"

diff --git a/media-gfx/openvdb/openvdb-5.2.0-r1.ebuild b/media-gfx/openvdb/openvdb-5.2.0-r1.ebuild
index 383beb06342..4a84ca540d1 100644
--- a/media-gfx/openvdb/openvdb-5.2.0-r1.ebuild
+++ b/media-gfx/openvdb/openvdb-5.2.0-r1.ebuild
@@ -14,9 +14,12 @@ SRC_URI="https://github.com/AcademySoftwareFoundation/${PN}/archive/v${PV}.tar.g
 LICENSE="MPL-2.0"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE="+abi4-compat doc python test"
+IUSE="abi3-compat abi4-compat abi5-compat doc python test"
 RESTRICT="!test? ( test )"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	^^ ( abi3-compat abi4-compat abi5-compat )
+"
 
 RDEPEND="
 	dev-libs/boost:=
@@ -64,11 +67,22 @@ pkg_setup() {
 src_configure() {
 	local myprefix="${EPREFIX}/usr/"
 
+	local version
+	if use abi3-compat; then
+		version=3
+	elif use abi4-compat; then
+		version=4
+	elif use abi5-compat; then
+		version=5
+	else
+		die "Openvdb ABI version not specified"
+	fi
+
 	local mycmakeargs=(
 		-DBLOSC_LOCATION="${myprefix}"
 		-DCMAKE_INSTALL_DOCDIR="share/doc/${PF}"
 		-DGLFW3_LOCATION="${myprefix}"
-		-DOPENVDB_ABI_VERSION_NUMBER=$(usex abi4-compat 4 5)
+		-DOPENVDB_ABI_VERSION_NUMBER="${version}"
 		-DOPENVDB_BUILD_DOCS=$(usex doc)
 		-DOPENVDB_BUILD_PYTHON_MODULE=$(usex python)
 		-DOPENVDB_BUILD_UNITTESTS=$(usex test)