3289
Comment: Add details on LD_LIBRARY_PATH for gcc-snapshot
|
3332
Add table of contents
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Random collection of pbuilder tricks = | #pragma section-numbers off [[TableOfContents(2)]] #pragma section-numbers on |
?TableOfContents(2)
#pragma section-numbers on
How to include local packages in the build
This is needed when you have to build and upload both a library, then a package depending on it:
- Create a directory for your dependencies (say /path/to/the/dir/deps)
Add this to your pbuilder configuration: (the configuration file is usually in /etc/pbuilderrc)
OTHERMIRROR="deb file:///path/to/the/dir/deps ./" BINDMOUNTS="/path/to/the/dir/deps" HOOKDIR="/path/to/hook/dir" EXTRAPACKAGES="apt-utils"
- create your base.tgz or update with --override-config so pbuilder picks up the sources.list changes
put a file like D05deps to your $HOOKDIR, make it executable and put this in there:
(cd /path/to/the/dir/deps; apt-ftparchive packages . > Packages) apt-get update
- build the library
- copy the resulting debs into /path/to/the/dir/deps
- build the application
Next time you start with step 5 :-).
How to build for different distributions
This is workable through the --basetgz parameter of pbuilder. You can pbuilder create --basetgz /var/cache/pbuilder/experimental.tgz --distribution experimental (and so on) to create the base tarballs. When using pdebuild, use pdebuild -- --basetgz /var/cache/pbuilder/<dist>.tgz instead, depending on which distribution you want. It is probably useful to make the default one sid (create without --basetgz and pdebuild without --basetgz).
How to use pbuilder to test build with gcc-snapshot
While there are several ways to achieve this, an easy way is to use a hook to remove the existing gcc symlinks and replace them with a wrapper which uses gcc-snapshot. The following hook will do this for gcc, g++ and gfortran (extend it as needed):
aptitude -R -y install gcc-snapshot cat > /usr/local/bin/gcc-snapshot <<EOF #!/bin/sh LD_LIBRARY_PATH=/usr/lib/gcc-snapshot/lib:$LD_LIBRARY_PATH PATH=/usr/lib/gcc-snapshot/bin:$PATH gcc "\$@" EOF chmod 755 /usr/local/bin/gcc-snapshot cat > /usr/local/bin/g++-snapshot <<EOF #!/bin/sh LD_LIBRARY_PATH=/usr/lib/gcc-snapshot/lib:$LD_LIBRARY_PATH PATH=/usr/lib/gcc-snapshot/bin:$PATH g++ "\$@" EOF chmod 755 /usr/local/bin/g++-snapshot cat > /usr/local/bin/gfortran-snapshot <<EOF #!/bin/sh LD_LIBRARY_PATH=/usr/lib/gcc-snapshot/lib:$LD_LIBRARY_PATH PATH=/usr/lib/gcc-snapshot/bin:$PATH g++ "\$@" EOF chmod 755 /usr/local/bin/gfortran-snapshot rm -f /usr/bin/gcc /usr/bin/g++ /usr/bin/gfortran ln -s /usr/local/bin/gcc-snapshot /usr/bin/gcc ln -s /usr/local/bin/g++-snapshot /usr/bin/g++ ln -s /usr/local/bin/gfortran-snapshot /usr/bin/gfortran #/bin/bash < /dev/tty > /dev/tty
Then, ensure that the environment variable LD_LIBRARY_PATH is set to prefer the libraries belonging to gcc-snapshot by adding the following to your .pbuilderrc:
export LD_LIBRARY_PATH=/usr/lib/gcc-snapshot/lib:$LD_LIBRARY_PATH
Save the file as D20_gcc43 (or something) in your hook directory, and make it executable to use gcc 4.3. Of course, care has to be taken that the build system also uses the gcc, gfortran, g++ etc. found in /usr/bin; otherwise, some extra work needs to be done.
Also, remember to NEVER upload packages produced by gcc-snapshot!