Project

General

Profile

Building » History » Version 12

Bob Lightfoot, 2015-03-18 22:09

1 1 Adam Sutton
h1. Building
2
3 2 Adam Sutton
h2. Prerequisites
4
5 3 Adam Sutton
Before you can build Tvheadend you will need several packages installed on your development machine. 
6 2 Adam Sutton
7
The specific details will vary between distributions so we only cover the major ones here.
8
9
h3. Debian/Ubuntu
10
11
<pre>
12 7 Adam Sutton
$ sudo aptitude install build-essential git pkg-config libssl-dev bzip2 wget
13 2 Adam Sutton
</pre>
14
15
> Optional:
16
<pre>
17 9 John Törnblom
$ sudo aptitude install libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev
18 2 Adam Sutton
</pre>
19
20
h3. Redhat
21
22 12 Bob Lightfoot
h2. Redhat/Centos/Fedora Build assumptions
23
<pre>
24
Redhat/Centos/Fedora are a package managed OS and as such tvheadend should be installed from an rpm on a production system.  
25
This set of instructions details using tools git, mock and rpmbuild to package the source into an rpm and then install the rpm
26
</pre>
27
28
h2. Build Environment Configuration
29
     install the software used for building tvheadened
30
<pre>
31
$sudo yum install git mock
32
</pre>
33
     create a user to do the building as
34
<pre>
35
$sudo useradd mock
36
$sudo passwd mock
37
</pre>
38
     for more details view the Centos/Fedora Mock pages starting
39
     http://fedoraproject.org/wiki/Projects/Mock
40
41
h2. Getting the files to work with
42
    tvheadend sources are retrieved as follow
43
<pre>
44
$su mock
45
$mkdir git
46
$cd git
47
$ git clone https://github.com/tvheadend/tvheadend.git
48
</pre>
49
50
     create a workfiles holding directory
51
<pre>
52
$mkdir ~/tvheadend
53
</pre>
54
55
     you'll also need a starter source rpm and specfile found through one of the following in the ~/tvheadend folder:
56
     https://tvheadend.org/boards/4/topics/14666
57
     https://tvheadend.org/attachments/download/2823/tvheadend-4.0.01012015-1.src.rpm
58
     https://tvheadend.org/attachments/download/2738/tvheadend-4.0.01012015-1.spec
59
60
h2. Step by Step Building the RPM
61
62
     enter the local git repository and reset local to most current remote
63
<pre>
64
$cd ~/git/tvheadend
65
$git fetch origin
66
$git reset --hard origin/master
67
</pre>
68
69
      determine the commit id of the master branch
70
<pre>
71
$git show-ref --head
72
</pre>
73
74
      create the spec file for the next version
75
      # note new and old are the date-revision strings
76
<pre>
77
$cp tvheadend-old.spec tvheadend-new.spec
78
</pre>
79
80
      open the new spec and edit as follows
81
      update the global commit string to match the current master commit
82
      change the version string to match the new being built
83
      change the git archive comment line to be the correct values commit tag and filename
84
      change the source0 filename also
85
      save the spec file for use later
86
<pre>
87
$vi tvheadend-new
88
</pre>
89
90
      switch to the git tvheadened master and export the archive file called for in the new spec to the ~/tvheadend folder
91
<pre>
92
$cd ~/git/tvheadend
93
$git archive 96898a66e96927e4ace9a637ea923fd9f514dd1d --format=tar --prefix=tvheadend/ | gzip > ../tvheadend-4.0.03182015.tar.gz
94
$mv ../tvheadend-4.0.03182015.tar.gz ~/tvheadend
95
</pre>
96
97
      mock setup
