File x265.spec of Package x265

181
 
1
#
2
# spec file for package x265
3
#
4
# Copyright (c) 2024 Packman Team <packman@links2linux.de>
5
# Copyright (c) 2014 Torsten Gruner <t.gruner@katodev.de>
6
#
7
# All modifications and additions to the file contributed by third parties
8
# remain the property of their copyright owners, unless otherwise agreed
9
# upon. The license for this file, and modifications and additions to the
10
# file, is the same license as for the pristine package itself (unless the
11
# license for the pristine package is not an Open Source License, in which
12
# case the license is the MIT License). An "Open Source License" is a
13
# license that conforms to the Open Source Definition (Version 1.9)
14
# published by the Open Source Initiative.
15
16
# Please submit bugfixes or comments via https://bugs.links2linux.org/
17
#
18
19
20
%define sover   209
21
%define libname lib%{name}
22
%define libsoname %{libname}-%{sover}
23
%define uver    3_6
24
Name:           x265
25
Version:        3.6
26
Release:        0
27
Summary:        A free h265/HEVC encoder - encoder binary
28
License:        GPL-2.0-or-later
29
Group:          Productivity/Multimedia/Video/Editors and Convertors
30
URL:            https://bitbucket.org/multicoreware/x265_git
31
Source0:        https://bitbucket.org/multicoreware/x265_git/downloads/%{name}_%{version}.tar.gz
32
Patch1:         x265.pkgconfig.patch
33
Patch3:         0001-Fix-arm-flags.patch
34
Patch4:         0004-Do-not-build-with-assembly-support-on-arm.patch
35
BuildRequires:  cmake
36
%if 0%{?suse_version} > 1500
37
BuildRequires:  gcc-c++
38
%else
39
%if 0%{?sle_version} > 150500
40
BuildRequires:  gcc13
41
BuildRequires:  gcc13-c++
42
%else
43
BuildRequires:  gcc10
44
BuildRequires:  gcc10-c++
45
%endif
46
%endif
47
BuildRequires:  nasm >= 2.13
48
BuildRequires:  pkgconfig
49
%ifarch x86_64
50
BuildRequires:  libnuma-devel >= 2.0.9
51
%endif
52
53
%description
54
x265 is a free library for encoding next-generation H265/HEVC video
55
streams.
56
57
%package -n %{libsoname}
58
Summary:        A free H265/HEVC encoder - encoder binary
59
Group:          Productivity/Multimedia/Video/Editors and Convertors
60
61
%description -n %{libsoname}
62
x265 is a free library for encoding next-generation H265/HEVC video
63
streams.
64
65
%package -n libhdr10plus-%{uver}
66
Summary:        A free HDR10+ library
67
Group:          Productivity/Multimedia/Video/Editors and Convertors
68
69
%description -n libhdr10plus-%{uver}
70
A free library supporting HDR10+.
71
72
%package -n %{libname}-devel
73
Summary:        Libraries and include file for the %{libname} encoder
74
Group:          Development/Libraries/C and C++
75
Requires:       %{libsoname} = %{version}-%{release}
76
Requires:       libhdr10plus-%{uver} = %{version}-%{release}
77
Provides:       %{name}-devel = %{version}
78
Obsoletes:      %{name}-devel < %{version}
79
80
%description -n %{libname}-devel
81
x265 is a free library for encoding next-generation H265/HEVC video
82
streams.
83
84
%prep
85
%autosetup -p1 -n %{name}_%{version}
86
87
%build
88
test -x "$(type -p gcc)"    && CC="$_"
89
test -x "$(type -p g++)"    && CXX="$_"
90
test -x "$(type -p gcc-10)" && CC="$_"
91
test -x "$(type -p g++-10)" && CXX="$_"
92
test -x "$(type -p gcc-13)" && CC="$_"
93
test -x "$(type -p g++-13)" && CXX="$_"
94
export CC="$(readlink -f ${CC})"
95
export CXX="$(readlink -f ${CXX})"
96
CFLAGS='%optflags -Wno-misleading-indentation -Wno-unused-parameter -Wno-unused-variable'
97
CXXFLAGS='%optflags -Wno-misleading-indentation -Wno-unused-parameter -Wno-unused-variable'
98
# set the version by hand
99
sed -i~ "/^include(Version)/d" source/CMakeLists.txt
100
diff -u "$_"~ "$_" && exit 1
101
# force version number in the soname
102
sed -i~ 's/hdr10plus-shared PROPERTIES OUTPUT_NAME hdr10plus/hdr10plus-shared PROPERTIES OUTPUT_NAME hdr10plus-%{version}/' \
103
       source/CMakeLists.txt
