Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/x265/
Date: Sun, 24 May 2020 20:25:15
Message-Id: 1590351825.eaa562a9de31977fcf6f01360a21f7ef56058a9c.whissi@gentoo
1 commit: eaa562a9de31977fcf6f01360a21f7ef56058a9c
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 23 23:08:38 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sun May 24 20:23:45 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eaa562a9
7
8 media-libs/x265: bump to v3.3
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 media-libs/x265/Manifest | 1 +
14 media-libs/x265/x265-3.3.ebuild | 196 ++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 197 insertions(+)
16
17 diff --git a/media-libs/x265/Manifest b/media-libs/x265/Manifest
18 index 28249212eef..7fdf4137f63 100644
19 --- a/media-libs/x265/Manifest
20 +++ b/media-libs/x265/Manifest
21 @@ -5,3 +5,4 @@ DIST x265_3.1.2.tar.gz 1419864 BLAKE2B 1eeb210e58d6977f9a048b84e924d690868aa350b
22 DIST x265_3.1.tar.gz 1419649 BLAKE2B b9151f136fdc6c0512f481af6c8d4d575ce4c75ef8891b42ca24ddfd1f4802bfe8cd47bb07dfc1834243560a8d36ddd5ca4d79d7b9f140fbd411b5b80ea6b8d4 SHA512 81905b6286a61fada7cb1632d7f8461295a28e8d53ccd53d3c26c60c7d8091df47a1b694de28caa721f632d66940f5ceeb44d3405dc3b079edd17d21c30e7a7d
23 DIST x265_3.2.1.tar.gz 1426255 BLAKE2B 4184cfa290b36f497c5f3a5e3b597bf44e52dd20ba6af21c665d98709c9b984122a339d93aae572756a94549c0c1a293ee195c6c1d34902d298664ecf016f896 SHA512 5cb29b9d4475c1f686f6e31e47ccddde3db1639d5dcf9c058513389a9fdeb35a83b14e30e59498a76dec74bb0b410b6d8f5b1b45d18927be9811bb6a40d8d568
24 DIST x265_3.2.tar.gz 1425689 BLAKE2B 58da4aa52381ec89b0aea1dc896fef92d9ec9fc781fd279acd0a338cd872f52482c81c558dde749c1205dbc13341a9851c381d01e2f312f5e2b4712d2242b7d3 SHA512 08c779026fe4c03797efef9d6a898b16c308355311e167c81b976345eb78039725a31294c77a60b76b4ef648d8720e16b2d6524e7108755531a5375231f5313e
25 +DIST x265_3.3.tar.gz 1438685 BLAKE2B 43806915c3b22fabff71c307dc53e9a3408262528f8ec01bf81168826eee26b468b0e68c738e3c0371f6de6121a3ac090bfaeed0cbfca0a3b8c57710d7f25ad0 SHA512 3d56900ecd58e83d2ecc93d956524e3b0e622dbe3c74a137c7b21f98599245547403401e9ec7f679996fd09fca788aa10272bf17e58a68fce449c8cb555ad7c0
26
27 diff --git a/media-libs/x265/x265-3.3.ebuild b/media-libs/x265/x265-3.3.ebuild
28 new file mode 100644
29 index 00000000000..ca3553d0293
30 --- /dev/null
31 +++ b/media-libs/x265/x265-3.3.ebuild
32 @@ -0,0 +1,196 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=5
37 +
38 +inherit cmake-utils multilib-minimal multilib multibuild flag-o-matic
39 +
40 +if [[ ${PV} = 9999* ]]; then
41 + inherit mercurial
42 + EHG_REPO_URI="https://bitbucket.org/multicoreware/x265"
43 +else
44 + SRC_URI="https://bitbucket.org/multicoreware/x265/downloads/${PN}_${PV}.tar.gz"
45 + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~x86"
46 +fi
47 +
48 +DESCRIPTION="Library for encoding video streams into the H.265/HEVC format"
49 +HOMEPAGE="http://x265.org/"
50 +
51 +LICENSE="GPL-2"
52 +# subslot = libx265 soname
53 +SLOT="0/188"
54 +IUSE="+10bit +12bit cpu_flags_arm_neon numa pic power8 test"
55 +RESTRICT="!test? ( test )"
56 +
57 +ASM_DEPEND=">=dev-lang/yasm-1.2.0"
58 +RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
59 +DEPEND="${RDEPEND}
60 + abi_x86_32? ( ${ASM_DEPEND} )
61 + abi_x86_64? ( ${ASM_DEPEND} )"
62 +
63 +PATCHES=(
64 + "${FILESDIR}/arm.patch"
65 + "${FILESDIR}/neon.patch"
66 + "${FILESDIR}/ppc64.patch"
67 +)
68 +
69 +src_unpack() {
70 + if [[ ${PV} = 9999* ]]; then
71 + mercurial_src_unpack
72 + # Can't set it at global scope due to mercurial.eclass limitations...
73 + export S=${WORKDIR}/${P}/source
74 + else
75 + unpack ${A}
76 + export S="$(echo "${WORKDIR}/${PN}_"*"/source")"
77 + fi
78 +}
79 +
80 +# By default, the library and the encoder is configured for only one output bit
81 +# depth. Meaning, one has to rebuild libx265 if (s)he wants to produce HEVC
82 +# files with a different bit depth, which is annoying. However, upstream
83 +# supports proper namespacing for 8bits, 10bits & 12bits HEVC and linking all
84 +# that together so that the resulting library can produce all three of them
85 +# instead of only one.
86 +# The API requires the bit depth parameter, so that libx265 can then chose which
87 +# variant of the encoder to use.
88 +# To achieve this, we have to build one (static) library for each non-main
89 +# variant, and link it into the main library.
90 +# Upstream documents using the 8bit variant as main library, hence we do not
91 +# allow disabling it: "main" *MUST* come last in the following list.
92 +
93 +x265_get_variants() {
94 + local variants=""
95 + use 12bit && variants+="main12 "
96 + use 10bit && variants+="main10 "
97 + variants+="main"
98 + echo "${variants}"
99 +}
100 +
101 +x265_variant_src_configure() {
102 + mkdir -p "${BUILD_DIR}" || die
103 + pushd "${BUILD_DIR}" >/dev/null || die
104 +
105 + local mycmakeargs=( "${myabicmakeargs[@]}" )
106 + case "${MULTIBUILD_VARIANT}" in
107 + "main12")
108 + mycmakeargs+=(
109 + -DHIGH_BIT_DEPTH=ON
110 + -DEXPORT_C_API=OFF
111 + -DENABLE_SHARED=OFF
112 + -DENABLE_CLI=OFF
113 + -DMAIN12=ON
114 + )
115 + if [[ ${ABI} = x86 ]] ; then
116 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
117 + fi
118 + if [[ ${ABI} = arm ]] ; then
119 + # 589674
120 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
121 + fi
122 + if [[ ${ABI} = ppc64 ]] ; then
123 + # https://bugs.gentoo.org/show_bug.cgi?id=607802#c5
124 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF -DENABLE_ALTIVEC=OFF )
125 + fi
126 + ;;
127 + "main10")
128 + mycmakeargs+=(
129 + -DHIGH_BIT_DEPTH=ON
130 + -DEXPORT_C_API=OFF
131 + -DENABLE_SHARED=OFF
132 + -DENABLE_CLI=OFF
133 + )
134 + if [[ ${ABI} = x86 ]] ; then
135 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
136 + fi
137 + if [[ ${ABI} = arm ]] ; then
138 + # 589674
139 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
140 + fi
141 + if [[ ${ABI} = ppc64 ]] ; then
142 + # https://bugs.gentoo.org/show_bug.cgi?id=607802#c5
143 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF -DENABLE_ALTIVEC=OFF )
144 + fi
145 + ;;
146 + "main")
147 + if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
148 + local myvariants=( "${MULTIBUILD_VARIANTS[@]}" )
149 + unset myvariants[${#MULTIBUILD_VARIANTS[@]}-1]
150 + local liblist=""
151 + for v in "${myvariants[@]}" ; do
152 + ln -s "${BUILD_DIR%-*}-${v}/libx265.a" "libx265_${v}.a" || die
153 + liblist+="libx265_${v}.a;"
154 + done
155 + mycmakeargs+=(
156 + -DEXTRA_LIB="${liblist}"
157 + -DEXTRA_LINK_FLAGS=-L.
158 + -DLINKED_10BIT=$(usex 10bit)
159 + -DLINKED_12BIT=$(usex 12bit)
160 + )
161 + fi
162 + ;;
163 + *)
164 + die "Unknown variant: ${MULTIBUILD_VARIANT}";;
165 + esac
166 + cmake-utils_src_configure
167 + popd >/dev/null || die
168 +}
169 +
170 +multilib_src_configure() {
171 + append-cflags -fPIC
172 + append-cxxflags -fPIC
173 + local myabicmakeargs=(
174 + $(cmake-utils_use_enable test TESTS)
175 + $(multilib_is_native_abi || echo "-DENABLE_CLI=OFF")
176 + -DENABLE_LIBNUMA=$(usex numa ON OFF)
177 + -DCPU_POWER8=$(usex power8 ON OFF)
178 + -DENABLE_ALTIVEC=$(usex power8 ON OFF)
179 + -DLIB_INSTALL_DIR="$(get_libdir)"
180 + )
181 +
182 + if [[ ${ABI} = x86 ]] ; then
183 + # Bug #528202
184 + if use pic ; then
185 + ewarn "PIC has been requested but x86 asm is not PIC-safe, disabling it."
186 + myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
187 + fi
188 + elif [[ ${ABI} = x32 ]] ; then
189 + # bug #510890
190 + myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
191 + elif [[ ${ABI} = arm ]] ; then
192 + myabicmakeargs+=( -DENABLE_ASSEMBLY=$(usex pic OFF $(usex cpu_flags_arm_neon ON OFF)) )
193 + use cpu_flags_arm_neon && use pic && ewarn "PIC has been requested but arm neon asm is not PIC-safe, disabling it."
194 + fi
195 +
196 + local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
197 + multibuild_foreach_variant x265_variant_src_configure
198 +}
199 +
200 +multilib_src_compile() {
201 + local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
202 + multibuild_foreach_variant cmake-utils_src_compile
203 +}
204 +
205 +x265_variant_src_test() {
206 + if [ -x "${BUILD_DIR}/test/TestBench" ] ; then
207 + "${BUILD_DIR}/test/TestBench" || die
208 + else
209 + einfo "Unit tests check only assembly."
210 + einfo "You do not seem to have any for ABI=${ABI}, x265 variant=${MULTIBUILD_VARIANT}"
211 + einfo "Skipping tests."
212 + fi
213 +}
214 +
215 +multilib_src_test() {
216 + local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
217 + multibuild_foreach_variant x265_variant_src_test
218 +}
219 +
220 +multilib_src_install() {
221 + # Install only "main" variant since the others are already linked into it.
222 + local MULTIBUILD_VARIANTS=( "main" )
223 + multibuild_foreach_variant cmake-utils_src_install
224 +}
225 +
226 +multilib_src_install_all() {
227 + dodoc -r "${S}/../doc/"*
228 +}