~ubuntu-branches/ubuntu/trusty/gcc-4.8/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/README.maintainers

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-12-20 18:24:08 UTC
  • Revision ID: package-import@ubuntu.com-20131220182408-n58ja3mqwwrodxa9
Tags: 4.8.2-10ubuntu2
* Update to SVN 20131220 (r206145) from the gcc-4_8-branch.
* Set the goarch to arm64 for aarch64-linux-gnu.
* Fix statically linked gccgo binaries on AArch64 (Michael Hudson).
  LP: #1261604.
* Merge accumulated Ada changes from gnat-4.8.
* Update gnat build dependencies when not built from a separate source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
almost 100 binary packages, using a single set of build scripts.  The
10
10
3 source packages are:
11
11
 
12
 
gcc-4.3: C, C++, Fortran, Objective-C and Objective-C++, plus many
 
12
gcc-x.y: C, C++, Fortran, Objective-C and Objective-C++, plus many
13
13
         common libraries like libssp and libgcc.
14
 
gcj-4.3: Java.
15
 
gnat-4.3: Ada.
 
14
gcj-x.y: Java.
 
15
gnat-x.y: Ada.
16
16
 
17
17
The way we do this is quite peculiar, so listen up :)
18
18
 
19
 
When we build from the gcc-4.3 source package, we produce, among many
20
 
others, a gcc-4.3-source binary package that contains the pristine
 
19
When we build from the gcc-x.y source package, we produce, among many
 
20
others, a gcc-x.y-source binary package that contains the pristine
21
21
upstream tarball and some Debian-specific patches.  Any user can then
22
22
install this package on their Debian system, and will have the full
23
 
souces in /usr/src/gcc-4.3/gcc-<timestamp>.tar.bz2, along with the
 
23
souces in /usr/src/gcc-x.y/gcc-<timestamp>.tar.bz2, along with the
24
24
Makefile snippets that unpack and patch them.
25
25
 
26
26
The intended use for this package is twofold: (a) allow users to build
27
27
their own cross-compilers, and (b) build the other two packages,
28
 
gcj-4.3 and gnat-4.3.
29
 
 
30
 
For gcj-4.3 and gnat-4.3, the "source tarball" just contains an empty
31
 
directory; e.g.:
32
 
 
33
 
$ tar tzf gnat-4.3_4.3-20070609.orig.tar.gz
34
 
gnat-4.3-4.3-20070609.orig/
35
 
 
36
 
The build scripts for all source packages are the same, and they are
37
 
included, as usual, in the .diff.gz file.
 
28
gcj-x.y and gnat-x.y.
 
29
 
 
30
- gcc-x.y requires only a C compiler to build and produces C, C++,
 
31
  Fortran, Go and Objective-C compilers and libraries. It also
 
32
  produces the binary package gcc-x.y-source containing all the
 
33
  sources and patches in a tarball.
 
34
 
 
35
- gcj-x.y build-depends on gcc-x.y-source and C++ and Java compilers.
 
36
  Its .orig.tar.bz2 file only contains an empty directory; the real
 
37
  sources from which it builds the binary packages are in
 
38
  gcc-x.y-source.
 
39
 
 
40
- gnat-x.y build-depends on gcc-x.y-source and an Ada compiler.  It
 
41
  does not even have an .orig.tar.bz2 package; it is a Debian native
 
42
  package.
 
43
 
 
44
The benefits of this split are many:
 
45
 
 
46
- bootstrapping a subset of languages is much faster than
 
47
  bootstrapping all languages and libraries (which can take a full
 
48
  week on slow architectures like mips or arm)
 
49
 
 
50
- the language maintainers don't have to wait for each other
 
51
 
 
52
- for new ports, the absence of a port of, say, gnat-x.y does not
 
53
  block the porting of gcc-x.y.
 
54
 
 
55
gcc-x.y-source is also intended for interested users to build
 
56
cross-compiler packages.  Debian cannot provide all possible
 
57
cross-compiler packages (i.e. all possible host, target, language and
 
58
library combinations), so instead tries to facilitate building them.
38
59
 
39
60
* The build sequence
40
61
 
53
74
 
54
75
then, debian/rules will build only the Java binary packages.
55
76
 
56
 
The second step is to unpack the GCC source tarball.  This tarball is
57
 
either in the build directory (when building gcc-4.3), or in
58
 
/usr/src/gcc-4.3/gcc-<timestamp>.tar.bz2 (when building the other
59
 
source packages).
60
 
 
61
 
The third step is to build debian/control from debian/control.m4 and a
62
 
