Package: gcc-4.4 Version: 4.4.4-5 Severity: wishlist Tags: patch Here is a patch for your consideration to modify gcc-4.4_4.4.4-6 to expose the parameterized prefix variable $(PF) so that it can be used on the command line to build the package for an alternate installation prefix of the user's choice.
This patch does not change the behavior of the "default" build. Essentially, this modification is just a test to see if the variable has already been defined (e.g. on the build command line), and if so use it. If not, the variable defaults to its standard value of 'usr'. The "use case" for the alternate prefix is as follows. I am in what may be a relatively common situation of supporting a team of embedded developers working in a generic build environment for application code that gets deployed on top of an embedded system based on the Debian OS. One of my jobs is to provide the cross compiling toolchain for this embedded environment. Unfortunately I don't have full control over the generic build environment, and it is not a simple Debian environment. Since we use Debian as our embedded operating system environment to deploy this software, it is most safe and effective to use the same version of the compiler and toolchain as is used to build the underlying Debian system. So I leverage the most excellent Debian cross compiler toolchains for this purpose. To do this, I need to make the toolchains standalone for use outside of a Debian environment, using an alternate prefix so that they compile for use and install under /opt/.. instead of /usr/... With careful control of path variables,this effectively allows the cross compiler toolchain to be made completely independent of the build machine operating system, native compilers and libraries. This is a desirable thing in order to ensure that there is no pollution of the cross toolchain, and to make it effectively portable into most Linux environements (even non-Debian ones). The supplied patch applies from above the gcc-4.4-4.4.4 source directory patch -p0 --verbose < gcc-4.4_4.4.4-6.patch I've tested this patch by building as deb packages as follows: A cross build for ARMEL: GCC_TARGET=armel DEB_CROSS=yes fakeroot debian/rules control DEB_CROSS_NO_BIARCH=yes GCC_TARGET=armel DEB_CROSS=yes dpkg-buildpackage -us -uc -rfakeroot A cross build for ARMEL with a changed prefix: PF=opt/crosscompiler/gcc-4.4.4/arm GCC_TARGET=armel DEB_CROSS=yes fakeroot debian/rules control PF=opt/crosscompiler/gcc-4.4.4/arm DEB_CROSS_NO_BIARCH=yes GCC_TARGET=armel DEB_CROSS=yes dpkg-buildpackage -us -uc -rfakeroot -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages gcc-4.4 depends on: ii binutils 2.20.1-11 The GNU assembler, linker and bina ii cpp-4.4 4.4.4-5 The GNU C preprocessor ii gcc-4.4-base 4.4.4-5 The GNU Compiler Collection (base ii libc6 2.11.2-2 Embedded GNU C Library: Shared lib ii libgcc1 1:4.4.4-5 GCC support library ii libgomp1 4.4.4-5 GCC OpenMP (GOMP) support library Versions of packages gcc-4.4 recommends: ii libc6-dev 2.11.2-2 Embedded GNU C Library: Developmen Versions of packages gcc-4.4 suggests: pn gcc-4.4-doc <none> (no description available) pn gcc-4.4-locales <none> (no description available) pn gcc-4.4-multilib <none> (no description available) ii libcloog-ppl0 0.15.9-1 the Chunky Loop Generator (runtime pn libgcc1-dbg <none> (no description available) pn libgomp1-dbg <none> (no description available) pn libmudflap0-4.4-dev <none> (no description available) pn libmudflap0-dbg <none> (no description available) ii libppl-c2 0.10.2-6 Parma Polyhedra Library (C interfa ii libppl7 0.10.2-6 Parma Polyhedra Library (runtime l -- no debconf information
diff -Naur gcc-4.4-4.4.4.orig/debian/rules2 gcc-4.4-4.4.4/debian/rules2 --- gcc-4.4-4.4.4.orig/debian/rules2 2010-07-07 15:28:20.000000000 -0400 +++ gcc-4.4-4.4.4/debian/rules2 2010-07-07 15:29:17.000000000 -0400 @@ -500,8 +500,9 @@ endif # PF is the installation prefix for the package without the leading slash. -# It's "usr" for gcc releases -ifeq ($(PKGSOURCE),gcc-snapshot) +# It's "usr" for gcc releases, so use this if not explicitly set +ifneq ($(PF),) +else ifeq ($(PKGSOURCE),gcc-snapshot) PF = usr/lib/gcc-snapshot else PF = usr