I am setting out below what instructions I used to build TVHeadend from source on Ubuntu 22.04 64 bit based on the x86_64 architecture in a simple copy/paste format.Obviously this is aimed at the TVH beginner who wants to build a version of TVH to run on their own particular machine based on the x86_64 architecture.
This was the build process I followed:
You need to install build tools,Git and any possible missing dependencies.
sudo apt install build-essential git libpcre2-dev pkg-config libssl-dev bzip2 wget libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavresample-dev gettext cmake libiconv-hook-dev liburiparser-dev debhelper libcurl4-gnutls-dev
You need to clone the TVH Git
git clone https://github.com/tvheadend/tvheadend.git ~/build/tvheadend/master
Next change to the folder that the Git clone is located in
cd ~/build/tvheadend/master
Then run the autobuild.sh script like this..This command builds Tvheadend with transcoding built-in.
AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh
You may be missing dependencies.If so the output from the Autobuild script will tell you which ones need to be installed. All you have to do is copy/paste the name of each missing package and use the following command to install them.
If as already reported the build process complains it can't find Python, check with the following command if it is actually installed. Ubuntu 22.04 base installation usually comes with Python 3 installed.
python3 --version
If the system reports that Python 3 is indeed installed we need to inform the Autobuild script of this fact. This useful utility will create automatic symlinks pointing the autobuild script to the fact that Python 3 is installed so the autobuild script can continue.
sudo apt install python-is-python3
Now continue on and install any of the missing packages reported by the autobuild script.
sudo apt install [ _any of the missing dependencies that the build process reported missing_ ]
Once all the missing dependencies are installed run the autobuild script again. It could take 20-30 minutes to complete.
AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh
Once the build is complete you will be back at the terminal prompt.The build files will look something like this.You will see them in /build/tvheadend.Take note of the name of the .deb file that build created.That's the file you will be installing.
tvheadend_4.3-373~gcb5f6a1_amd64.deb
tvheadend-dbg_4.3-373~gcb5f6a1_amd64.deb
Finally you can then install them both by running dpkg like this..
cd ~/build/tvheadend
sudo dpkg -i tvheadend*4.3-373~gcb5f6a1_amd64.deb
I suggest you restart you computer once the above is complete. Once restarted you should be ready to configure TVH. It will be located at port 9981
I've been usinf TVH for many years but have never built it myself. I've now got a copy of TVH tailored for my computer which also includes transcoding.
Just to conclude this post
To stay up to date with the latest code (commit) from the TVH Github you can use the following procedure
I followed this procedure to keep my build version up to date with the master version
To get the latest of the TVH code (commit) enter the following
cd ~/build/tvheadend/master
This will navigate you to the folder where your own local version of the TVH code is located
Next we will need to fetch the latest code (commit) from the TVH Github
git pull origin master
Next we need to build TVH again with the latest TVH code (commit)
AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh
Now your should see your new build by doing the following
cd
cd ~/build/tvheadend
ls
Take note of the name of the newly built deb package as you will need it to install it.
The following steps will stop the current TVH service daemon and remove TVH but not all your configuration.
sudo systemctl stop tvheadend
sudo apt remove tvheadend -y
Finally you can now install your freshly built TVH package you built earlier. I'll use the deb package name I created earlier but you will get the actual name of your build from the ls command you used above.
sudo dpkg -i tvheadend_4.3-2038~g5f9404117_amd64.deb
You should now have your latest build of TVH running which can be accessed in the usual way at port 9981 with all your previous configuration settings in place