98
           {for Fedora you'll need to use the rpmfusion environment}
99
           (for centos you'll need to use nuxro's repos as an environment}
100
      the /etc/mock/nux-7-x86_64.cfg can be created by adding following to the epel7.cfg and renaming as saved
101
102
<pre>
103
[nux-dextop]
104
name=Nux.Ro RPMs for general desktop use
105
baseurl=http://li.nux.ro/download/nux/dextop/el7/$basearch/ http://mirror.li.nux.ro/li.nux.ro/nux/dextop/el7/$basearch/
106
enabled=1
107
gpgcheck=1
108
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
109
protect=0
110
111
[nux-dextop-testing]
112
name=Nux.Ro RPMs for general desktop use - testing
113
baseurl=http://li.nux.ro/download/nux/dextop-testing/el7/$basearch/
114
enabled=0
115
gpgcheck=1
116
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
117
protect=0
118
</pre>
119
120
      mock clean the mock build environment 
121
<pre>
122
$mock --init -r nux-7-x86_64
123
</pre>
124
125
      now build the previous version in the clean environment
126
<pre>
127
$mock -r nux-7-x86_64 --rebuild tvheadend-4.0.01012015-1.src.rpm
128
</pre>
129
130
      copy in the new source tar and spec files
131
<pre>
132
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015.tar.gz builddir/build/SOURCES/
133
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015-1.spec builddir/build/SPECS/tvheadend.spec
134
</pre>
135
136
       shell in and confirm new source and spec are present and then build new src.rpm
137
<pre>
138
$mock -r nux-7-x86_64 --no-clean --shell
139
<mock>$ls -lah builddir/build/SOURCES
140
<mock>$ls -lah builddir/build/SPECS
141
<mock>$rpmbuild -bs builddir/build/SPECS/tvheadend.spec
142
<mock>$exit
143
</pre>
144
145
       copy out the new src.rpm
146
<pre>
147
$mock -r nux-7-x86_64 --no-clean --copyout builddir/build/SRPMS/tvheadend-4.0.03182015-1.src.rpm ./
148
</pre>
149
150
       build the new version from the source rpm
151
<pre>
152
$mock -r nux-7-x86_64 --rebuild tvheadend-4.0.03182015-1.src.rpm
153
</pre>
154
155
       move the results to your working folder
156
<pre>
157
$cp /var/lib/mock/nux-7-x86_64/result/*.rpm ./
158
</pre>
159
160
h2. Install the RPM
161
<pre>
162
$ sudo yum install /home/mock/tvheadend/tvheadend-4.0.03182015-1.x86_64.rpm
163
</pre>
164
165 2 Adam Sutton
166
h3. Gentoo
167
168
TODO: this needs adding
169
170
h2. Get Source
171
172
Next you must obtain the source code, this is hosted on "github":https://github.com/tvheadend/tvheadend.
173
174
To clone the repository simple run the command:
175
176
<pre>
177
$ git clone https://github.com/tvheadend/tvheadend.git
178
</pre>
179
180
h2. Configuring
181
182
TVHeadend comes with a configuration script that allows you to enable/disable optional components and set install paths, etc.
183
184
Most people will be fine with the defaults and can run:
185
186
<pre>
187
$ ./configure
188
</pre>
189
190
However for more advanced options, please run the following:
191
192
<pre>
193
$ ./configure --help
194
</pre>
195
196
And then re-run configure with the required options, i.e.:
197
198
<pre>
199 10 John Törnblom
$ ./configure --disable-dvbscan
200 2 Adam Sutton
</pre>
201
202
h2. Compiling
203
204 3 Adam Sutton
To compile Tvheadend run:
205 2 Adam Sutton
206
<pre>
207
$ make
208
</pre>
209
210
h2. Installing
211
212 3 Adam Sutton
It is possible to install Tvheadend using make, based on the ./configure options, by running:
213 2 Adam Sutton
214
<pre>
215
$ sudo make install
216
</pre>
217
218 11 Adam Sutton
However it's recommend that you run from the build directory for development/testing (see [[Development]]):
219 2 Adam Sutton
220
<pre>
221
$ ./build.linux/tvheadend
222
</pre>
223
224 4 Adam Sutton
NOTE: its VERY important you run test builds from git root, so command should look similar to above.
225
226 3 Adam Sutton
And that you build a [[Packaging|package]] if you wish to install Tvheadend permanently and hook into the system start scripts etc.
227 2 Adam Sutton
228
Use of make install is not very traceable and so removal can sometimes be painful, and it might overwrite an existing installation.
229
230
h2. Packaging
231
232 3 Adam Sutton
For more information about packaging Tvheadend please see [[Packaging|here]]
233 2 Adam Sutton
234
h2. Reporting Problems
235
236 3 Adam Sutton
If you have problems with a custom compiled version of Tvheadend its important that any issue reports include details of the specific version of source you used. For more details please see [[bugreporting|here]].