Project

General

Profile

Building » History » Version 24

Bob Lightfoot, 2015-03-22 20:02

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