Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/x265/
Date: Mon, 26 Aug 2019 15:34:03
Message-Id: 1566833634.b2ec483688f1a28df945e5c220330da2f96ecc21.aballier@gentoo
1 commit: b2ec483688f1a28df945e5c220330da2f96ecc21
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 26 15:33:36 2019 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 26 15:33:54 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2ec4836
7
8 media-libs/x265: bump to 3.1.2
9
10 Package-Manager: Portage-2.3.73, Repoman-2.3.17
11 Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>
12
13 media-libs/x265/Manifest | 1 +
14 media-libs/x265/x265-3.1.2.ebuild | 195 ++++++++++++++++++++++++++++++++++++++
15 2 files changed, 196 insertions(+)
16
17 diff --git a/media-libs/x265/Manifest b/media-libs/x265/Manifest
18 index 2d278838d13..c1987c739fd 100644
19 --- a/media-libs/x265/Manifest
20 +++ b/media-libs/x265/Manifest
21 @@ -1,4 +1,5 @@
22 DIST x265_2.8.tar.gz 1379551 BLAKE2B c124864a08492739cdde89e44d72c84ad94a0b236d2c59d995e53a26d1a5fb9ec1557a03640a3065a727be69bfb0c0633b50351dc875c9706a1550f488c8ee24 SHA512 c2a8eaec64aa022badcbcd2a96304a9abd9d08489300b6a9c4c9d76066f3d9848e6948238c84ae16ea91bff0b2fac528a67ee29950d94dcd0ea7c0e9e7baa714
23 DIST x265_2.9.tar.gz 1385848 BLAKE2B ff14eba55cea0646ad0ffc12f9032c9033d23c9d805939fc3a049911ebae459eee097349f074dcd224bef97d6140dbc37ee9bd3db54c5473b158e135784d2179 SHA512 270818c7fd84947fde371e32bef225c1880cfb0bcd95378d95b51f50577a134d7cd585fcdfa43b103a24d76c5ad826b09509a07eb9e208e8f2b56f2f77365cf3
24 DIST x265_3.0.tar.gz 1398519 BLAKE2B e3ac28b01e89ce8a428f294c759644a8177e1b79941aba5e1b53033c236e3445f9afeea96f8adf7e5cdcfff8c790ca9fcadcc8b2de6c31ba3fe9ba87321a8ca8 SHA512 bb7665194ddd4bccbb91c16337463ad4ef32111a1e7779e4cc16964df0992aa99e578cb74fef0edbf41119105e4085574247f60541b0558cc36730ea12d2c6ba
25 +DIST x265_3.1.2.tar.gz 1419864 BLAKE2B 1eeb210e58d6977f9a048b84e924d690868aa350b6e736f577b5c1a62b9c5b71cfb2b03f004f26839ea44b9db871313bc9888af95999a576dcc167e79d297c61 SHA512 00fc2d8460657c0d2edcc54fd8c4521785c632f8811b74d0cd0a3efa0f06f1fb8cdd6233ad4917c1f40b3c1f1660a6c97ad947e656b7c3e9a51f8ae84afef65a
26 DIST x265_3.1.tar.gz 1419649 BLAKE2B b9151f136fdc6c0512f481af6c8d4d575ce4c75ef8891b42ca24ddfd1f4802bfe8cd47bb07dfc1834243560a8d36ddd5ca4d79d7b9f140fbd411b5b80ea6b8d4 SHA512 81905b6286a61fada7cb1632d7f8461295a28e8d53ccd53d3c26c60c7d8091df47a1b694de28caa721f632d66940f5ceeb44d3405dc3b079edd17d21c30e7a7d
27
28 diff --git a/media-libs/x265/x265-3.1.2.ebuild b/media-libs/x265/x265-3.1.2.ebuild
29 new file mode 100644
30 index 00000000000..599c1341251
31 --- /dev/null
32 +++ b/media-libs/x265/x265-3.1.2.ebuild
33 @@ -0,0 +1,195 @@
34 +# Copyright 1999-2019 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=5
38 +
39 +inherit cmake-utils multilib-minimal multilib multibuild flag-o-matic
40 +
41 +if [[ ${PV} = 9999* ]]; then
42 + inherit mercurial
43 + EHG_REPO_URI="https://bitbucket.org/multicoreware/x265"
44 +else
45 + SRC_URI="https://bitbucket.org/multicoreware/x265/downloads/${PN}_${PV}.tar.gz"
46 + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~x86"
47 +fi
48 +
49 +DESCRIPTION="Library for encoding video streams into the H.265/HEVC format"
50 +HOMEPAGE="http://x265.org/"
51 +
52 +LICENSE="GPL-2"
53 +# subslot = libx265 soname
54 +SLOT="0/176"
55 +IUSE="+10bit +12bit cpu_flags_arm_neon numa pic power8 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 +}