-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_from_source_upkg_howto.html
186 lines (163 loc) · 8.73 KB
/
compile_from_source_upkg_howto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<h2>How to build a source package using upkg (the paldo package system)</h2>
<br/>
<br />
<h2>Abstract</h2>
This howto should help you to get a source package built using <a href="http://www.upkg.org">upkg</a>. Upkg is the package management and build system used in the <a href="http://www.paldo.org">Paldo Linux distribution</a>.
<h2>A concrete problem</h2>
I like the Paldo philosophy of having one tool for every task. But I don't want to install <a href="http://www.k3b.org">k3b</a> (and its dependencies) for making 1:1 copies of a CD.
Therefore I checked the availability of <a href="http://gnomebaker.sourceforge.net">Gnome Baker</a> in the Paldo package repository. Unfortunately Gnome Baker is not in the main repository.
Thus I decided to build Gnome Baker from source. Because I want a clean filesystem I don't want to just run "./configure, make and make install".
It would be nicer to install the binaries, the docs... using the package manager after building everything from source.
Read on to find out what I did to achieve this.
<h2>Create a local Paldo repository</h2>
First of all we need to create a place for all our source packages. It doesn't matter where you create this local repository. I put mine in my home folder:
<br />
<br />
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<pre>
[nicolas@gandalf:~]$mkdir PaldoRepo
[nicolas@gandalf:~]$mkdir PaldoRepo/binaries
[nicolas@gandalf:~]$mkdir PaldoRepo/sources
[nicolas@gandalf:~]$mkdir PaldoRepo/specs</pre>
</div>
<br />
<br />
Now we need to tell upkg about the new local repository. Open <span class="command">/etc/upkg.conf</span> as root and add your repository. The content of the file then looks something like the following:
<br />
<br />
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<!-- http://aktuell.de.selfhtml.org/tippstricks/cgiperl/html-in-html/ -->
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<local>
<cachedir>/var/cache/upkg</cachedir>
<repositories>
<repository>http://www.paldo.org/paldo</repository>
<repository>/home/nicolas/PaldoRepo/</repository>
</repositories>
<branch>testing</branch>
<arch>x86</arch>
</local></pre>
</div>
<br />
<br />
<h2>Get the source</h2>
Now download the source code of the application you want to install. In my case I downloaded the zipped source-tarball from <a href="http://gnomebaker.sourceforge.net">http://gnomebaker.sourceforge.net</a>.
Upkg needs the source distribution as <b>tar</b> (tar file), or <b>tar.bz2 file</b> (bzip2 compressed tar file). Please ensure that your source package is in a supported file format, then copy or move it into the <b>sources dir</b> of your repository. Take care, that the file has the same name which you will later use as the package-name. See the <package name>-tag in the spec file chapter later.<br />
<br />
<br />
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
upkg will only find the source package if you save it under $REPODIR/sources/$PACKAGENAME ($PACKAGENAME -> see spec file)
</div>
<br />
<br />
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<pre>
[nicolas@gandalf:~/temp/gnome-baker]ls
gnome-baker-0.5.0.tar.bz2
[nicolas@gandalf:~/temp/gnome-baker]mv gnome-baker-0.5.0.tar.bz2 /home/nicolas/PaldoRepo/sources/
</div>
<br />
<br />
btw: If you like to use a <b>tar.gz file</b>, you need to add the following to your spec file: <archive name="...." compression="gz">
<h2>Create spec file for upkg</h2>
Now we need to tell upkg how it has to handle the source code. This is done using a simple XML File. You need to create this file in the <b>specs dir</b> in your repository. The name of the file should be the application name. In my case I name it <b>gnome-baker</b>. The content of the file then looks something like the following:
<br />
<br />
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<pre>
<?xml version="1.0"?>
<package name="gnome-baker">
<description>gnome cd burning application</description>
<releases>
<release version="0.5.0" revision="1" branch="testing">
<deps>
<dep name="libgnomeui-2.0"/>
<dep name="gtk+-2.0"/>
<dep name="glib-2.0"/>
<dep name="libglade-2.0"/>
<dep name="gstreamer-0.8"/>
</deps>
<build>
<script>
<archive name="gnome-baker-$VERSION">
<cmd>
./configure --prefix=/usr
--infodir=/usr/share/info
--mandir=/usr/share/man
--sysconfdir=/etc
--enable-nss=no
</cmd>
<cmd>make -j 2</cmd>
<cmd>make install</cmd>
</archive>
</script>
</build>
</release>
</releases>
</package></pre>
</div>
<br />
<br />
Most parts of this file are self describing. I think I just need to describe the dep-fields. In order to let upkg automatically resolve the dependencies you need to tell upkg which packages your tool needs to get compiled. To find out which other packages are needed, you can try the following approaches:
<ul>
<li>
Read <b>configure.in</b> or <b>configure.ac</b> in the source distribution. You will probably find something like:
<i>PKG_CHECK_MODULES(GNOME, libgnomeui-2.0 gtk+-2.0 >= 2.4.0 glib-2.0 >= 2.4.0 libglade-2.0 gstreamer-0.8,,exit)</i> in this case it's probably easy to find the needed packages. Just use the libraries that are listed in the
PKG_CHECK_MODULES-list. In most cases Paldo uses exactly these names. For example libgnomeui-2.0 is also called libgnomeui-2.0 in the paldo repository.
However use <a href="http://www.paldo.org/index-section-packages.html"> http://www.paldo.org/index-section-packages.html</a> to get the right name.
</li>
<li>
Check the README, INSTALL,... files in the source distribution. Some projects list the dependencies in one of these files.
</li>
<li>
Copy from an other distribution. If nothing helps, you can still take a look at what other distributions list as dependencies.
</li>
</ul>
<h2>Start compiling and installation</h2>
Now you're ready to compile and install your application. The following command will invoke everything:
<br />
<br >
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<pre>
[root@gandalf:~]# upkg-build gnome-baker
Generating script...
Writing script...
Executing script...
The following extra packages will be installed:
gnome-baker
The following packages will be built from source:
gnome-baker
Do you want to continue? [Y/n]
Building gnome-baker-0.5.0-1 (testing)...
[root@gandalf:~]#
</pre>
</div>
<br />
<br />
If you want to see verbose output, you can pass <b>--verbose</b> to upkg-build:
<br />
<br />
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<pre>
[root@gandalf:~]# upkg-build --verbose gnome-baker</pre>
</div>
<br />
<br />
You should now be able to run your application.
<br />
<br />
<h2>Log Files of upkg-build</h2>
If you want to see, what upkg exactly did, take a look at <b>/var/lib/upkg/logs/PACKAGE-VERSION.log.bz2</b>.
In my case I see all the steps upkg took in <b>/var/lib/upkg/logs/gnome-baker-x86-glibc-2.3-gcc-4.0-1-0.5.0-1.log.bz2</b>
<h2>Remove the package again</h2>
If you would like to delete the self made package, just run the following command:
<br />
<br >
<div style="border:1px dotted #5787b8; background-color: #bad5e0;">
<pre>
[root@gandalf:~]# upkg-remove gnome-baker</pre>
</div>
<br />
<br />
This will delete all installed files properly from your filesystem.