complex set of rules specified in debian/rules.conf.  The resulting
 
77
The second step is to build debian/control from debian/control.m4 and
 
78
a complex set of rules specified in debian/rules.conf.  The resulting
63
79
control file contains only the binary packages to be built.
64
80
 
65
 
The fourth step is to select which patches to apply (this is done in
 
81
The third step is to select which patches to apply (this is done in
66
82
debian/rules.defs), and then to apply the selected patches (see
67
 
debian/rules.patch).
68
 
 
69
 
The fifth step is to create a "build" directory, cd into it, call
 
83
debian/rules.patch).  The result of this step is a generated
 
84
debian/patches/series file for use by quilt.
 
85
 
 
86
The fourth step is to unpack the GCC source tarball.  This tarball is
 
87
either in the build directory (when building gcc-x.y), or in
 
88
/usr/src/gcc-x.y/gcc-x.y.z.tar.xz (when building the other source
 
89
packages).
 
90
 
 
91
The fifth step is to apply all patches to the unpacked sources with
 
92
quilt.
 
93
 
 
94
The sixth step is to create a "build" directory, cd into it, call
70
95
../src/configure, and bootstrap the compiler and libraries selected.
71
96
This is in debian/rules2.
72
97
 
73
 
The sixth step is to call "make install" in the build directory: this
74
 
installs the compiler and libraries into debian/tmp
 
98
The seventh step is to call "make install" in the build directory:
 
99
this installs the compiler and libraries into debian/tmp
75
100
(i.e. debian/tmp/usr/bin/gcc, etc.)
76
101
 
77
 
The seventh step is to run the GCC test suite (this actually takes at
 
102
The eighth step is to run the GCC test suite.  This actually takes at
78
103
least as much time as bootstrapping, and you can disable it by setting
79
 
WITHOUT_CHECK to "yes" in the environment).
 
104
WITHOUT_CHECK to "yes" in the environment.
80
105
 
81
 
The eighth step is to build the binary packages, i.e. the .debs.  This
 
106
The ninth step is to build the binary packages, i.e. the .debs.  This
82
107
is done by a set of language- and architecture-dependent Makefile
83
108
snippets in the debian/rules.d/ directory, which move files from the
84
109
debian/tmp tree to the debian/<package> trees.
85
110
 
86
111
* Making your own packages
87
112
 
88
 
In this example, we will build our own gnat-4.3 package.
89
 
 
90
 
1) Create a .orig.tar.gz tarball containing a single, empty directory.
91
 
 
92
 
$ mkdir gnat-4.3-4.3-20070609.orig
93
 
$ tar czf gnat-4.3_4.3-20070609.orig.tar.gz gnat-4.3-4.3-20070609.orig
94
 
 
95
 
2) Install gcc-4.3-source, which contains the real sources:
96
 
 
97
 
# apt-get install gcc-4.3-source
98
 
 
99
 
3) Create a build directory:
100
 
 
101
 
$ mkdir gnat-4.3-4.3-20070609; cd gnat-4.3-4.3-20070609
102
 
 
103
 
4) Checkout from Subversion:
104
 
 
105
 
$ svn checkout svn://svn.debian.org/gcccvs/branches/sid/gcc-4.3/debian
106
 
 
107
 
5) Edit the debian/changelog file, adding a new entry at the top that
108
 
   starts with "gnat-4.3" instead of "gcc-4.3".
109
 
 
110
 
6) Generate the debian/control file, adjusted for gnat:
 
113
In this example, we will build our own gnat-x.y package.
 
114
 
 
115
1) Install gcc-x.y-source, which contains the real sources:
 
116
 
 
117
# aptitude install gcc-x.y-source
 
118
 
 
119
2) Create a build directory:
 
120
 
 
121
$ mkdir gnat-x.y-x.y.z; cd gnat-x.y-x.y.z
 
122
 
 
123
3) Checkout from Subversion:
 
124
 
 
125
$ svn checkout svn://svn.debian.org/gcccvs/branches/sid/gcc-x.y/debian
 
126
 
 
127
4) Edit the debian/changelog file, adding a new entry at the top that
 
128
   starts with "gnat-x.y".
 
129
 
 
130
5) Generate the debian/control file, adjusted for gnat:
111
131
 
112
132
$ debian/rules control
113
133
 
114
 
7) Build:
 
134
8) Build:
115
135
 
116
 
$ dpkg-buildpackage -rfakeroot
 
136
$ dpkg-buildpackage
117
137
 
118
138
* Hints
119
139
 
136
156
 
