Building » History » Version 19
Bob Lightfoot, 2015-03-19 05:17
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 | 12 | Bob Lightfoot | create a user to do the building as |
37 | <pre> |
||
38 | $sudo useradd mock |
||
39 | $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 | you'll also need a starter source rpm and specfile found through one of the following in the ~/tvheadend folder: |
||
61 | https://tvheadend.org/boards/4/topics/14666 |
||
62 | https://tvheadend.org/attachments/download/2823/tvheadend-4.0.01012015-1.src.rpm |
||
63 | https://tvheadend.org/attachments/download/2738/tvheadend-4.0.01012015-1.spec |
||
64 | |||
65 | 18 | Bob Lightfoot | h4. Step by Step Building the RPM |
66 | 12 | Bob Lightfoot | |
67 | enter the local git repository and reset local to most current remote |
||
68 | <pre> |
||
69 | $cd ~/git/tvheadend |
||
70 | $git fetch origin |
||
71 | $git reset --hard origin/master |
||
72 | </pre> |
||
73 | |||
74 | determine the commit id of the master branch |
||
75 | <pre> |
||
76 | $git show-ref --head |
||
77 | </pre> |
||
78 | |||
79 | 14 | Bob Lightfoot | create the spec file for the next version note new and old are the date-revision strings |
80 | 12 | Bob Lightfoot | <pre> |
81 | $cp tvheadend-old.spec tvheadend-new.spec |
||
82 | </pre> |
||
83 | |||
84 | open the new spec and edit as follows |
||
85 | update the global commit string to match the current master commit |
||
86 | change the version string to match the new being built |
||
87 | change the git archive comment line to be the correct values commit tag and filename |
||
88 | change the source0 filename also |
||
89 | 19 | Bob Lightfoot | also modify the changelog to reflect the new version |
90 | 12 | Bob Lightfoot | save the spec file for use later |
91 | <pre> |
||
92 | $vi tvheadend-new |
||
93 | </pre> |
||
94 | |||
95 | switch to the git tvheadened master and export the archive file called for in the new spec to the ~/tvheadend folder |
||
96 | <pre> |
||
97 | $cd ~/git/tvheadend |
||
98 | $git archive 96898a66e96927e4ace9a637ea923fd9f514dd1d --format=tar --prefix=tvheadend/ | gzip > ../tvheadend-4.0.03182015.tar.gz |
||
99 | $mv ../tvheadend-4.0.03182015.tar.gz ~/tvheadend |
||
100 | </pre> |
||
101 | |||
102 | mock setup |
||
103 | {for Fedora you'll need to use the rpmfusion environment} |
||
104 | 15 | Bob Lightfoot | {for centos you'll need to use nuxro's repos as an environment} |
105 | 12 | Bob Lightfoot | the /etc/mock/nux-7-x86_64.cfg can be created by adding following to the epel7.cfg and renaming as saved |
106 | |||
107 | <pre> |
||
108 | [nux-dextop] |
||
109 | name=Nux.Ro RPMs for general desktop use |
||
110 | baseurl=http://li.nux.ro/download/nux/dextop/el7/$basearch/ http://mirror.li.nux.ro/li.nux.ro/nux/dextop/el7/$basearch/ |
||
111 | enabled=1 |
||
112 | gpgcheck=1 |
||
113 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro |
||
114 | protect=0 |
||
115 | |||
116 | [nux-dextop-testing] |
||
117 | name=Nux.Ro RPMs for general desktop use - testing |
||
118 | baseurl=http://li.nux.ro/download/nux/dextop-testing/el7/$basearch/ |
||
119 | enabled=0 |
||
120 | gpgcheck=1 |
||
121 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro |
||
122 | protect=0 |
||
123 | </pre> |
||
124 | |||
125 | 15 | Bob Lightfoot | clean the mock build environment |
126 | 12 | Bob Lightfoot | <pre> |
127 | $mock --init -r nux-7-x86_64 |
||
128 | </pre> |
||
129 | |||
130 | now build the previous version in the clean environment |
||
131 | <pre> |
||
132 | $mock -r nux-7-x86_64 --rebuild tvheadend-4.0.01012015-1.src.rpm |
||
133 | </pre> |
||
134 | |||
135 | copy in the new source tar and spec files |
||
136 | <pre> |
||
137 | $mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015.tar.gz builddir/build/SOURCES/ |
||
138 | $mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015-1.spec builddir/build/SPECS/tvheadend.spec |
||
139 | </pre> |
||
140 | |||
141 | shell in and confirm new source and spec are present and then build new src.rpm |
||
142 | <pre> |
||
143 | $mock -r nux-7-x86_64 --no-clean --shell |
||
144 | <mock>$ls -lah builddir/build/SOURCES |
||
145 | <mock>$ls -lah builddir/build/SPECS |
||
146 | <mock>$rpmbuild -bs builddir/build/SPECS/tvheadend.spec |
||
147 | <mock>$exit |
||
148 | </pre> |
||
149 | |||
150 | copy out the new src.rpm |
||
151 | <pre> |
||
152 | $mock -r nux-7-x86_64 --no-clean --copyout builddir/build/SRPMS/tvheadend-4.0.03182015-1.src.rpm ./ |
||
153 | </pre> |
||
154 | |||
155 | build the new version from the source rpm |
||
156 | <pre> |
||
157 | $mock -r nux-7-x86_64 --rebuild tvheadend-4.0.03182015-1.src.rpm |
||
158 | </pre> |
||
159 | |||
160 | move the results to your working folder |
||
161 | <pre> |
||
162 | $cp /var/lib/mock/nux-7-x86_64/result/*.rpm ./ |
||
163 | </pre> |
||
164 | |||
165 | 18 | Bob Lightfoot | h4. Install the RPM |
166 | 12 | Bob Lightfoot | |
167 | 16 | Bob Lightfoot | <pre> |
168 | 1 | Adam Sutton | $sudo yum install /home/mock/tvheadend/tvheadend-4.0.03182015-1.x86_64.rpm |
169 | 16 | Bob Lightfoot | </pre> |
170 | 18 | Bob Lightfoot | |
171 | 12 | Bob Lightfoot | |
172 | 2 | Adam Sutton | |
173 | h3. Gentoo |
||
174 | |||
175 | TODO: this needs adding |
||
176 | |||
177 | h2. Get Source |
||
178 | |||
179 | Next you must obtain the source code, this is hosted on "github":https://github.com/tvheadend/tvheadend. |
||
180 | |||
181 | To clone the repository simple run the command: |
||
182 | |||
183 | <pre> |
||
184 | $ git clone https://github.com/tvheadend/tvheadend.git |
||
185 | </pre> |
||
186 | |||
187 | h2. Configuring |
||
188 | |||
189 | TVHeadend comes with a configuration script that allows you to enable/disable optional components and set install paths, etc. |
||
190 | |||
191 | Most people will be fine with the defaults and can run: |
||
192 | |||
193 | <pre> |
||
194 | $ ./configure |
||
195 | </pre> |
||
196 | |||
197 | However for more advanced options, please run the following: |
||
198 | |||
199 | <pre> |
||
200 | $ ./configure --help |
||
201 | </pre> |
||
202 | |||
203 | And then re-run configure with the required options, i.e.: |
||
204 | |||
205 | <pre> |
||
206 | 10 | John Törnblom | $ ./configure --disable-dvbscan |
207 | 2 | Adam Sutton | </pre> |
208 | |||
209 | h2. Compiling |
||
210 | |||
211 | 3 | Adam Sutton | To compile Tvheadend run: |
212 | 2 | Adam Sutton | |
213 | <pre> |
||
214 | $ make |
||
215 | </pre> |
||
216 | |||
217 | h2. Installing |
||
218 | |||
219 | 3 | Adam Sutton | It is possible to install Tvheadend using make, based on the ./configure options, by running: |
220 | 2 | Adam Sutton | |
221 | <pre> |
||
222 | $ sudo make install |
||
223 | </pre> |
||
224 | |||
225 | 11 | Adam Sutton | However it's recommend that you run from the build directory for development/testing (see [[Development]]): |
226 | 2 | Adam Sutton | |
227 | <pre> |
||
228 | $ ./build.linux/tvheadend |
||
229 | </pre> |
||
230 | |||
231 | 4 | Adam Sutton | NOTE: its VERY important you run test builds from git root, so command should look similar to above. |
232 | |||
233 | 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. |
234 | 2 | Adam Sutton | |
235 | Use of make install is not very traceable and so removal can sometimes be painful, and it might overwrite an existing installation. |
||
236 | |||
237 | h2. Packaging |
||
238 | |||
239 | 3 | Adam Sutton | For more information about packaging Tvheadend please see [[Packaging|here]] |
240 | 2 | Adam Sutton | |
241 | h2. Reporting Problems |
||
242 | |||
243 | 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]]. |