media-video/rav1e: Add support for the C-API
authorLuca Barbato <lu_zero@gentoo.org>
Mon, 6 Apr 2020 13:01:39 +0000 (15:01 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 6 Apr 2020 13:02:09 +0000 (15:02 +0200)
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
media-video/rav1e/metadata.xml
media-video/rav1e/rav1e-9999.ebuild

index 71e948fffb95371dc498fdd2784bd454e83396c4..8d7337c607f9064331de5bed03be2c2b3c9828cc 100644 (file)
@@ -4,4 +4,7 @@
   <maintainer type="person">
     <email>lu_zero@gentoo.org</email>
   </maintainer>
+  <use>
+    <flag name="capi">Build the C-API library and header file</flag>
+  </use>
 </pkgmetadata>
index 131796f9e62c0525f2ac203f13c70adbdcd1f51e..3865291f3bed6330335efdee12e084a4de945c4c 100644 (file)
@@ -1,8 +1,6 @@
-# Copyright 2017-2019 Gentoo Authors
+# Copyright 2017-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Auto-Generated by cargo-ebuild 0.2.0
-
 EAPI=7
 
 inherit cargo
@@ -20,11 +18,11 @@ LICENSE="BSD-2"
 SLOT="0"
 
 KEYWORDS=""
-IUSE=""
+IUSE="+capi"
 
 ASM_DEP=">=dev-lang/nasm-2.14"
 DEPEND="amd64? ( ${ASM_DEP} )"
-RDEPEND=""
+RDEPEND="capi? ( dev-util/cargo-c )"
 
 src_unpack() {
        if [[ "${PV}" == *9999* ]]; then
@@ -32,3 +30,30 @@ src_unpack() {
                cargo_live_src_unpack
        fi
 }
+
+src_compile() {
+       export CARGO_HOME="${ECARGO_HOME}"
+       local args=$(usex debug "" --release)
+
+       cargo build ${args} \
+               || die "cargo build failed"
+
+       if use capi; then
+               cargo cbuild ${args} \
+                       --prefix="/usr" --libdir="/usr/$(get_libdir)" --destdir="${ED}" \
+                       || die "cargo cbuild failed"
+       fi
+}
+
+src_install() {
+       export CARGO_HOME="${ECARGO_HOME}"
+       local args=$(usex debug "" --release)
+
+       if use capi; then
+               cargo cinstall $args \
+                       --prefix="/usr" --libdir="/usr/$(get_libdir)" --destdir="${ED}" \
+                       || die "cargo cinstall failed"
+       fi
+
+       cargo_src_install
+}