137
157
2) As your regular user, create the working directory in the tmpfs
138
158
 
139
 
$ cp --archive ~/src/debian/gcc-4.3-4.3-20070901 ~/src/debian/ram
 
159
$ cp --archive ~/src/debian/gcc-x.y-x.y.z ~/src/debian/ram
140
160
 
141
161
3) Build in there.  On my dual-core, 2 GHz amd64, it takes 34 minutes
142
162
   to build gnat, and the tmpfs takes 992 MiB of physical RAM but
159
179
* Patching GCC
160
180
 
161
181
Debian applies a large number of patches to GCC as part of the build
162
 
process.  The patches are shell scripts located in debian/patches.
163
 
The file debian/rules.defs selects the language front-ends and
164
 
libraries to build.  Then, based on that, debian/rules.patch selects
165
 
which patches to apply and in which order, then applies them and
166
 
produces a file listing the applied patches in order in
167
 
stamps/02-patch-stamp.
168
 
 
169
 
There is currently no tool to help modify patches; you have to do it
170
 
by hand.  Here is one possible way to do it:
171
 
 
172
 
1) Apply all patches up to and EXCLUDING the patch you intend to
173
 
   modify, in order.
174
 
 
175
 
2) Make a deep copy of the src directory, e.g.
176
 
   $ cp --archive src src.bak
177
 
 
178
 
3) Apply the patch you intend to modify.
179
 
 
180
 
4) Open the .dpatch file in your editor and remove the entire patch
181
 
   section; leave alone the shell script part at the top.
182
 
 
183
 
5) Change the files you want in the src directory.  After making
184
 
   changes, you can experiment with
185
 
   $ make -C build -jK
186
 
   (where K is the number of processor threads you have)
187
 
 
188
 
6) $ diff -rNu src.bak src >> debian/patches/<file>.dpatch
189
 
 
190
 
7) Apply all remaining patches, to see if your change broke any of
191
 
   them.
192
 
 
193
 
8) $ svn commit debian/patches/<file>.dpatch
194
 
 
195
 
If you want to add a new patch, the procedure is similar.  You must
196
 
first choose where in the list of patches you want to insert your new
197
 
patch.  Then, apply all patches up to that point and start editing.
198
 
Do not forget to add a reference to your patch at the proper place in
199
 
debian/rules.patch.
200
 
 
201
 
** Patching GCC with Quilt
202
 
 
203
 
The above method uses an entire copy of the source tree, which is
204
 
currently 474 megabytes in size.  If you are in a one-gigabyte ram
205
 
disk (see Hints above), this may be a problem.  One solution to this
206
 
problem is to use quilt, which will only keep copies of the files
207
 
touched by patches, not all files.  It also automates the updating of
208
 
a patch after you change the sources.
209
 
 
210
 
Quilt however does not take into account the selection of patches made
211
 
in debian/rules.defs; instead it has a static list of patches.  After
212
 
calling "debian/rules patch", you can generate such a list like this:
213
 
 
214
 
$ egrep '^[^ ]+:' stamps/02-patch-stamp | \
215
 
  sed 's!:!.dpatch -p0!' > debian/patches/series
216
 
 
217
 
Unfortunately, not all patches are applied with -p0; you must then
218
 
edit debian/patches/series by hand to replace -p0 with -p1 for a few
219
 
patches.
220
 
 
221
 
Once you have your debian/patches/series:
222
 
 
223
 
$ debian/rules unpatch
 
182
process.  It uses quilt but the necessary debian/patches/series is not
 
183
part of the packaging scripts; instead, "debian/rules patch" generates
 
184
this file by looking at debian/control (which is itself generated!),
 
185
debian/changelog and other files.  Then it applies all the patches.
 
186
At this point, you can use quilt as usual:
 
187
 
 
188
$ cd ~/src/debian/gcc-x.y
224
189
$ export QUILT_PATCHES=$PWD/debian/patches
225
 
$ cd src
226
 
$ quilt push -a (or quilt push <patch_name>)
227
 
edit files at will; quilt add <file_name> to add a new file to the patch
228
 
$ make -C ../build
229
 
$ quilt refresh
230
 
$ quilt push -a # check that no patch is broken
231
 
$ quilt pop -a
232
 
$ cd ..
233
 
$ debian/rules clean build
234
 
$ svn commit
 
190
$ quilt series
 
191
 
 
192
If you add new patches, remember to add them to the version control
 
193
system too.
235
194
 
236
195
-- 
237
 
Ludovic Brenta, 2007-12-05.
 
196
Ludovic Brenta, 2012-04-02.