Forums » Tutorial and setups »
Building from source for Fedora 32: any tips?
Added by Jason Hecker over 4 years ago
I'm trying to build Tvheadend from source for Fedora 32. I've been trying to follow the instructions at [[https://tvheadend.org/projects/tvheadend/wiki/Packaging]]. I'm getting stuck with the source RPM and spec file, ie where to obtain them and how to modify them. Does anyone have any info on how to get a proper source RPM and spec file, or any tips/tutorials overall for building a Tvheadend RPM from source?
Replies (11)
RE: Building from source for Fedora 32: any tips? - Added by saen acro over 4 years ago
When clone repo there is a RPM folder with needed files
I try lot of time to build RPM for CentOS, all time no success.
RE: Building from source for Fedora 32: any tips? - Added by Jason Hecker over 4 years ago
You're absolutely right! I should have seen that when I cloned the repo. The instructions on the Packaging page on the wiki are very out of date. Here's what I've done:
### Get the source from the repo
cd ~/git
git clone https://github.com/tvheadend/tvheadend.git
cd ~/git/tvheadend
### Configure
./configure
make # This step probably not needed
cd ~/git/tvheadend/rpm
make
### Move the spec file into the rpmbuild directory
cp tvheadend.spec ~/rpmbuild/SPECS
### Download the source tar.gz specified in the spec file
cd ~/rpmbuild/SOURCES
wget https://github.com/tvheadend/tvheadend/archive/0f13f5912921321a7061ffde760ec41c32d99e77/tvheadend-0f13f5912921321a7061ffde760ec41c32d99e77.tar.gz
### Build the source rpm
cd ~
rpmbuild -bs rpmbuild/SPECS/tvheadend.spec
### Build the rpm
rpmbuild --rebuild rpmbuild/SRPMS/tvheadend-4.3-1892~g0f13f5912.fc32.src.rpm
However, the build is still failing. It gets quite a way into the build but it runs into a problem with python:
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
*** WARNING: ./usr/share/tvheadend/data/dvb-scan/dvb-t/au-Adelaide is executable but has no shebang, removing executable bit
*** ERROR: ambiguous python shebang in /usr/bin/tv_meta_tmdb.py: #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
*** ERROR: ambiguous python shebang in /usr/bin/tv_meta_tvdb.py: #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
mangling shebang in /usr/bin/tvhmeta from /usr/bin/env python2.7 to #!/usr/bin/python2.7
error: Bad exit status from /var/tmp/rpm-tmp.8ahf9V (%install)
In the spec file I've tried changing PYTHON=python2 to PYTHON=python3 or even just PYTHON=python, but the build still fails. So I'm still stuck.
RE: Building from source for Fedora 32: any tips? - Added by saen acro over 4 years ago
Make manual as this one
https://tvheadend.org/boards/4/topics/24116
RE: Building from source for Fedora 32: any tips? - Added by Jason Hecker over 4 years ago
I can't see anything in configure that would be causing the failure:
Checking support/features
checking for cc execinfo.h ... ok
checking for cc -mmmx ... ok
checking for cc -msse2 ... ok
checking for cc -Wunused-result ... ok
checking for cc -fstack-protector ... ok
checking for cc -fstack-protector-strong ... ok
checking for cc -fstack-check ... ok
checking for cc -fPIE ... ok
checking for cc strlcat ... fail
checking for cc strlcpy ... fail
checking for cc fdatasync ... ok
checking for cc getloadavg ... ok
checking for cc atomic32 ... ok
checking for cc atomic64 ... ok
checking for cc atomic_time_t ... ok
checking for cc atomic_ptr ... ok
checking for cc bitops64 ... ok
checking for cc lockowner ... ok
checking for cc qsort_r ... ok
checking for cc stime ... fail
checking for cc gmtoff ... ok
checking for cc recvmmsg ... ok
checking for cc sendmmsg ... ok
checking for cc libiconv ... fail
^ using build-in glibc iconv routines
checking for cc ifnames ... ok
checking for cc cclang_threadsan ... fail
checking for py module gzip ... ok
checking for pkg-config ... ok
checking for xgettext ... ok
checking for msgmerge ... ok
checking for gzip ... ok
checking for bzip2 ... ok
checking for pkg openssl ... ok (detected 1.1.1g)
checking for cc linux/dvb/version.h ... ok
checking for pkg zlib ... ok (detected 1.2.11)
checking for pkg libpcre2-8 ... ok (detected 10.35)
checking for pkg liburiparser ... ok (detected 0.9.4)
checking for pkg avahi-client ... ok (detected 0.7)
checking for cmake ... ok
checking for cc -lstdc++ ... ok
checking for pkg libva >=0.38.0 ... ok (detected 1.7.0)
checking for pkg libva-x11 >=0.38.0 ... ok (detected 1.7.0)
checking for pkg libva-drm >=0.38.0 ... ok (detected 1.7.0)
checking for cc sys/inotify.h ... ok
checking for cc inotify_init1 ... ok
checking for cc dvbcsa/dvbcsa.h ... ok
checking for cc -ldvbcsa ... ok
fetching dvb-scan files ... ok
checking for cc epoll_create1 ... ok
checking for pkg dbus-1 ... ok (detected 1.12.20)
Compiler:
Using C compiler: cc
Using LD flags: -ldvbcsa
Build for arch: x86_64
Binaries:
Using PYTHON: python
Using GZIP: gzip
Using BZIP2: bzip2
Options:
pie yes
ccdebug no
cardclient yes
cwc yes
cccam yes
capmt yes
constcw yes
linuxdvb yes
satip_server yes
satip_client yes
hdhomerun_client yes
hdhomerun_static yes
iptv yes
tsfile yes
dvbscan yes
timeshift yes
trace yes
avahi yes
zlib yes
libav yes
ffmpeg_static yes
libx264 yes
libx264_static yes
libx265 yes
libx265_static yes
libvpx yes
libvpx_static yes
libtheora yes
libtheora_static yes
libvorbis yes
libvorbis_static yes
libfdkaac no
libfdkaac_static no
libopus yes
libopus_static yes
nvenc no
vaapi yes
mmal no
omx no
inotify yes
epoll yes
pcre no
pcre2 yes
uriparser yes
ccache no
tvhcsa yes
bundle no
pngquant no
kqueue no
dbus_1 yes
android no
gtimer_check no
slow_memoryinfo no
libsystemd_daemon no
pcloud_cache yes
ddci yes
cclang_threadsan no
gperftools no
execinfo yes
mmx yes
sse2 yes
W_unused_result yes
f_stack_protector yes
f_stack_protector_strong yes
f_stack_check yes
f_PIE yes
fdatasync yes
getloadavg yes
atomic32 yes
atomic64 yes
atomic_time_t yes
atomic_ptr yes
bitops64 yes
lockowner yes
qsort_r yes
gmtoff yes
recvmmsg yes
sendmmsg yes
ifnames yes
py_gzip yes
bin_pkg_config yes
bin_xgettext yes
bin_msgmerge yes
bin_gzip yes
bin_bzip2 yes
ssl yes
linuxdvbapi yes
linuxdvb_ca yes
upnp yes
bin_cmake yes
stdcpp yes
libogg_static yes
hwaccels yes
inotify_h yes
inotify_init1 yes
dvbcsa yes
epoll_create1 yes
mpegts yes
mpegts_dvb yes
Packages:
openssl 1.1.1g
zlib 1.2.11
libpcre2-8 10.35
liburiparser 0.9.4
avahi-client 0.7
libva 1.7.0
libva-x11 1.7.0
libva-drm 1.7.0
dbus-1 1.12.20
Installation paths:
Prefix: /usr/local
Binaries: ${prefix}/bin
Libraries: ${prefix}/lib
Data files: ${prefix}/share
Man pages: ${datadir}/man
Final Binary:
/home/jhecker/git/tvheadend/build.linux/tvheadend
Tvheadend Data Directory:
/usr/local/share/tvheadend
RE: Building from source for Fedora 32: any tips? - Added by Flole Systems over 4 years ago
Jason Hecker wrote:
In the spec file I've tried changing PYTHON=python2 to PYTHON=python3 or even just PYTHON=python, but the build still fails. So I'm still stuck.
Well it tells you exactly what is wrong and even tells you what you need to do to get around it, there's really not much more that can be done.
RE: Building from source for Fedora 32: any tips? - Added by saen acro over 4 years ago
Problem come with building binary.
RE: Building from source for Fedora 32: any tips? - Added by Jason Hecker over 4 years ago
Flole Systems wrote:
Well it tells you exactly what is wrong and even tells you what you need to do to get around it, there's really not much more that can be done.
I'm not sure what I need to do. I'd be grateful for any insight you could provide.
RE: Building from source for Fedora 32: any tips? - Added by Jason Hecker over 4 years ago
After some trial and error, I've done the following:
Install:
python3-devel
In the spec file, add:
BuildRequires: /usr/bin/pathfix.py
# And at the end of the %prep section:
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" .
Now the build completes successfully, and I'm able to install the RPM. Everything seems to be working as expected, but I don't know if this is the proper way to resolve the issue or just a 'quick and dirty' hack.
RE: Building from source for Fedora 32: any tips? - Added by saen acro over 4 years ago
Jason Hecker wrote:
After some trial and error, I've done the following:
Install: [...]
In the spec file, add:
[...]
Now the build completes successfully, and I'm able to install the RPM. Everything seems to be working as expected, but I don't know if this is the proper way to resolve the issue or just a 'quick and dirty' hack.
In Centos there is no such part
%prep section
P.S.
Isnt more better to use
wget https://github.com/User/repo/archive/master.tar.gz
not a static link?
RE: Building from source for Fedora 32: any tips? - Added by Jason Hecker over 4 years ago
I'm not sure why your spec file doesn't have a %prep
section. I've never used CentOS, so I don't know if ./configure
generates something differently for it?
As for what to download from git, the spec file generates a dynamic link (see spec file below). However, rpmbuild
doesn't seem to download the source automatically, so I download it manually (based on the link in the spec file) and place it in the SOURCES directory before running the build.
Here is the spec file that gets generated after running ./configure
and then make
(and before I alter it to get around the python issue):
%global ref 0f13f5912921321a7061ffde760ec41c32d99e77
%global commit 0f13f5912921321a7061ffde760ec41c32d99e77
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global tvheadend_user %{name}
%global tvheadend_group %{name}
%global tvheadend_group_number 283
Name: tvheadend
Summary: TV streaming server and Digital Video Recorder
Version: 4.3
Release: 1892~g0f13f5912%{?dist}
License: GPLv3
Group: Applications/Multimedia
URL: http://tvheadend.org
Source: https://github.com/tvheadend/tvheadend/archive/%{ref}/tvheadend-%{commit}.tar.gz
#Patch999: test.patch
BuildRequires: bzip2
BuildRequires: gcc
BuildRequires: gettext
BuildRequires: gzip
BuildRequires: systemd-units
BuildRequires: gettext-devel
BuildRequires: dbus-devel
BuildRequires: avahi-devel
BuildRequires: avahi-libs
BuildRequires: libdvbcsa-devel
BuildRequires: openssl-devel
BuildRequires: wget python git
BuildRequires: cmake
BuildRequires: python2
%{?systemd_requires}
Requires: bzip2
Requires: tar
%description
Tvheadend is a TV streaming server with Digital Video Recorder functionality
for Linux supporting DVB, ATSC, IPTV, SAT>IP, HDHomeRun as input sources.
It can be used as a back-end to HTTP (VLC, MPlayer), HTSP (Movian, Kodi),
SAT>IP and various other clients using these protocols.
%prep
%setup -q -n tvheadend-%{commit}
#%patch999 -p1 -b .test
%build
echo %{version}-%{release} > %{_builddir}/%{buildsubdir}/rpm/version
%ifarch %arm
%configure --disable-lockowner --disable-ffmpeg_static
%else
%configure --disable-lockowner --enable-ffmpeg_static --enable-libx265
%endif
%make_build PYTHON=python2
%install
%make_install
install -Dpm 0644 rpm/tvheadend.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -Dpm 0644 rpm/tvheadend.service %{buildroot}%{_unitdir}/%{name}.service
install -dm 0755 %{buildroot}%{_sharedstatedir}/%{name}/
chmod 0644 %{buildroot}%{_mandir}/man1/%{name}.1
%pre
getent group tvheadend >/dev/null || groupadd -f -g %{tvheadend_group_number} -r tvheadend
if ! getent passwd tvheadend > /dev/null ; then
if ! getent passwd %{tvheadend_group_number} > /dev/null ; then
useradd -r -l -u %{tvheadend_group_number} -g tvheadend \
-d %{_sharedstatedir}/%{name}/ -s /sbin/nologin \
-c "Tvheadend TV server" tvheadend
else
useradd -r -l -g tvheadend -d /home/tvheadend \
-s /sbin/nologin -c "Tvheadend TV server" tvheadend
fi
fi
exit 0
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%doc CONTRIBUTING.md README.md
%license LICENSE.md licenses/gpl-3.0.txt
%{_bindir}/*
%{_datadir}/%{name}/
%{_unitdir}/*
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_mandir}/man1/*.1.*
%attr(-,%{tvheadend_user},%{tvheadend_group}) %dir %{_sharedstatedir}/%{tvheadend_user}/
%changelog
* Fri Apr 20 2018 Jaroslav Kysela <[email protected]> 4.2.6-1
- many fixes
* Wed May 27 2015 Jaroslav Kysela <[email protected]> 4.0.3-1
- rpmlint fixes
* Mon May 25 2015 Jaroslav Kysela <[email protected]> 4.0.2-1
- fix requires (libs) and improve description
- add support for final version to Source
* Thu May 21 2015 Jaroslav Kysela <[email protected]> 4.0.1-1
- changed versioning system (put changes and git hash to revision)
* Thu May 14 2015 Jaroslav Kysela <[email protected]> 3.9-2842
- add python to BuildRequires
* Wed Mar 25 2015 Bob Lightfoot <[email protected]> 3.9-2658-gb427d7e
- Patching rpm spec file so the arm architecture builds properly
* Mon Oct 13 2014 Jaroslav Kysela <[email protected]> 3.9-1806-g6f3324e
- RPM: Typo fixes
* Mon Oct 13 2014 Jaroslav Kysela <[email protected]> 3.9-1805-g14a7de8
- RPM build - config fixes
* Mon Oct 13 2014 Jaroslav Kysela <[email protected]> 3.9-1803-g392dec0
- Add basic RPM build support
RE: Building from source for Fedora 32: any tips? - Added by Jason Hecker over 4 years ago
If you want to have rpmbuild download the source listed in the spec file automatically, you change the build command to:
rpmbuild --undefine=_disable_source_fetch -bs rpmbuild/SPECS/tvheadend.spec
And if you also want to skip the step of building the source rpm first, you change the command to:
rpmbuild --undefine=_disable_source_fetch -ba rpmbuild/SPECS/tvheadend.spec