104
diff -u "$_"~ "$_" && exit 1
105
106
SOURCE_DIR="$PWD"/source
107
COMMON_FLAGS="-DENABLE_TESTS=OFF -DENABLE_PIC=ON -Wno-dev"
108
HIGH_BIT_DEPTH_FLAGS="-DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DEXPORT_C_API=OFF -DHIGH_BIT_DEPTH=ON"
109
110
%define __sourcedir ./source
111
112
# Build 10bit depth version of the library
113
%define __builddir ./source/build-10bit
114
%cmake $COMMON_FLAGS $HIGH_BIT_DEPTH_FLAGS \
115
%ifarch i586
116
      -DENABLE_ASSEMBLY=OFF
117
%endif
118
119
make %{?_smp_mflags}
120
cd ../..
121
122
# Build 12bit depth version of the library
123
%define __builddir ./source/build-12bit
124
%cmake $COMMON_FLAGS $HIGH_BIT_DEPTH_FLAGS -DMAIN12=ON \
125
%ifarch i586
126
      -DENABLE_ASSEMBLY=OFF
127
%endif
128
129
make %{?_smp_mflags}
130
cd ../..
131
132
mv source/build-10bit/libx265.a source/build-10bit/libx265_main10.a
133
mv source/build-12bit/libx265.a source/build-12bit/libx265_main12.a
134
135
# Build general version of the library linking in the 10/12bit depth versions
136
%define __builddir ./source/build
137
%cmake $COMMON_FLAGS \
138
       -DENABLE_SHARED=ON \
139
       -DX265_LATEST_TAG="%{sover}.0" \
140
       -DX265_VERSION="%{version}" \
141
       -DENABLE_HDR10_PLUS=ON \
142
       -DENABLE_CLI=ON \
143
       -DLINKED_10BIT=ON \
144
       -DLINKED_12BIT=ON \
145
       -DEXTRA_LINK_FLAGS="-L$SOURCE_DIR/build-10bit -L$SOURCE_DIR/build-12bit" \
146
       -DEXTRA_LIB="x265_main10.a;x265_main12.a"
147
make %{?_smp_mflags}
148
cd ../../
149
150
%install
151
%cmake_install
152
find %{buildroot} -type f -name "*.a" -delete -print0
153
154
%check
155
156
%post -n %{libsoname} -p /sbin/ldconfig
157
%postun -n %{libsoname} -p /sbin/ldconfig
158
159
%post -n libhdr10plus-%{uver} -p /sbin/ldconfig
160
%postun -n libhdr10plus-%{uver} -p /sbin/ldconfig
161
162
%files -n %{libsoname}
163
%{_libdir}/%{libname}.so.%{sover}*
164
165
%files -n libhdr10plus-%{uver}
166
%{_libdir}/libhdr10plus-%{version}.so
167
168
%files
169
%{_bindir}/%{name}
170
171
%files -n %{libname}-devel
172
%license COPYING
173
%doc readme.rst
174
%{_includedir}/%{name}.h
175
%{_includedir}/%{name}_config.h
176
%{_includedir}/hdr10plus.h
177
%{_libdir}/pkgconfig/%{name}.pc
178
%{_libdir}/%{libname}.so
179
180
%changelog
181