Debian Bug report logs - #553045
(cross) gcc-4.4/mipsel: lib64gomp1-mipsel-cross/DEBIAN/shlibs: No such file

version graph

Package: gcc-4.4; Maintainer for gcc-4.4 is Debian GCC Maintainers <debian-gcc@lists.debian.org>; Source for gcc-4.4 is src:gcc-4.4.

Reported by: Hector Oron <hector.oron@gmail.com>

Date: Thu, 29 Oct 2009 07:36:42 UTC

Severity: wishlist

Tags: help, moreinfo, patch

Merged with 553047, 577674, 604774

Found in versions gcc-4.4/4.4.1-6, gcc-4.4/4.4.3-7, gcc-4.4/4.4.4-7, gcc-4.4/4.4.5-6

Done: Matthias Klose <doko@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Thu, 29 Oct 2009 07:36:45 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hector Oron <hector.oron@gmail.com>:
New Bug report received and forwarded. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Thu, 29 Oct 2009 07:36:45 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Hector Oron <hector.oron@gmail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: (cross) gcc-4.4/mipsel: lib64gomp1-mipsel-cross/DEBIAN/shlibs: No such file
Date: Wed, 28 Oct 2009 20:17:05 +0100
Package: gcc-4.4
Version: 4.4.1-6
Severity: normal


Hello,

 This is an error seen on mipsel architecture,

rm -rf debian/lib64gomp1-mipsel-cross debian/lib64gomp1-dbg
dh_installdirs -plib64gomp1-mipsel-cross \
                usr/lib64
DH_COMPAT=2 dh_movefiles -plib64gomp1-mipsel-cross \
                usr/lib64/libgomp.so.*
dh_movefiles: Compatibility levels before 5 are deprecated.
debian/dh_doclink -plib64gomp1-mipsel-cross gcc-4.4-mipsel-linux-gnu-base
WARNING: removing doc directory  lib64gomp1-mipsel-cross
dh_strip -plib64gomp1-mipsel-cross #--dbg-package=lib64gomp1-dbg
dh_compress -plib64gomp1-mipsel-cross #-plib64gomp1-dbg
dh_fixperms -plib64gomp1-mipsel-cross #-plib64gomp1-dbg
dh_makeshlibs -plib64gomp1-mipsel-cross -V 'lib64gomp1-mipsel-cross (>= 4.4)'
sed s/-mipsel-cross//g < debian/lib64gomp1-mipsel-cross/DEBIAN/shlibs > debian/lib64gomp1-mipsel-cross/DEBIAN/shlibs.fixed
/bin/bash: debian/lib64gomp1-mipsel-cross/DEBIAN/shlibs: No such file or directory
make[1]: *** [stamps/08-binary-stamp-lib64gomp] Error 1
make[1]: Leaving directory `/home/zumbi/buildcross/trunk/mipsel/gcc-4.4-'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
1



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-4.4 depends on:
ii  binutils              2.19.91.20091006-1 The GNU assembler, linker and bina
ii  cpp-4.4               4.4.1-6            The GNU C preprocessor
ii  gcc-4.4-base          4.4.1-6            The GNU Compiler Collection (base 
ii  libc6                 2.9-27             GNU C Library: Shared libraries
ii  libgcc1               1:4.4.1-6          GCC support library
ii  libgomp1              4.4.1-6            GCC OpenMP (GOMP) support library

Versions of packages gcc-4.4 recommends:
ii  libc6-dev                     2.9-27     GNU C Library: Development Librari

Versions of packages gcc-4.4 suggests:
pn  gcc-4.4-doc                   <none>     (no description available)
ii  gcc-4.4-locales               4.4.1-6    The GNU C compiler (native languag
pn  gcc-4.4-multilib              <none>     (no description available)
ii  libcloog-ppl0                 0.15.7-1   the Chunky Loop Generator (runtime
ii  libgcc1-dbg                   1:4.4.1-6  GCC support library (debug symbols
ii  libgomp1-dbg                  4.4.1-6    GCC OpenMP (GOMP) support library 
ii  libmudflap0-4.4-dev           4.4.1-6    GCC mudflap support libraries (dev
ii  libmudflap0-dbg               4.4.1-6    GCC mudflap shared support librari
ii  libppl-c2                     0.10.2-2   Parma Polyhedra Library (C interfa
ii  libppl7                       0.10.2-2   Parma Polyhedra Library (runtime l

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Tue, 13 Apr 2010 02:36:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Chubb <peter.chubb@nicta.com.au>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Tue, 13 Apr 2010 02:36:10 GMT) Full text and rfc822 format available.

Message #10 received at 553045@bugs.debian.org (full text, mbox):

From: Peter Chubb <peter.chubb@nicta.com.au>
To: 553045@bugs.debian.org
Subject: Same bug on IA64
Date: Tue, 13 Apr 2010 12:16:29 +1000
On Itanium:
$ DEB_CROSS_NO_BIARCH=yes GCC_TARGET=i386 fakeroot make -f debian/rules control
$ DEB_CROSS_NO_BIARCH=yes GCC_TARGET=i386 fakeroot make -f debian/rules binary
...
debian/dh_doclink -plib64gomp1-i386-cross gcc-4.4-i486-linux-gnu-base
WARNING: removing doc directory  lib64gomp1-i386-cross
dh_strip -plib64gomp1-i386-cross #--dbg-package=lib64gomp1-dbg
dh_compress -plib64gomp1-i386-cross #-plib64gomp1-dbg
dh_fixperms -plib64gomp1-i386-cross #-plib64gomp1-dbg
dh_makeshlibs -plib64gomp1-i386-cross
sed s/-i386-cross//g < debian/lib64gomp1-i386-cross/DEBIAN/shlibs > debian/lib64gomp1-i386-cross/DEBIAN/shlibs.fixed
/bin/bash: debian/lib64gomp1-i386-cross/DEBIAN/shlibs: No such file or directory
make[1]: *** [stamps/08-binary-stamp-lib64gomp] Error 1
make[1]: Leaving directory `/usr/src/toolchain/gcc-4.4-4.4.3'
make: *** [binary] Error 2

--
Dr Peter Chubb        www.nicta.com.au      peter DOT chubb AT nicta.com.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
From Imagination to Impact                       Imagining the (ICT) Future




Severity set to 'wishlist' from 'normal' Request was from Hector Oron <zumbi@debian.org> to control@bugs.debian.org. (Tue, 20 Apr 2010 10:06:03 GMT) Full text and rfc822 format available.

Merged 553045 553047 577674. Request was from Hector Oron <zumbi@debian.org> to control@bugs.debian.org. (Tue, 20 Apr 2010 10:06:07 GMT) Full text and rfc822 format available.

Bug No longer marked as fixed in versions 4.4.4-6 and reopened. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 25 Jul 2010 22:57:02 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Sun, 25 Jul 2010 23:03:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hector Oron <hector.oron@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sun, 25 Jul 2010 23:03:06 GMT) Full text and rfc822 format available.

Message #21 received at 553045@bugs.debian.org (full text, mbox):

From: Hector Oron <hector.oron@gmail.com>
To: 553045@bugs.debian.org
Cc: debian-embedded@lists.debian.org, Geert Stappers <stappers@stappers.nl>
Subject: Re: but 4.4.1-1 is to be installed.
Date: Mon, 26 Jul 2010 01:00:26 +0200
Dear GCC maintainers,

  While this bug appears to be fixed in version 4.4.4-6.
  I still hit same but on 4.4.4-7. Therefore I keep it open in the meanwhile.

dh_md5sums -plibgomp1-mipsel-cross -plibgomp1-dbg-mipsel-cross
	(cd debian/libgomp1-mipsel-cross >/dev/null ; find . -type f  !
-regex '.*/DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0
md5sum > DEBIAN/md5sums) >/dev/null
	chmod 644 debian/libgomp1-mipsel-cross/DEBIAN/md5sums
	chown 0:0 debian/libgomp1-mipsel-cross/DEBIAN/md5sums
	(cd debian/libgomp1-dbg-mipsel-cross >/dev/null ; find . -type f  !
-regex '.*/DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0
md5sum > DEBIAN/md5sums) >/dev/null
	chmod 644 debian/libgomp1-dbg-mipsel-cross/DEBIAN/md5sums
	chown 0:0 debian/libgomp1-dbg-mipsel-cross/DEBIAN/md5sums
dh_builddeb -plibgomp1-mipsel-cross -plibgomp1-dbg-mipsel-cross
	dpkg-deb --build debian/libgomp1-mipsel-cross ..
dpkg-deb: building package `libgomp1-mipsel-cross' in
`../libgomp1-mipsel-cross_4.4.4-7_all.deb'.
	dpkg-deb --build debian/libgomp1-dbg-mipsel-cross ..
dpkg-deb: building package `libgomp1-dbg-mipsel-cross' in
`../libgomp1-dbg-mipsel-cross_4.4.4-7_all.deb'.
trap '' 1 2 3 15; touch stamps/08-binary-stamp-libgomp; mv
stamps/07-install-stamp-tmp stamps/07-install-stamp
dh_testdir
dh_testroot
mv stamps/07-install-stamp stamps/07-install-stamp-tmp
rm -rf debian/lib64gomp1-mipsel-cross debian/lib64gomp1-dbg-mipsel-cross
dh_installdirs -plib64gomp1-mipsel-cross \
		usr/lib64
	install -d debian/lib64gomp1-mipsel-cross
	install -d debian/lib64gomp1-mipsel-cross/usr/lib64
DH_COMPAT=2 dh_movefiles -plib64gomp1-mipsel-cross \
		usr/lib64/libgomp.so.*
dh_movefiles: Compatibility levels before 5 are deprecated.
debian/dh_doclink -plib64gomp1-mipsel-cross gcc-4.4-mipsel-linux-gnu-base
WARNING: removing doc directory  lib64gomp1-mipsel-cross
debian/dh_doclink -plib64gomp1-dbg-mipsel-cross gcc-4.4-mipsel-linux-gnu-base
WARNING: removing doc directory  lib64gomp1-dbg-mipsel-cross
dh_strip -plib64gomp1-mipsel-cross --dbg-package=lib64gomp1-dbg-mipsel-cross
dh_strip: debug package lib64gomp1-dbg-mipsel-cross is not listed in
the control file
make[1]: *** [stamps/08-binary-stamp-lib64gomp] Error 255
make[1]: Leaving directory `/home/zumbi/buildcross/trunk/mipsel/gcc-4.4-4.4.4-7'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Full log at:
http://www.emdebian.org/~zumbi/toolchain/amd64-unstable/logs/amd64-mipsel-gcc-4.4.log

Best regards,
-- 
 Héctor Orón

"Our Sun unleashes tremendous flares expelling hot gas into the Solar
System, which one day will disconnect us."

-- Day DVB-T stop working nicely
Video flare: http://antwrp.gsfc.nasa.gov/apod/ap100510.html




Bug Marked as found in versions gcc-4.4/4.4.4-7. Request was from Hector Oron <zumbi@debian.org> to control@bugs.debian.org. (Sun, 25 Jul 2010 23:06:02 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Sun, 25 Jul 2010 23:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sun, 25 Jul 2010 23:33:03 GMT) Full text and rfc822 format available.

Message #28 received at 553045@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: Hector Oron <hector.oron@gmail.com>, 553045@bugs.debian.org
Cc: Debian Bug Tracking System <control@bugs.debian.org>
Subject: Re: Bug#553045: but 4.4.1-1 is to be installed.
Date: Mon, 26 Jul 2010 01:31:47 +0200
tag 553045 + help
tag 553045 + moreinfo
severity 553045 wishlist
thanks

Hector, please contact the emdebian maintainers about fixing this. I doubt there 
is anybody within the GCC maintainers who is going to fix this.

kthxby, Matthias

On 26.07.2010 01:00, Hector Oron wrote:
> Dear GCC maintainers,
>
>    While this bug appears to be fixed in version 4.4.4-6.
>    I still hit same but on 4.4.4-7. Therefore I keep it open in the meanwhile.
>
> dh_md5sums -plibgomp1-mipsel-cross -plibgomp1-dbg-mipsel-cross
> 	(cd debian/libgomp1-mipsel-cross>/dev/null ; find . -type f  !
> -regex '.*/DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0
> md5sum>  DEBIAN/md5sums)>/dev/null
> 	chmod 644 debian/libgomp1-mipsel-cross/DEBIAN/md5sums
> 	chown 0:0 debian/libgomp1-mipsel-cross/DEBIAN/md5sums
> 	(cd debian/libgomp1-dbg-mipsel-cross>/dev/null ; find . -type f  !
> -regex '.*/DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0
> md5sum>  DEBIAN/md5sums)>/dev/null
> 	chmod 644 debian/libgomp1-dbg-mipsel-cross/DEBIAN/md5sums
> 	chown 0:0 debian/libgomp1-dbg-mipsel-cross/DEBIAN/md5sums
> dh_builddeb -plibgomp1-mipsel-cross -plibgomp1-dbg-mipsel-cross
> 	dpkg-deb --build debian/libgomp1-mipsel-cross ..
> dpkg-deb: building package `libgomp1-mipsel-cross' in
> `../libgomp1-mipsel-cross_4.4.4-7_all.deb'.
> 	dpkg-deb --build debian/libgomp1-dbg-mipsel-cross ..
> dpkg-deb: building package `libgomp1-dbg-mipsel-cross' in
> `../libgomp1-dbg-mipsel-cross_4.4.4-7_all.deb'.
> trap '' 1 2 3 15; touch stamps/08-binary-stamp-libgomp; mv
> stamps/07-install-stamp-tmp stamps/07-install-stamp
> dh_testdir
> dh_testroot
> mv stamps/07-install-stamp stamps/07-install-stamp-tmp
> rm -rf debian/lib64gomp1-mipsel-cross debian/lib64gomp1-dbg-mipsel-cross
> dh_installdirs -plib64gomp1-mipsel-cross \
> 		usr/lib64
> 	install -d debian/lib64gomp1-mipsel-cross
> 	install -d debian/lib64gomp1-mipsel-cross/usr/lib64
> DH_COMPAT=2 dh_movefiles -plib64gomp1-mipsel-cross \
> 		usr/lib64/libgomp.so.*
> dh_movefiles: Compatibility levels before 5 are deprecated.
> debian/dh_doclink -plib64gomp1-mipsel-cross gcc-4.4-mipsel-linux-gnu-base
> WARNING: removing doc directory  lib64gomp1-mipsel-cross
> debian/dh_doclink -plib64gomp1-dbg-mipsel-cross gcc-4.4-mipsel-linux-gnu-base
> WARNING: removing doc directory  lib64gomp1-dbg-mipsel-cross
> dh_strip -plib64gomp1-mipsel-cross --dbg-package=lib64gomp1-dbg-mipsel-cross
> dh_strip: debug package lib64gomp1-dbg-mipsel-cross is not listed in
> the control file
> make[1]: *** [stamps/08-binary-stamp-lib64gomp] Error 255
> make[1]: Leaving directory `/home/zumbi/buildcross/trunk/mipsel/gcc-4.4-4.4.4-7'
> make: *** [binary] Error 2
> dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
>
> Full log at:
> http://www.emdebian.org/~zumbi/toolchain/amd64-unstable/logs/amd64-mipsel-gcc-4.4.log
>
> Best regards,





Added tag(s) moreinfo. Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sun, 25 Jul 2010 23:33:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Sun, 25 Jul 2010 23:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hector Oron <hector.oron@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sun, 25 Jul 2010 23:51:03 GMT) Full text and rfc822 format available.

Message #35 received at 553045@bugs.debian.org (full text, mbox):

From: Hector Oron <hector.oron@gmail.com>
To: Matthias Klose <doko@debian.org>
Cc: 553045@bugs.debian.org
Subject: Re: Bug#553045: but 4.4.1-1 is to be installed.
Date: Mon, 26 Jul 2010 01:48:20 +0200
Dear Matthias,

2010/7/26, Matthias Klose <doko@debian.org>:
> Hector, please contact the emdebian maintainers about fixing this. I doubt
> there
> is anybody within the GCC maintainers who is going to fix this.

If you lack time I propose myself as GCC co-maintainer to have a look
to such failures, but without being GCC maintainer this is rather
difficult and time consuming.

If you dont want to fix it on Debian GCC itself, please leave open the
bug report, so we can keep track of such failures and send you patches
whenever we had the time to work them out.

Best regards,
-- 
 Héctor Orón

"Our Sun unleashes tremendous flares expelling hot gas into the Solar
System, which one day will disconnect us."

-- Day DVB-T stop working nicely
Video flare: http://antwrp.gsfc.nasa.gov/apod/ap100510.html




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Mon, 26 Jul 2010 06:51:14 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Mon, 26 Jul 2010 06:51:14 GMT) Full text and rfc822 format available.

Message #40 received at 553045@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: Hector Oron <hector.oron@gmail.com>
Cc: 553045@bugs.debian.org
Subject: Re: Bug#553045: but 4.4.1-1 is to be installed.
Date: Mon, 26 Jul 2010 08:50:34 +0200
On 26.07.2010 01:48, Hector Oron wrote:
> Dear Matthias,
>
> 2010/7/26, Matthias Klose<doko@debian.org>:
>> Hector, please contact the emdebian maintainers about fixing this. I doubt
>> there
>> is anybody within the GCC maintainers who is going to fix this.
>
> If you lack time I propose myself as GCC co-maintainer to have a look
> to such failures,

No, I didn't see any contributions yet, even after our talk at last Debconf.  I 
do not want to make you a member of the group based on work which might or might 
not be done.

> but without being GCC maintainer this is rather
> difficult and time consuming.

No. Marcin did show this is possible even without having access to the repository.

  Matthias




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Mon, 26 Jul 2010 08:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hector Oron <hector.oron@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Mon, 26 Jul 2010 08:24:03 GMT) Full text and rfc822 format available.

Message #45 received at 553045@bugs.debian.org (full text, mbox):

From: Hector Oron <hector.oron@gmail.com>
To: Matthias Klose <doko@debian.org>
Cc: 553045@bugs.debian.org
Subject: Re: Bug#553045: but 4.4.1-1 is to be installed.
Date: Mon, 26 Jul 2010 09:21:41 +0100
Hello Matthias,

2010/7/26 Matthias Klose <doko@debian.org>:
>> If you lack time I propose myself as GCC co-maintainer to have a look
>> to such failures,
>
> No, I didn't see any contributions yet, even after our talk at last Debconf.
>  I do not want to make you a member of the group based on work which might
> or might not be done.
>
>> but without being GCC maintainer this is rather
>> difficult and time consuming.
>
> No. Marcin did show this is possible even without having access to the
> repository.

Fine with me then. Thanks for clarifying.
I would also like to clarify that I am on volunteer basis (even
without network - out of work time -), and this is not a paid role
like others.

Have a nice day,
-- 
 Héctor Orón

"Our Sun unleashes tremendous flares expelling hot gas into the Solar
System, which one day will disconnect us."

-- Day DVB-T stop working nicely
Video flare: http://antwrp.gsfc.nasa.gov/apod/ap100510.html




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Thu, 02 Sep 2010 23:33:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hector Oron <hector.oron@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Thu, 02 Sep 2010 23:33:03 GMT) Full text and rfc822 format available.

Message #50 received at 553045@bugs.debian.org (full text, mbox):

From: Hector Oron <hector.oron@gmail.com>
To: Matthias Klose <doko@debian.org>
Cc: 553045@bugs.debian.org
Subject: Re: Bug#553045: but 4.4.1-1 is to be installed.
Date: Fri, 3 Sep 2010 00:31:34 +0100
Hi,

Attached you can find a patchset that applies clean on svn sid/gcc-4.4
HEAD. It builds BI/TRI-ARCH and NON BIARCH builds.


2010/7/26 Matthias Klose <doko@debian.org>:
> Hector, please contact the emdebian maintainers about fixing this. I doubt
> there is anybody within the GCC maintainers who is going to fix this.

[Al Viro]
From 5a98a76683b0e381c9b7a886c3ea8fcd218081d6 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Sun, 29 Aug 2010 13:49:46 -0400
Subject: [PATCH 1/8] beginning of saner directory handling

New variables:
	usr_lib{,32,64,n32}
	gcc_lib_dir{32,64,n32}
	libgcc_dir{,32,64,n32}

We set those to full paths in rules2 and switch to using them in
rules.d/*; as the result, most of the explicit pathnames in there
are gone _and_ we get uniformity across different flavours.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.d/binary-cxx.mk        |   18 +++---
 debian/rules.d/binary-fortran.mk    |   46 +++++++-------
 debian/rules.d/binary-gcc.mk        |  115 +++++++++++++++++------------------
 debian/rules.d/binary-libgcc.mk     |   20 +++---
 debian/rules.d/binary-libgomp.mk    |   14 ++--
 debian/rules.d/binary-libmudflap.mk |   34 ++++++-----
 debian/rules.d/binary-libobjc.mk    |   16 +++---
 debian/rules.d/binary-libstdcxx.mk  |   86 +++++++++++++-------------
 debian/rules.d/binary-nof.mk        |   14 ++--
 debian/rules.d/binary-objc.mk       |   38 ++++++------
 debian/rules2                       |   14 ++++
 11 files changed, 215 insertions(+), 200 deletions(-)

diff --git a/debian/rules.d/binary-cxx.mk b/debian/rules.d/binary-cxx.mk
index 4ed673b..718f117 100644
--- a/debian/rules.d/binary-cxx.mk
+++ b/debian/rules.d/binary-cxx.mk
@@ -107,13 +107,13 @@ $(binary_stamp)-cxx-multi: $(install_stamp)
 		$(gcc_lib_dir)/$(biarchsubdirs)

 ifeq ($(biarch64),yes)
-	mv $(d)/$(PFL)/lib64/lib*c++*.{a,so} $(d)/$(gcc_lib_dir)/$(biarch64subdir)/.
+	mv $(d)/$(usr_lib64)/lib*c++*.{a,so} $(d)/$(gcc_lib_dir64)/.
 endif
 ifeq ($(biarch32),yes)
-	mv $(d)/$(PFL)/lib32/lib*c++*.{a,so} $(d)/$(gcc_lib_dir)/$(biarch32subdir)/.
+	mv $(d)/$(usr_lib32)/lib*c++*.{a,so} $(d)/$(gcc_lib_dir32)/.
 endif
 ifeq ($(biarchn32),yes)
-	mv $(d)/$(PFL)/$(libn32)/lib*c++*.{a,so}
$(d)/$(gcc_lib_dir)/$(biarchn32subdir)/.
+	mv $(d)/$(usr_libn32)/lib*c++*.{a,so} $(d)/$(gcc_lib_dirn32)/.
 endif

 	DH_COMPAT=2 dh_movefiles -p$(p_cxx_m) \
@@ -123,18 +123,18 @@ endif

 ifeq ($(biarch64),yes)
 	dh_link -p$(p_cxx_m) \
-		/$(PFL)/lib64/libstdc++.so.$(CXX_SONAME) \
-		/$(gcc_lib_dir)/$(biarch64subdir)/libstdc++.so
+		/$(usr_lib64)/libstdc++.so.$(CXX_SONAME) \
+		/$(gcc_lib_dir64)/libstdc++.so
 endif
 ifeq ($(biarch32),yes)
 	dh_link -p$(p_cxx_m) \
-		/$(PFL)/lib32/libstdc++.so.$(CXX_SONAME) \
-		/$(gcc_lib_dir)/$(biarch32subdir)/libstdc++.so
+		/$(usr_lib32)/libstdc++.so.$(CXX_SONAME) \
+		/$(gcc_lib_dir32)/libstdc++.so
 endif
 ifeq ($(biarchn32),yes)
 	dh_link -p$(p_cxx_m) \
-		/$(PFL)/$(libn32)/libstdc++.so.$(CXX_SONAME) \
-		/$(gcc_lib_dir)/$(biarchn32subdir)/libstdc++.so
+		/$(usr_libn32)/libstdc++.so.$(CXX_SONAME) \
+		/$(gcc_lib_dirn32)/libstdc++.so
 endif

 	debian/dh_doclink -p$(p_cxx_m) $(p_base)
diff --git a/debian/rules.d/binary-fortran.mk b/debian/rules.d/binary-fortran.mk
index 7e3b51c..17f4ead 100644
--- a/debian/rules.d/binary-fortran.mk
+++ b/debian/rules.d/binary-fortran.mk
@@ -67,10 +67,10 @@ endif

 dirs_flib = \
 	$(docdir) \
-	$(PFL)/$(libdir) \
+	$(usr_lib) \

 files_flib = \
-	$(PFL)/$(libdir)/libgfortran.so.*
+	$(usr_lib)/libgfortran.so.*

 # ----------------------------------------------------------------------
 $(binary_stamp)-libgfortran: $(install_stamp)
@@ -107,9 +107,9 @@ $(binary_stamp)-lib64fortran: $(install_stamp)

 	rm -rf $(d_f64lib) $(d_f64libdbg)
 	dh_installdirs -p$(p_f64lib) \
-		$(PFL)/lib64
+		$(usr_lib64)
 	DH_COMPAT=2 dh_movefiles -p$(p_f64lib) \
-		$(PFL)/lib64/libgfortran.so.*
+		$(usr_lib64)/libgfortran.so.*

 	debian/dh_doclink -p$(p_f64lib) $(p_base)
 	debian/dh_doclink -p$(p_f64libdbg) $(p_base)
@@ -138,9 +138,9 @@ $(binary_stamp)-lib32fortran: $(install_stamp)

 	rm -rf $(d_f32lib) $(d_f32libdbg)
 	dh_installdirs -p$(p_f32lib) \
-		$(PFL)/lib32
+		$(usr_lib32)
 	DH_COMPAT=2 dh_movefiles -p$(p_f32lib) \
-		$(PFL)/lib32/libgfortran.so.*
+		$(usr_lib32)/libgfortran.so.*

 	debian/dh_doclink -p$(p_f32lib) $(p_base)
 	debian/dh_doclink -p$(p_f32libdbg) $(p_base)
@@ -167,9 +167,9 @@ $(binary_stamp)-libn32fortran: $(install_stamp)

 	rm -rf $(d_fn32lib) $(d_fn32libdbg)
 	dh_installdirs -p$(p_fn32lib) \
-		$(PFL)/$(libn32)
+		$(usr_libn32)
 	DH_COMPAT=2 dh_movefiles -p$(p_fn32lib) \
-		$(PFL)/$(libn32)/libgfortran.so.*
+		$(usr_libn32)/libgfortran.so.*

 	debian/dh_doclink -p$(p_fn32lib) $(p_base)
 	debian/dh_doclink -p$(p_fn32libdbg) $(p_base)
@@ -201,10 +201,10 @@ $(binary_stamp)-fdev: $(install_stamp)

 	DH_COMPAT=2 dh_movefiles -p$(p_g95) $(files_g95)

-	rm -f $(d)/$(PFL)/$(libdir)/libgfortran*.so
-	mv $(d)/$(PFL)/$(libdir)/libgfortran*.a $(d_g95)/$(gcc_lib_dir)/
+	rm -f $(d)/$(usr_lib)/libgfortran*.so
+	mv $(d)/$(usr_lib)/libgfortran*.a $(d_g95)/$(gcc_lib_dir)/
 	dh_link -p$(p_g95) \
-	  /$(PFL)/$(libdir)/libgfortran.so.$(FORTRAN_SONAME) \
+	  /$(usr_lib)/libgfortran.so.$(FORTRAN_SONAME) \
 	  /$(gcc_lib_dir)/libgfortran.so

 ifneq ($(DEB_CROSS),yes)
@@ -251,25 +251,25 @@ $(binary_stamp)-fdev-multi: $(install_stamp)
 		$(gcc_lib_dir)/$(biarchsubdirs)/libgfortranbegin.a

 ifeq ($(biarch64),yes)
-	rm -f $(d)/$(PFL)/lib64/libgfortran*.{la,so}
-	mkdir -p $(d_g95_m)/$(gcc_lib_dir)/$(biarch64subdir)
-	mv $(d)/$(PFL)/lib64/libgfortran*.a
$(d_g95_m)/$(gcc_lib_dir)/$(biarch64subdir)/
+	rm -f $(d)/$(usr_lib64)/libgfortran*.{la,so}
+	mkdir -p $(d_g95_m)/$(gcc_lib_dir64)
+	mv $(d)/$(usr_lib64)/libgfortran*.a $(d_g95_m)/$(gcc_lib_dir64)/
 	dh_link -p$(p_g95_m) \
-	  /$(PFL)/lib64/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libgfortran.so
+	  /$(usr_lib64)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir64)/libgfortran.so
 endif
 ifeq ($(biarch32),yes)
-	rm -f $(d)/$(PFL)/lib32/libgfortran*.{la,so}
-	mkdir -p $(d_g95_m)/$(gcc_lib_dir)/$(biarch32subdir)
-	mv $(d)/$(PFL)/lib32/libgfortran*.a
$(d_g95_m)/$(gcc_lib_dir)/$(biarch32subdir)/
+	rm -f $(d)/$(usr_lib32)/libgfortran*.{la,so}
+	mkdir -p $(d_g95_m)/$(gcc_lib_dir32)
+	mv $(d)/$(usr_lib32)/libgfortran*.a $(d_g95_m)/$(gcc_lib_dir32)/
 	dh_link -p$(p_g95_m) \
-	  /$(PFL)/lib32/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libgfortran.so
+	  /$(usr_lib32)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir32)/libgfortran.so
 endif
 ifeq ($(biarchn32),yes)
-	rm -f $(d)/$(PFL)/$(libn32)/libgfortran*.{la,so}
-	mkdir -p $(d_g95_m)/$(gcc_lib_dir)/$(biarchn32subdir)
-	mv $(d)/$(PFL)/$(libn32)/libgfortran*.a
$(d_g95_m)/$(gcc_lib_dir)/$(biarchn32subdir)/
+	rm -f $(d)/$(usr_libn32)/libgfortran*.{la,so}
+	mkdir -p $(d_g95_m)/$(gcc_lib_dirn32)
+	mv $(d)/$(usr_libn32)/libgfortran*.a $(d_g95_m)/$(gcc_lib_dirn32)/
 	dh_link -p$(p_g95_m) \
-	  /$(PFL)/$(libn32)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libgfortran.so
+	  /$(usr_libn32)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dirn32)/libgfortran.so
 endif

 	debian/dh_doclink -p$(p_g95_m) $(p_base)
diff --git a/debian/rules.d/binary-gcc.mk b/debian/rules.d/binary-gcc.mk
index 89fb627..ea7c400 100644
--- a/debian/rules.d/binary-gcc.mk
+++ b/debian/rules.d/binary-gcc.mk
@@ -109,39 +109,39 @@ $(binary_stamp)-gcc: $(install_dependencies)
 ifneq ($(DEB_STAGE),stage1) # stage1 builds static libgcc only
 	: # libgcc_s.so may be a linker script on some architectures
 	set -e; \
-	if [ -h $(d)/$(PFL)/$(libdir)/libgcc_s.so ]; then \
-	  rm -f $(d)/$(PFL)/$(libdir)/libgcc_s.so; \
-	  dh_link -p$(p_gcc) /$(RPF)/$(libdir)/libgcc_s.so.$(GCC_SONAME) \
+	if [ -h $(d)/$(usr_lib)/libgcc_s.so ]; then \
+	  rm -f $(d)/$(usr_lib)/libgcc_s.so; \
+	  dh_link -p$(p_gcc) /$(libgcc_dir)/libgcc_s.so.$(GCC_SONAME) \
 	    $(gcc_lib_dir)/libgcc_s.so; \
 	else \
-	  mv $(d)/$(PFL)/$(libdir)/libgcc_s.so $(d)/$(gcc_lib_dir)/libgcc_s.so; \
-	  dh_link -p$(p_gcc) /$(RPF)/$(libdir)/libgcc_s.so.$(GCC_SONAME) \
+	  mv $(d)/$(usr_lib)/libgcc_s.so $(d)/$(gcc_lib_dir)/libgcc_s.so; \
+	  dh_link -p$(p_gcc) /$(libgcc_dir)/libgcc_s.so.$(GCC_SONAME) \
 	    $(gcc_lib_dir)/libgcc_s.so.$(GCC_SONAME); \
 	fi
 endif
 ifeq ($(with_libgmath),yes)
-	rm -f $(d)/$(PFL)/$(libdir)/libgcc-math.{la,so}
+	rm -f $(d)/$(usr_lib)/libgcc-math.{la,so}
 	dh_link -p$(p_gcc) \
-	  /$(PFL)/$(libdir)/libgcc-math.so.$(GCC_SONAME)
/$(gcc_lib_dir)/libgcc-math.so
-	mv $(d)/$(PFL)/$(libdir)/libgcc-math.a $(d)/$(gcc_lib_dir)/
+	  /$(usr_lib)/libgcc-math.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc-math.so
+	mv $(d)/$(usr_lib)/libgcc-math.a $(d)/$(gcc_lib_dir)/
 endif

 ifeq ($(with_ssp),yes)
-	mv $(d)/$(PFL)/$(libdir)/libssp_nonshared.a $(d)/$(gcc_lib_dir)/
+	mv $(d)/$(usr_lib)/libssp_nonshared.a $(d)/$(gcc_lib_dir)/
 endif
 ifeq ($(with_libssp),yes)
-	mv $(d)/$(PFL)/$(libdir)/libssp*.a $(d_gcc)/$(gcc_lib_dir)/
-	rm -f $(d)/$(PFL)/$(libdir)/libssp*.{la,so}
+	mv $(d)/$(usr_lib)/libssp*.a $(d_gcc)/$(gcc_lib_dir)/
+	rm -f $(d)/$(usr_lib)/libssp*.{la,so}
 	dh_link -p$(p_gcc) \
-	  /$(PFL)/$(libdir)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir)/libssp.so
+	  /$(usr_lib)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir)/libssp.so
 	cp -p $(srcdir)/libssp/ChangeLog \
 		$(d_gcc)/$(docdir)/$(p_base)/libssp/changelog
 endif
 ifeq ($(with_gomp),yes)
-	mv $(d)/$(PFL)/$(libdir)/libgomp*.{a,spec} $(d_gcc)/$(gcc_lib_dir)/
-	rm -f $(d)/$(PFL)/$(libdir)/libgomp*.{la,so}
+	mv $(d)/$(usr_lib)/libgomp*.{a,spec} $(d_gcc)/$(gcc_lib_dir)/
+	rm -f $(d)/$(usr_lib)/libgomp*.{la,so}
 	dh_link -p$(p_gcc) \
-	  /$(PFL)/$(libdir)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir)/libgomp.so
+	  /$(usr_lib)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir)/libgomp.so
 	cp -p $(srcdir)/libgomp/ChangeLog \
 		$(d_gcc)/$(docdir)/$(p_base)/gomp/changelog
 endif
@@ -216,98 +216,97 @@ $(binary_stamp)-gcc-multi: $(install_dependencies)

 ifeq ($(biarch64),yes)
 	DH_COMPAT=2 dh_movefiles -p$(p_gcc_m) \
-		$(gcc_lib_dir)/$(biarch64subdir)/{libgcc*,libgcov.a,*.o}
-	rm -f $(d)/$(PFL)/$(lib64)/libgcc_s.so
+		$(gcc_lib_dir64)/{libgcc*,libgcov.a,*.o}
+	rm -f $(d)/$(usr_lib64)/libgcc_s.so
 	dh_link -p$(p_gcc_m) \
-	  $(RPF)/$(lib64)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc_s_64.so \
-	  $(RPF)/$(lib64)/libgcc_s.so.$(GCC_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libgcc_s.so
+	  $(libgcc_dir64)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc_s_64.so \
+	  $(libgcc_dir64)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir64)/libgcc_s.so
   ifeq ($(with_lib64gmath),yes)
-	rm -f $(d)/$(PFL)/$(lib64)/libgcc-math.{la,so}
+	rm -f $(d)/$(usr_lib64)/libgcc-math.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/$(lib64)/libgcc-math.so.$(GCC_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libgcc-math.so
-	mv $(d)/$(PFL)/$(lib64)/libgcc-math.a $(d)/$(gcc_lib_dir)/$(biarch64subdir)/
+	  /$(usr_lib64)/libgcc-math.so.$(GCC_SONAME) /$(gcc_lib_dir64)/libgcc-math.so
+	mv $(d)/$(usr_lib64)/libgcc-math.a $(d)/$(gcc_lib_dir64)/
   endif
 endif
 ifeq ($(biarch32),yes)
 	DH_COMPAT=2 dh_movefiles -p$(p_gcc_m) \
-		$(gcc_lib_dir)/$(biarch32subdir)/{libgcc*,libgcov.a,*.o}
-	rm -f $(d)/$(PFL)/lib32/libgcc_s.so
-	# sic - lib64gcc and libn32gcc go to root, but this one - to usr
+		$(gcc_lib_dir32)/{libgcc*,libgcov.a,*.o}
+	rm -f $(d)/$(libgcc_dir32)/libgcc_s.so
 	dh_link -p$(p_gcc_m) \
-	 $(PFL)/lib32/libgcc_s.so.$(GCC_SONAME)  /$(gcc_lib_dir)/libgcc_s_32.so \
-	 $(PFL)/lib32/libgcc_s.so.$(GCC_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libgcc_s.so
+	 $(libgcc_dir32)/libgcc_s.so.$(GCC_SONAME)  /$(gcc_lib_dir)/libgcc_s_32.so \
+	 $(libgcc_dir32)/libgcc_s.so.$(GCC_SONAME)  /$(gcc_lib_dir32)/libgcc_s.so
   ifeq ($(with_lib32gmath),yes)
-	rm -f $(d)/$(PFL)/lib32/libgcc-math.{la,so}
+	rm -f $(d)/$(usr_lib32)/libgcc-math.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  $(PFL)/lib32/libgcc-math.so.$(GCC_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libgcc-math.so
-	mv $(d)/$(PFL)/lib32/libgcc-math.a $(d)/$(gcc_lib_dir)/$(biarch32subdir)/
+	  $(usr_lib32)/libgcc-math.so.$(GCC_SONAME) /$(gcc_lib_dir32)/libgcc-math.so
+	mv $(d)/$(usr_lib32)/libgcc-math.a $(d)/$(gcc_lib_dir32)/
   endif
 endif
 ifeq ($(biarchn32),yes)
 	DH_COMPAT=2 dh_movefiles -p$(p_gcc_m) \
-		$(gcc_lib_dir)/$(biarchn32subdir)/{libgcc*,libgcov.a,*.o}
-	rm -f $(d)/$(PFL)/$(libn32)/libgcc_s.so
+		$(gcc_lib_dirn32)/{libgcc*,libgcov.a,*.o}
+	rm -f $(d)/$(usr_libn32)/libgcc_s.so
 	dh_link -p$(p_gcc_m) \
-	  $(RPF)/$(libn32)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc_s_n32.so \
-	  $(RPF)/$(libn32)/libgcc_s.so.$(GCC_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libgcc_s.so
+	  $(libgcc_dirn32)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc_s_n32.so \
+	  $(libgcc_dirn32)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dirn32)/libgcc_s.so
   ifeq ($(with_libn32gmath),yes)
-	rm -f $(d)/$(PFL)/$(libn32)/libgcc-math.{la,so}
+	rm -f $(d)/$(usr_libn32)/libgcc-math.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/$(libn32)/libgcc-math.so.$(GCC_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libgcc-math.so
-	mv $(d)/$(PFL)/$(libn32)/libgcc-math.a $(d)/$(gcc_lib_dir)/$(biarchn32subdir)/
+	  /$(usr_libn32)/libgcc-math.so.$(GCC_SONAME)
/$(gcc_lib_dirn32)/libgcc-math.so
+	mv $(d)/$(usr_libn32)/libgcc-math.a $(d)/$(gcc_lib_dirn32)/
   endif
 endif

 ifeq ($(with_libssp),yes)
   ifeq ($(biarch64),yes)
-	mv $(d)/$(PFL)/$(lib64)/libssp*.a $(d_gcc_m)/$(gcc_lib_dir)/$(biarch64subdir)/
-	rm -f $(d)/$(PFL)/$(lib64)/$(biarch64subdir)/libssp*.{la,so}
+	mv $(d)/$(usr_lib64)/libssp*.a $(d_gcc_m)/$(gcc_lib_dir64)/
+	rm -f $(d)/$(usr_lib64)/$(biarch64subdir)/libssp*.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/$(lib64)/libssp.so.$(SSP_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libssp.so
+	  /$(usr_lib64)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir64)/libssp.so
   endif
   ifeq ($(biarch32),yes)
-	mv $(d)/$(PFL)/lib32/libssp*.a $(d_gcc_m)/$(gcc_lib_dir)/$(biarch32subdir)/
-	rm -f $(d)/$(PFL)/lib32/$(biarch32subdir)/libssp*.{la,so}
+	mv $(d)/$(usr_lib32)/libssp*.a $(d_gcc_m)/$(gcc_lib_dir32)/
+	rm -f $(d)/$(usr_lib32)/$(biarch32subdir)/libssp*.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/lib32/libssp.so.$(SSP_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libssp.so
+	  /$(usr_lib32)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir32)/libssp.so
   endif
   ifeq ($(biarchn32),yes)
-	mv $(d)/$(PFL)/$(libn32)/libssp*.a
$(d_gcc_m)/$(gcc_lib_dir)/$(biarchn32subdir)/
-	rm -f $(d)/$(PFL)/$(libn32)/$(biarchn32subdir)/libssp*.{la,so}
+	mv $(d)/$(usr_libn32)/libssp*.a $(d_gcc_m)/$(gcc_lib_dirn32)/
+	rm -f $(d)/$(usr_libn32)/$(biarchn32subdir)/libssp*.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/$(libn32)/libssp.so.$(SSP_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libssp.so
+	  /$(usr_libn32)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dirn32)/libssp.so
   endif
 endif
 ifeq ($(with_ssp),yes)
   ifeq ($(biarch64),yes)
-	mv $(d)/$(PFL)/$(lib64)/libssp_nonshared.a
$(d_gcc_m)/$(gcc_lib_dir)/$(biarch64subdir)/
+	mv $(d)/$(usr_lib64)/libssp_nonshared.a $(d_gcc_m)/$(gcc_lib_dir64)/
   endif
   ifeq ($(biarch32),yes)
-	mv $(d)/$(PFL)/lib32/libssp_nonshared.a
$(d_gcc_m)/$(gcc_lib_dir)/$(biarch32subdir)/
+	mv $(d)/$(usr_lib32)/libssp_nonshared.a $(d_gcc_m)/$(gcc_lib_dir32)/
   endif
   ifeq ($(biarchn32),yes)
-	mv $(d)/$(PFL)/$(libn32)/libssp_nonshared.a
$(d_gcc_m)/$(gcc_lib_dir)/$(biarchn32subdir)/
+	mv $(d)/$(usr_libn32)/libssp_nonshared.a $(d_gcc_m)/$(gcc_lib_dirn32)/
   endif
 endif

 ifeq ($(with_gomp),yes)
   ifeq ($(biarch64),yes)
-	mv $(d)/$(PFL)/$(lib64)/libgomp*.a
$(d_gcc_m)/$(gcc_lib_dir)/$(biarch64subdir)/
-	rm -f $(d)/$(PFL)/$(lib64)/$(biarch64subdir)/libgomp*.{la,so}
+	mv $(d)/$(usr_lib64)/libgomp*.a $(d_gcc_m)/$(gcc_lib_dir64)/
+	rm -f $(d)/$(usr_lib64)/$(biarch64subdir)/libgomp*.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/$(lib64)/libgomp.so.$(GOMP_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libgomp.so
+	  /$(usr_lib64)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir64)/libgomp.so
   endif
   ifeq ($(biarch32),yes)
-	mv $(d)/$(PFL)/lib32/libgomp*.a $(d_gcc_m)/$(gcc_lib_dir)/$(biarch32subdir)/
-	rm -f $(d)/$(PFL)/lib32/$(biarch32subdir)/libgomp*.{la,so}
+	mv $(d)/$(usr_lib32)/libgomp*.a $(d_gcc_m)/$(gcc_lib_dir32)/
+	rm -f $(d)/$(usr_lib32)/$(biarch32subdir)/libgomp*.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/lib32/libgomp.so.$(GOMP_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libgomp.so
+	  /$(usr_lib32)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir32)/libgomp.so
   endif
   ifeq ($(biarchn32),yes)
-	mv $(d)/$(PFL)/$(libn32)/libgomp*.a
$(d_gcc_m)/$(gcc_lib_dir)/$(biarchn32subdir)/
-	rm -f $(d)/$(PFL)/$(libn32)/$(biarchn32subdir)/libgomp*.{la,so}
+	mv $(d)/$(usr_libn32)/libgomp*.a $(d_gcc_m)/$(gcc_lib_dirn32)/
+	rm -f $(d)/$(usr_libn32)/$(biarchn32subdir)/libgomp*.{la,so}
 	dh_link -p$(p_gcc_m) \
-	  /$(PFL)/$(libn32)/libgomp.so.$(GOMP_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libgomp.so
+	  /$(usr_libn32)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dirn32)/libgomp.so
   endif
 endif

diff --git a/debian/rules.d/binary-libgcc.mk b/debian/rules.d/binary-libgcc.mk
index ab7dde3..c18ec11 100644
--- a/debian/rules.d/binary-libgcc.mk
+++ b/debian/rules.d/binary-libgcc.mk
@@ -41,10 +41,10 @@ $(binary_stamp)-libgcc: $(install_dependencies)
 	rm -rf $(d_lgcc) $(d_lgccdbg)
 	dh_installdirs -p$(p_lgcc) \
 		$(docdir)/$(p_lgcc) \
-		$(RPF)/$(libdir)
+		$(libgcc_dir)

 ifeq ($(with_shared_libgcc),yes)
-	mv $(d)/$(PFL)/$(libdir)/libgcc_s.so.$(GCC_SONAME)
$(d_lgcc)/$(RPF)/$(libdir)/.
+	mv $(d)/$(usr_lib)/libgcc_s.so.$(GCC_SONAME) $(d_lgcc)/$(libgcc_dir)/.
 endif

 ifeq ($(with_standalone_gcj),yes)
@@ -92,10 +92,10 @@ $(binary_stamp)-lib64gcc: $(install_dependencies)
 	rm -rf $(d_l64gcc) $(d_l64gccdbg)
 	dh_installdirs -p$(p_l64gcc) \
 		$(docdir)/$(p_l64gcc) \
-		$(RPF)/lib64
+		$(libgcc_dir64)

 ifeq ($(with_shared_libgcc),yes)
-	mv $(d)/$(PFL)/lib64/libgcc_s.so.$(GCC_SONAME) $(d_l64gcc)/$(RPF)/lib64/.
+	mv $(d)/$(usr_lib64)/libgcc_s.so.$(GCC_SONAME) $(d_l64gcc)/$(libgcc_dir64)/.
 endif

 	debian/dh_doclink -p$(p_l64gcc) $(p_base)
@@ -134,9 +134,9 @@ $(binary_stamp)-lib32gcc: $(install_dependencies)

 	dh_installdirs -p$(p_l32gcc) \
 		$(docdir)/$(p_l32gcc) \
-		$(RPF)$(lib32)
-	mv $(d)/$(lib32)/libgcc_s.so.$(GCC_SONAME) \
-		$(d_l32gcc)/$(RPF)$(lib32)/.
+		$(libgcc_dir32)
+	mv $(d)/$(usr_lib32)/libgcc_s.so.$(GCC_SONAME) \
+		$(d_l32gcc)/$(libgcc_dir32)/.

 	debian/dh_doclink -p$(p_l32gcc) $(p_base)
 	debian/dh_doclink -p$(p_l32gccdbg) $(p_base)
@@ -172,9 +172,9 @@ $(binary_stamp)-libn32gcc: $(install_dependencies)

 	dh_installdirs -p$(p_ln32gcc) \
 		$(docdir)/$(p_ln32gcc) \
-		$(RPF)/$(libn32)
-	mv $(d)/$(PFL)/$(libn32)/libgcc_s.so.$(GCC_SONAME) \
-		$(d_ln32gcc)/$(RPF)/$(libn32)/.
+		$(libgcc_dirn32)
+	mv $(d)/$(usr_libn32)/libgcc_s.so.$(GCC_SONAME) \
+		$(d_ln32gcc)/$(libgcc_dirn32)/.

 	debian/dh_doclink -p$(p_ln32gcc) $(p_base)
 	debian/dh_doclink -p$(p_ln32gccdbg) $(p_base)
diff --git a/debian/rules.d/binary-libgomp.mk b/debian/rules.d/binary-libgomp.mk
index 4e2cd57..736b681 100644
--- a/debian/rules.d/binary-libgomp.mk
+++ b/debian/rules.d/binary-libgomp.mk
@@ -15,8 +15,8 @@ define __do_gomp
 	mv $(install_stamp) $(install_stamp)-tmp

 	rm -rf $(d_l) $(d_d)
-	dh_installdirs -p$(p_l) $(PFL)/$(2)
-	DH_COMPAT=2 dh_movefiles -p$(p_l) $(PFL)/$(2)/libgomp.so.*
+	dh_installdirs -p$(p_l) $(2)
+	DH_COMPAT=2 dh_movefiles -p$(p_l) $(2)/libgomp.so.*

 	debian/dh_doclink -p$(p_l) $(p_base)
 	debian/dh_doclink -p$(p_d) $(p_base)
@@ -40,16 +40,16 @@ endef

 # ----------------------------------------------------------------------

-do_gomp = $(call __do_gomp,$(1)gomp$(GOMP_SONAME),$(2))
+do_gomp = $(call __do_gomp,lib$(1)gomp$(GOMP_SONAME),$(usr_lib$(1)))

 $(binary_stamp)-libgomp: $(install_stamp)
-	$(call do_gomp,lib,$(libdir))
+	$(call do_gomp,)

 $(binary_stamp)-lib64gomp: $(install_stamp)
-	$(call do_gomp,lib64,lib64)
+	$(call do_gomp,64)

 $(binary_stamp)-lib32gomp: $(install_stamp)
-	$(call do_gomp,lib32,lib32)
+	$(call do_gomp,32)

 $(binary_stamp)-libn32gomp: $(install_stamp)
-	$(call do_gomp,libn32,lib32)
+	$(call do_gomp,n32)
diff --git a/debian/rules.d/binary-libmudflap.mk
b/debian/rules.d/binary-libmudflap.mk
index 5efb25e..3a079ea 100644
--- a/debian/rules.d/binary-libmudflap.mk
+++ b/debian/rules.d/binary-libmudflap.mk
@@ -24,9 +24,9 @@ define __do_mudflap
 	mv $(install_stamp) $(install_stamp)-tmp

 	rm -rf $(d_l) $(d_d)
-	dh_installdirs -p$(p_l) $(PFL)/$(2)
+	dh_installdirs -p$(p_l) $(2)
 	DH_COMPAT=2 dh_movefiles -p$(p_l) \
-		$(PFL)/$(2)/libmudflap*.so.*
+		$(2)/libmudflap*.so.*

 	debian/dh_doclink -p$(p_l) $(p_base)
 	debian/dh_doclink -p$(p_d) $(p_base)
@@ -50,31 +50,33 @@ define __do_mudflap
 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
 endef

-do_mudflap = $(call __do_mudflap,$(1)mudflap$(MUDFLAP_SONAME),$(2))
+do_mudflap = $(call
__do_mudflap,lib$(1)mudflap$(MUDFLAP_SONAME),$(usr_lib$(1)))

-define do_mudflap_dev
+define __do_mudflap_dev
 	dh_installdirs -p$(p_mfd) $(1)
 	DH_COMPAT=2 dh_movefiles -p$(p_mfd) $(1)/libmudflap*.a
-	rm -f $(d)/$(PFL)/$(2)/libmudflap*.so
-	mv $(d)/$(PFL)/$(2)/libmudflap*.a $(d_mfd)/$(1)/
+	rm -f $(d)/$(2)/libmudflap*.so
+	mv $(d)/$(2)/libmudflap*.a $(d_mfd)/$(1)/
 	dh_link -p$(p_mfd) \
-	  /$(PFL)/$(2)/libmudflap.so.$(MUDLFLAP_SONAME) /$(1)/libmudflap.so \
-	  /$(PFL)/$(2)/libmudflapth.so.$(MUDFLAP_SONAME) /$(1)/libmudflapth.so
+	  /$(2)/libmudflap.so.$(MUDLFLAP_SONAME) /$(1)/libmudflap.so \
+	  /$(2)/libmudflapth.so.$(MUDFLAP_SONAME) /$(1)/libmudflapth.so
 endef

+do_mudflap_dev = $(call __do_mudflap_dev,$(gcc_lib_dir$(1)),$(usr_lib$(1)))
+
 # ----------------------------------------------------------------------

 $(binary_stamp)-libmudflap: $(install_stamp)
-	$(call do_mudflap,lib,$(libdir))
+	$(call do_mudflap,)

 $(binary_stamp)-lib64mudflap: $(install_stamp)
-	$(call do_mudflap,lib64,lib64)
+	$(call do_mudflap,64)

 $(binary_stamp)-lib32mudflap: $(install_stamp)
-	$(call do_mudflap,lib32,lib32)
+	$(call do_mudflap,32)

 $(binary_stamp)-libn32mudflap: $(install_stamp)
-	$(call do_mudflap,libn32,lib32)
+	$(call do_mudflap,n32)

 $(binary_stamp)-libmudflapdev: $(install_stamp)
 	dh_testdir
@@ -86,15 +88,15 @@ $(binary_stamp)-libmudflapdev: $(install_stamp)

 	DH_COMPAT=2 dh_movefiles -p$(p_mfd) $(gcc_lib_dir)/include/mf-runtime.h

-	$(call do_mudflap_dev,$(gcc_lib_dir),$(libdir))
+	$(call do_mudflap_dev,)
 ifeq ($(with_lib32mudflap),yes)
-	$(call do_mudflap_dev,$(gcc_lib_dir)/$(biarch32subdir),lib32)
+	$(call do_mudflap_dev,32)
 endif
 ifeq ($(with_lib64mudflap),yes)
-	$(call do_mudflap_dev,$(gcc_lib_dir)/$(biarch64subdir),lib64)
+	$(call do_mudflap_dev,64)
 endif
 ifeq ($(with_libn32mudflap),yes)
-	$(call do_mudflap_dev,$(gcc_lib_dir)/$(biarchn32subdir),lib32)
+	$(call do_mudflap_dev,n32)
 endif

 	cp -p $(srcdir)/libmudflap/ChangeLog \
diff --git a/debian/rules.d/binary-libobjc.mk b/debian/rules.d/binary-libobjc.mk
index af4fe05..ed0e196 100644
--- a/debian/rules.d/binary-libobjc.mk
+++ b/debian/rules.d/binary-libobjc.mk
@@ -12,10 +12,10 @@ ifeq ($(with_libn32objc),yes)
 endif

 files_lobjc = \
-	$(PFL)/$(2)/libobjc.so.*
+	$(2)/libobjc.so.*
 ifeq ($(with_objc_gc),yes)
   files_lobjc += \
-	$(PFL)/$(2)/libobjc_gc.so.*
+	$(2)/libobjc_gc.so.*
 endif

 define __do_libobjc
@@ -25,7 +25,7 @@ define __do_libobjc

 	rm -rf $(d_l) $(d_d)
 	dh_installdirs -p$(p_l) \
-		$(PFL)/$(2)
+		$(2)
 	DH_COMPAT=2 dh_movefiles -p$(p_l) \
 		$(files_lobjc)

@@ -51,16 +51,16 @@ endef

 # ----------------------------------------------------------------------

-do_libobjc = $(call __do_libobjc,$(1)objc$(OBJC_SONAME),$(2))
+do_libobjc = $(call __do_libobjc,lib$(1)objc$(OBJC_SONAME),$(usr_lib$(1)))

 $(binary_stamp)-libobjc: $(install_stamp)
-	$(call do_libobjc,lib,$(libdir))
+	$(call do_libobjc,)

 $(binary_stamp)-lib64objc: $(install_stamp)
-	$(call do_libobjc,lib64,lib64)
+	$(call do_libobjc,64)

 $(binary_stamp)-lib32objc: $(install_stamp)
-	$(call do_libobjc,lib32,lib32)
+	$(call do_libobjc,32)

 $(binary_stamp)-libn32objc: $(install_stamp)
-	$(call do_libobjc,libn32,lib32)
+	$(call do_libobjc,n32)
diff --git a/debian/rules.d/binary-libstdcxx.mk
b/debian/rules.d/binary-libstdcxx.mk
index b661af5..809a312 100644
--- a/debian/rules.d/binary-libstdcxx.mk
+++ b/debian/rules.d/binary-libstdcxx.mk
@@ -56,7 +56,7 @@ d_libd	= debian/$(p_libd)

 dirs_dev = \
 	$(docdir)/$(p_base)/C++ \
-	$(PFL)/$(libdir) \
+	$(usr_lib) \
 	$(gcc_lib_dir)/include \
 	$(cxx_inc_dir)

@@ -67,10 +67,10 @@ files_dev = \

 dirs_dbg = \
 	$(docdir) \
-	$(PFL)/$(libdir)/debug \
+	$(usr_lib)/debug \
 	$(gcc_lib_dir)
 files_dbg = \
-	$(PFL)/$(libdir)/debug/libstdc++.{a,so*}
+	$(usr_lib)/debug/libstdc++.{a,so*}

 dirs_pic = \
 	$(docdir) \
@@ -124,10 +124,10 @@ $(binary_stamp)-libstdcxx: $(install_stamp)
 	rm -rf $(d_lib)
 	dh_installdirs -p$(p_lib) \
 		$(docdir) \
-		$(PFL)/$(libdir)
+		$(usr_lib)

-	cp -a $(d)/$(PFL)/$(libdir)/libstdc++.so.* \
-		$(d_lib)/$(PFL)/$(libdir)/
+	cp -a $(d)/$(usr_lib)/libstdc++.so.* \
+		$(d_lib)/$(usr_lib)/

 	debian/dh_doclink -p$(p_lib) $(p_base)
 	debian/dh_rmemptydirs -p$(p_lib)
@@ -139,7 +139,7 @@ $(binary_stamp)-libstdcxx: $(install_stamp)
 	dh_makeshlibs -p$(p_lib)
 	$(call cross_mangle_shlibs,$(p_lib))
 	$(cross_shlibdeps) dh_shlibdeps \
-		-L$(p_lgcc) -l:$(d)/$(PFL)/$(libdir):$(d_lgcc)/$(libdir):\
+		-L$(p_lgcc) -l:$(d)/$(usr_lib):$(d_lgcc)/$(libdir):\
 		-p$(p_lib)
 	$(call cross_mangle_substvars,$(p_lib))

@@ -165,10 +165,10 @@ $(binary_stamp)-lib64stdcxx: $(install_stamp)
 	rm -rf $(d_lib64)
 	dh_installdirs -p$(p_lib64) \
 		$(docdir) \
-		$(PFL)/lib64
+		$(usr_lib64)

-	cp -a $(d)/$(PFL)/lib64/libstdc++.so.* \
-		$(d_lib64)/$(PFL)/lib64/.
+	cp -a $(d)/$(usr_lib64)/libstdc++.so.* \
+		$(d_lib64)/$(usr_lib64)/.

 	dh_strip -p$(p_lib64)

@@ -200,12 +200,12 @@ $(binary_stamp)-lib64stdcxxdbg: $(install_stamp)

 	rm -rf $(d_dbg64)
 	dh_installdirs -p$(p_dbg64) \
-		$(PFL)/lib64
+		$(usr_lib64)
 ifeq ($(with_lib64cxx),yes)
-	cp -a $(d)/$(PFL)/lib64/libstdc++.so.* \
-		$(d_dbg64)/$(PFL)/lib64/.
+	cp -a $(d)/$(usr_lib64)/libstdc++.so.* \
+		$(d_dbg64)/$(usr_lib64)/.
 	dh_strip -p$(p_dbg64) --keep-debug
-	rm -f $(d_dbg64)/$(PFL)/lib64/libstdc++.so.*
+	rm -f $(d_dbg64)/$(usr_lib64)/libstdc++.so.*
   ifneq ($(with_common_libs),yes)
 	: # remove the debug symbols for libstdc++ built by a newer version of GCC
 	rm -rf $(d_dbg64)/usr/lib/debug/$(PF)
@@ -215,8 +215,8 @@ endif
 		> debian/$(p_dbg64).substvars

 ifeq ($(with_debug),yes)
-	mv $(d)/$(PFL)/lib64/debug $(d_dbg64)/$(PFL)/lib64/.
-	rm -f $(d_dbg64)/$(PFL)/lib64/debug/libstdc++_pic.a
+	mv $(d)/$(usr_lib64)/debug $(d_dbg64)/$(usr_lib64)/.
+	rm -f $(d_dbg64)/$(usr_lib64)/debug/libstdc++_pic.a
 endif

 	$(cross_shlibdeps) dh_shlibdeps -p$(p_dbg64) \
@@ -247,10 +247,10 @@ $(binary_stamp)-lib32stdcxx: $(install_stamp)

 	dh_installdirs -p$(p_lib32) \
 		$(docdir) \
-		$(lib32)
+		$(usr_lib32)

-	cp -a $(d)/$(lib32)/libstdc++.so.* \
-		$(d_lib32)/$(lib32)/.
+	cp -a $(d)/$(usr_lib32)/libstdc++.so.* \
+		$(d_lib32)/$(usr_lib32)/.

 	debian/dh_doclink -p$(p_lib32) $(p_base)
 	debian/dh_rmemptydirs -p$(p_lib32)
@@ -280,22 +280,22 @@ $(binary_stamp)-lib32stdcxxdbg: $(install_stamp)

 	rm -rf $(d_dbg32)
 	dh_installdirs -p$(p_dbg32) \
-		$(lib32)
+		$(usr_lib32)

 ifeq ($(with_lib32cxx),yes)
-	cp -a $(d)/$(lib32)/libstdc++.so.* \
-		$(d_dbg32)/$(lib32)/.
+	cp -a $(d)/$(usr_lib32)/libstdc++.so.* \
+		$(d_dbg32)/$(usr_lib32)/.
 	dh_strip -p$(p_dbg32) --keep-debug
   ifneq ($(with_common_libs),yes)
 	: # remove the debug symbols for libstdc++ built by a newer version of GCC
 	rm -rf $(d_dbg32)/usr/lib/debug/$(PF)
   endif
-	rm -f $(d_dbg32)/$(lib32)/libstdc++.so.*
+	rm -f $(d_dbg32)/$(usr_lib32)/libstdc++.so.*
 endif

 ifeq ($(with_debug),yes)
-	mv $(d)/$(lib32)/debug $(d_dbg32)/$(lib32)/.
-	rm -f $(d_dbg32)/$(lib32)/debug/libstdc++_pic.a
+	mv $(d)/$(usr_lib32)/debug $(d_dbg32)/$(usr_lib32)/.
+	rm -f $(d_dbg32)/$(usr_lib32)/debug/libstdc++_pic.a
 endif

 	debian/dh_doclink -p$(p_dbg32) $(p_base)
@@ -326,10 +326,10 @@ $(binary_stamp)-libn32stdcxx: $(install_stamp)

 	dh_installdirs -p$(p_libn32) \
 		$(docdir) \
-		$(PFL)/$(libn32)
+		$(usr_libn32)

-	cp -a $(d)/$(PFL)/$(libn32)/libstdc++.so.* \
-		$(d_libn32)/$(PFL)/$(libn32)/.
+	cp -a $(d)/$(usr_libn32)/libstdc++.so.* \
+		$(d_libn32)/$(usr_libn32)/.

 	debian/dh_doclink -p$(p_libn32) $(p_base)
 	debian/dh_rmemptydirs -p$(p_libn32)
@@ -341,7 +341,7 @@ $(binary_stamp)-libn32stdcxx: $(install_stamp)
 	dh_makeshlibs -p$(p_libn32)
 	$(call cross_mangle_shlibs,$(p_libn32))
 	$(cross_shlibdeps) dh_shlibdeps -p$(p_libn32) \
-		-L$(p_ln32gcc) -l:$(d)/$(PF)/$(libn32):$(d_ln32gcc)/$(libn32):
+		-L$(p_ln32gcc) -l:$(d)/$(usr_libn32):$(d_ln32gcc)/$(libn32):
 	$(call cross_mangle_substvars,$(p_libn32))

 	dh_gencontrol -p$(p_libn32) -- -v$(DEB_VERSION) $(common_substvars)
@@ -360,21 +360,21 @@ $(binary_stamp)-libn32stdcxxdbg: $(install_stamp)

 	rm -rf $(d_dbgn32)
 	dh_installdirs -p$(p_dbgn32) \
-		$(PFL)/$(libn32)
+		$(usr_libn32)

 ifeq ($(with_libn32cxx),yes)
-	cp -a $(d)/$(PFL)/$(libn32)/libstdc++.so.* \
-		$(d_dbgn32)/$(PFL)/$(libn32)/.
+	cp -a $(d)/$(usr_libn32)/libstdc++.so.* \
+		$(d_dbgn32)/$(usr_libn32)/.
 	dh_strip -p$(p_dbgn32) --keep-debug
   ifneq ($(with_common_libs),yes)
 	: # remove the debug symbols for libstdc++ built by a newer version of GCC
 	rm -rf $(d_dbgn32)/usr/lib/debug/$(PF)
   endif
-	rm -f $(d_dbgn32)/$(PFL)/$(libn32)/libstdc++.so.*
+	rm -f $(d_dbgn32)/$(usr_libn32)/libstdc++.so.*
 endif

 ifeq ($(with_debug),yes)
-	mv $(d)/$(PFL)/$(libn32)/debug $(d_dbgn32)/$(PFL)/$(libn32)/.
+	mv $(d)/$(usr_libn32)/debug $(d_dbgn32)/$(usr_libn32)/.
 	rm -f $(d_dbgn32)/$(libn32)/debug/libstdc++_pic.a
 endif

@@ -415,14 +415,14 @@ $(binary_stamp)-libstdcxx-dev: $(libcxxdev_deps)
 	dh_installdirs -p$(p_dbg) $(dirs_dbg)

 	: # - correct libstdc++-v3 file locations
-	mv $(d)/$(PFL)/$(libdir)/libsupc++.a $(d)/$(gcc_lib_dir)/
-	mv $(d)/$(PFL)/$(libdir)/libstdc++.{a,so} $(d)/$(gcc_lib_dir)/
+	mv $(d)/$(usr_lib)/libsupc++.a $(d)/$(gcc_lib_dir)/
+	mv $(d)/$(usr_lib)/libstdc++.{a,so} $(d)/$(gcc_lib_dir)/
 	ln -sf ../../../$(DEB_TARGET_GNU_TYPE)/libstdc++.so.$(CXX_SONAME) \
 		$(d)/$(gcc_lib_dir)/libstdc++.so
-	mv $(d)/$(PFL)/$(libdir)/libstdc++_pic.a $(d)/$(gcc_lib_dir)/
+	mv $(d)/$(usr_lib)/libstdc++_pic.a $(d)/$(gcc_lib_dir)/

-	rm -f $(d)/$(PFL)/$(libdir)/debug/libstdc++_pic.a
-	rm -f $(d)/$(PFL)/lib64/debug/libstdc++_pic.a
+	rm -f $(d)/$(usr_lib)/debug/libstdc++_pic.a
+	rm -f $(d)/$(usr_lib64)/debug/libstdc++_pic.a

 	: # remove precompiled headers
 	-find $(d) -type d -name '*.gch' | xargs rm -rf
@@ -438,7 +438,7 @@ ifeq ($(with_debug),yes)
 endif

 	dh_link -p$(p_dev) \
-		/$(PFL)/$(libdir)/libstdc++.so.$(CXX_SONAME) \
+		/$(usr_lib)/libstdc++.so.$(CXX_SONAME) \
 		/$(gcc_lib_dir)/libstdc++.so \
 		/$(cxx_inc_dir) /$(PFL)/include/c++/$(GCC_VERSION)

@@ -460,10 +460,10 @@ endif
 		$(d_pic)/$(gcc_lib_dir)/libstdc++_pic.map

 ifeq ($(with_libcxx),yes)
-	cp -a $(d)/$(PFL)/$(libdir)/libstdc++.so.* \
-		$(d_dbg)/$(PFL)/$(libdir)/
+	cp -a $(d)/$(usr_lib)/libstdc++.so.* \
+		$(d_dbg)/$(usr_lib)/
 	dh_strip -p$(p_dbg) --keep-debug
-	rm -f $(d_dbg)/$(PFL)/$(libdir)/libstdc++.so.*
+	rm -f $(d_dbg)/$(usr_lib)/libstdc++.so.*
 endif

 	dh_strip -p$(p_dev) --dbg-package=$(p_dbg)
diff --git a/debian/rules.d/binary-nof.mk b/debian/rules.d/binary-nof.mk
index f4f7549..417dc86 100644
--- a/debian/rules.d/binary-nof.mk
+++ b/debian/rules.d/binary-nof.mk
@@ -5,7 +5,7 @@ d_nof  = debian/$(p_nof)

 dirs_nof = \
 	$(docdir) \
-	$(PFL)/$(libdir)/nof
+	$(usr_lib)/nof
 ifeq ($(with_cdev),yes)
   dirs_nof += \
 	$(gcc_lib_dir)/nof
@@ -13,13 +13,13 @@ endif

 ifeq ($(with_cdev),yes)
   files_nof = \
-	$(RPF)$(libdir)/libgcc_s_nof.so.$(GCC_SONAME) \
+	$(libgcc_dir)/libgcc_s_nof.so.$(GCC_SONAME) \
 	$(gcc_lib_dir)/libgcc_s_nof.so \
-	$(PFL)/$(libdir)/nof \
+	$(usr_lib)/nof \
 	$(gcc_lib_dir)/nof
 else
   files_nof = \
-	$(libdir)/libgcc_s_nof.so.$(GCC_SONAME)
+	$(usr_lib)/libgcc_s_nof.so.$(GCC_SONAME)
 endif

 # ----------------------------------------------------------------------
@@ -28,9 +28,9 @@ $(binary_stamp)-nof: $(install_stamp)
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	mv $(d)/$(PFL)/$(libdir)/libgcc_s_nof.so.$(GCC_SONAME) $(d)/$(libdir)/.
-	rm -f $(d)/$(PFL)/$(libdir)/libgcc_s_nof.so
-	ln -sf $(RPF)/$(libdir)/libgcc_s_nof.so.$(GCC_SONAME) \
+	mv $(d)/$(usr_lib)/libgcc_s_nof.so.$(GCC_SONAME) $(d)/$(libgcc_dir)/.
+	rm -f $(d)/$(usr_lib)/libgcc_s_nof.so
+	ln -sf $(libgcc_dir)/libgcc_s_nof.so.$(GCC_SONAME) \
 		$(d)/$(gcc_lib_dir)/libgcc_s_nof.so

 	rm -rf $(d_nof)
diff --git a/debian/rules.d/binary-objc.mk b/debian/rules.d/binary-objc.mk
index 0fdcda5..520d295 100644
--- a/debian/rules.d/binary-objc.mk
+++ b/debian/rules.d/binary-objc.mk
@@ -24,18 +24,18 @@ $(binary_stamp)-objc: $(install_stamp)
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	rm -f $(d)/$(PFL)/$(libdir)/libobjc.{la,so}
-	mv $(d)/$(PFL)/$(libdir)/libobjc*.a $(d)/$(gcc_lib_dir)/
+	rm -f $(d)/$(usr_lib)/libobjc.{la,so}
+	mv $(d)/$(usr_lib)/libobjc*.a $(d)/$(gcc_lib_dir)/

 	rm -rf $(d_objc)
 	dh_installdirs -p$(p_objc) $(dirs_objc)
 	DH_COMPAT=2 dh_movefiles -p$(p_objc) $(files_objc)

 	dh_link -p$(p_objc) \
-	  /$(PFL)/$(libdir)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir)/libobjc.so
+	  /$(usr_lib)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir)/libobjc.so
 ifeq ($(with_objc_gc),yes)
 	dh_link -p$(p_objc) \
-	  /$(PFL)/$(libdir)/libobjc_gc.so.$(OBJC_SONAME) \
+	  /$(usr_lib)/libobjc_gc.so.$(OBJC_SONAME) \
 	  /$(gcc_lib_dir)/libobjc_gc.so
 endif

@@ -72,36 +72,36 @@ $(binary_stamp)-objc-multi: $(install_stamp)
 		$(gcc_lib_dir)/$(biarchsubdirs)

 ifeq ($(biarch64),yes)
-	rm -f $(d)/$(PFL)/lib64/libobjc*.{la,so}
-	mkdir -p $(d_objc_m)/$(gcc_lib_dir)/$(biarch64subdir)
-	mv $(d)/$(PFL)/lib64/libobjc*.a $(d_objc_m)/$(gcc_lib_dir)/$(biarch64subdir)/
+	rm -f $(d)/$(usr_lib64)/libobjc*.{la,so}
+	mkdir -p $(d_objc_m)/$(gcc_lib_dir64)
+	mv $(d)/$(usr_lib64)/libobjc*.a $(d_objc_m)/$(gcc_lib_dir64)/
 	dh_link -p$(p_objc_m) \
-	  /$(PFL)/lib64/libobjc.so.$(OBJC_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libobjc.so
+	  /$(usr_lib64)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir64)/libobjc.so
   ifeq ($(with_objc_gc),yes)
 	dh_link -p$(p_objc_m) \
-	  /$(PFL)/lib64/libobjc_gc.so.$(OBJC_SONAME)
/$(gcc_lib_dir)/$(biarch64subdir)/libobjc_gc.so
+	  /$(usr_lib64)/libobjc_gc.so.$(OBJC_SONAME) /$(gcc_lib_dir64)/libobjc_gc.so
   endif
 endif
 ifeq ($(biarch32),yes)
-	rm -f $(d)/$(PFL)/lib32/libobjc*.{la,so}
-	mkdir -p $(d_objc_m)/$(gcc_lib_dir)/$(biarch32subdir)
-	mv $(d)/$(PFL)/lib32/libobjc*.a $(d_objc_m)/$(gcc_lib_dir)/$(biarch32subdir)/
+	rm -f $(d)/$(usr_lib32)/libobjc*.{la,so}
+	mkdir -p $(d_objc_m)/$(gcc_lib_dir32)
+	mv $(d)/$(usr_lib32)/libobjc*.a $(d_objc_m)/$(gcc_lib_dir32)/
 	dh_link -p$(p_objc_m) \
-	  /$(PFL)/lib32/libobjc.so.$(OBJC_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libobjc.so
+	  /$(usr_lib32)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir32)/libobjc.so
   ifeq ($(with_objc_gc),yes)
 	dh_link -p$(p_objc_m) \
-	  /$(PFL)/lib32/libobjc_gc.so.$(OBJC_SONAME)
/$(gcc_lib_dir)/$(biarch32subdir)/libobjc_gc.so
+	  /$(usr_lib32)/libobjc_gc.so.$(OBJC_SONAME) /$(gcc_lib_dir32)/libobjc_gc.so
   endif
 endif
 ifeq ($(biarchn32),yes)
-	rm -f $(d)/$(PFL)/$(libn32)/libobjc*.{la,so}
-	mkdir -p $(d_objc_m)/$(gcc_lib_dir)/$(biarchn32subdir)
-	mv $(d)/$(PFL)/$(libn32)/libobjc*.a
$(d_objc_m)/$(gcc_lib_dir)/$(biarchn32subdir)/
+	rm -f $(d)/$(usr_libn32)/libobjc*.{la,so}
+	mkdir -p $(d_objc_m)/$(gcc_lib_dirn32)
+	mv $(d)/$(usr_libn32)/libobjc*.a $(d_objc_m)/$(gcc_lib_dirn32)/
 	dh_link -p$(p_objc_m) \
-	  /$(PFL)/$(libn32)/libobjc.so.$(OBJC_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libobjc.so
+	  /$(usr_libn32)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dirn32)/libobjc.so
   ifeq ($(with_objc_gc),yes)
 	dh_link -p$(p_objc_m) \
-	  /$(PFL)/$(libn32)/libobjc_gc.so.$(OBJC_SONAME)
/$(gcc_lib_dir)/$(biarchn32subdir)/libobjc_gc.so
+	  /$(usr_libn32)/libobjc_gc.so.$(OBJC_SONAME) /$(gcc_lib_dirn32)/libobjc_gc.so
   endif
 endif

diff --git a/debian/rules2 b/debian/rules2
index 7dd8ae0..a813d60 100644
--- a/debian/rules2
+++ b/debian/rules2
@@ -599,6 +599,20 @@ p_d= $(1)-dbg$(cross_lib_arch)
 d_l= debian/$(p_l)
 d_d= debian/$(p_d)

+usr_lib = $(PFL)/$(libdir)
+usr_lib32 = $(PFL)/lib32
+usr_libn32 = $(PFL)/lib32
+usr_lib64 = $(PFL)/lib64
+
+gcc_lib_dir32 = $(gcc_lib_dir)/$(biarch32subdir)
+gcc_lib_dirn32 = $(gcc_lib_dir)/$(biarchn32subdir)
+gcc_lib_dir64 = $(gcc_lib_dir)/$(biarch64subdir)
+
+libgcc_dir = $(RPF)/$(libdir)
+libgcc_dir32 = $(PFL)/lib32	# yes, really; lib32gcc_s ends up in usr
+libgcc_dirn32 = $(RPF)/lib32
+libgcc_dir64 = $(RPF)/lib64
+
 checkdirs = $(builddir)
 ifeq ($(with_separate_libgcj),yes)
   ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
-- 
1.7.1


From 55514edb17cc168102992ec0ba10b81e82646b32 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Sun, 29 Aug 2010 15:34:53 -0400
Subject: [PATCH 2/8] merge subarch stuff in gcc.mk

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.d/binary-gcc.mk |  169 ++++++++++++------------------------------
 debian/rules.defs            |    2 +
 2 files changed, 50 insertions(+), 121 deletions(-)

diff --git a/debian/rules.d/binary-gcc.mk b/debian/rules.d/binary-gcc.mk
index ea7c400..2f82774 100644
--- a/debian/rules.d/binary-gcc.mk
+++ b/debian/rules.d/binary-gcc.mk
@@ -24,13 +24,12 @@ dirs_gcc = \
 	$(PF)/bin \
 	$(gcc_lexec_dir) \
 	$(gcc_lib_dir)/{include,include-fixed} \
-	$(PF)/share/man/man1 $(libdir)
+	$(PF)/share/man/man1 $(libgcc_dir)

 # XXX: what about triarch mapping?
 files_gcc = \
 	$(PF)/bin/$(cmd_prefix){gcc,gcov}$(pkg_ver) \
 	$(gcc_lexec_dir)/collect2 \
-	$(gcc_lib_dir)/{libgcc*,libgcov.a,*.o} \
 	$(gcc_lib_dir)/include/std*.h \
 	$(shell for h in \
 		    README features.h arm_neon.h \
@@ -62,9 +61,6 @@ ifneq ($(GFDL_INVARIANT_FREE),yes)
 	$(PF)/share/man/man1/$(cmd_prefix){gcc,gcov}$(pkg_ver).1
 endif

-ifeq ($(with_ssp),yes)
-    files_gcc += $(gcc_lib_dir)/libssp_nonshared.a
-endif
 ifeq ($(with_libssp),yes)
     files_gcc += $(gcc_lib_dir)/include/ssp
 endif
@@ -97,6 +93,35 @@ d_gcc_m	= debian/$(p_gcc_m)
 p_pld	= gcc$(pkg_ver)-plugin-dev
 d_pld	= debian/$(p_pld)

+# install_gcc_lib(lib,soname,flavour,package)
+define install_gcc_lib
+	mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3))/
+	rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so}
+	dh_link -p$(4) \
+	  /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so
+
+endef
+
+# misc_gcc_libs(flavour,package)
+define misc_gcc_libs
+	dh_installdirs -p$(2) $(gcc_lib_dir$(1))
+	DH_COMPAT=2 dh_movefiles -p$(2) \
+		$(gcc_lib_dir$(1))/{libgcc*,libgcov.a,*.o}
+	$(if $(filter yes, $(with_lib$(1)gmath)),
+		$(call install_gcc_lib,libgcc-math,$(GCC_SONAME),$(1),$(2))
+	)
+	$(if $(filter yes, $(with_libssp)),
+		$(call install_gcc_lib,libssp,$(SSP_SONAME),$(1),$(2))
+	)
+	$(if $(filter yes, $(with_ssp)),
+		mv $(d)/$(usr_lib$(1))/libssp_nonshared.a \
+			debian/$(2)/$(gcc_lib_dir$(1))/;
+	)
+	$(if $(filter yes, $(with_gomp)),
+		$(call install_gcc_lib,libgomp,$(GOMP_SONAME),$(1),$(2))
+	)
+endef
+
 # ----------------------------------------------------------------------
 $(binary_stamp)-gcc: $(install_dependencies)
 	dh_testdir
@@ -106,6 +131,8 @@ $(binary_stamp)-gcc: $(install_dependencies)
 	rm -rf $(d_gcc)
 	dh_installdirs -p$(p_gcc) $(dirs_gcc)

+	$(call misc_gcc_libs,,$(p_gcc))
+
 ifneq ($(DEB_STAGE),stage1) # stage1 builds static libgcc only
 	: # libgcc_s.so may be a linker script on some architectures
 	set -e; \
@@ -119,29 +146,12 @@ ifneq ($(DEB_STAGE),stage1) # stage1 builds
static libgcc only
 	    $(gcc_lib_dir)/libgcc_s.so.$(GCC_SONAME); \
 	fi
 endif
-ifeq ($(with_libgmath),yes)
-	rm -f $(d)/$(usr_lib)/libgcc-math.{la,so}
-	dh_link -p$(p_gcc) \
-	  /$(usr_lib)/libgcc-math.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc-math.so
-	mv $(d)/$(usr_lib)/libgcc-math.a $(d)/$(gcc_lib_dir)/
-endif
-
-ifeq ($(with_ssp),yes)
-	mv $(d)/$(usr_lib)/libssp_nonshared.a $(d)/$(gcc_lib_dir)/
-endif
 ifeq ($(with_libssp),yes)
-	mv $(d)/$(usr_lib)/libssp*.a $(d_gcc)/$(gcc_lib_dir)/
-	rm -f $(d)/$(usr_lib)/libssp*.{la,so}
-	dh_link -p$(p_gcc) \
-	  /$(usr_lib)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir)/libssp.so
 	cp -p $(srcdir)/libssp/ChangeLog \
 		$(d_gcc)/$(docdir)/$(p_base)/libssp/changelog
 endif
 ifeq ($(with_gomp),yes)
-	mv $(d)/$(usr_lib)/libgomp*.{a,spec} $(d_gcc)/$(gcc_lib_dir)/
-	rm -f $(d)/$(usr_lib)/libgomp*.{la,so}
-	dh_link -p$(p_gcc) \
-	  /$(usr_lib)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir)/libgomp.so
+	mv $(d)/$(usr_lib)/libgomp*.spec $(d_gcc)/$(gcc_lib_dir)/
 	cp -p $(srcdir)/libgomp/ChangeLog \
 		$(d_gcc)/$(docdir)/$(p_base)/gomp/changelog
 endif
@@ -204,111 +214,28 @@ endif
 	-find $(d) ! -type d

 # ----------------------------------------------------------------------
+
+# do_gcc_multi(flavour)
+define do_gcc_multi
+	dh_installdirs -p$(p_gcc_m) $(libgcc_dir$(1))
+	$(call misc_gcc_libs,$(1),$(p_gcc_m))
+	rm -f $(d)/$(usr_lib$(1))/libgcc_s.so
+	dh_link -p$(p_gcc_m) \
+	  $(libgcc_dir$(1))/libgcc_s.so.$(GCC_SONAME)
/$(gcc_lib_dir)/libgcc_s_$(1).so \
+	  $(libgcc_dir$(1))/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir$(1))/libgcc_s.so
+
+endef
+
 $(binary_stamp)-gcc-multi: $(install_dependencies)
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

 	rm -rf $(d_gcc_m)
-	dh_installdirs -p$(p_gcc_m) \
-		$(docdir) \
-		$(gcc_lib_dir)/$(biarchsubdirs) \
+	dh_installdirs -p$(p_gcc_m) $(docdir)

-ifeq ($(biarch64),yes)
-	DH_COMPAT=2 dh_movefiles -p$(p_gcc_m) \
-		$(gcc_lib_dir64)/{libgcc*,libgcov.a,*.o}
-	rm -f $(d)/$(usr_lib64)/libgcc_s.so
-	dh_link -p$(p_gcc_m) \
-	  $(libgcc_dir64)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc_s_64.so \
-	  $(libgcc_dir64)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir64)/libgcc_s.so
-  ifeq ($(with_lib64gmath),yes)
-	rm -f $(d)/$(usr_lib64)/libgcc-math.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_lib64)/libgcc-math.so.$(GCC_SONAME) /$(gcc_lib_dir64)/libgcc-math.so
-	mv $(d)/$(usr_lib64)/libgcc-math.a $(d)/$(gcc_lib_dir64)/
-  endif
-endif
-ifeq ($(biarch32),yes)
-	DH_COMPAT=2 dh_movefiles -p$(p_gcc_m) \
-		$(gcc_lib_dir32)/{libgcc*,libgcov.a,*.o}
-	rm -f $(d)/$(libgcc_dir32)/libgcc_s.so
-	dh_link -p$(p_gcc_m) \
-	 $(libgcc_dir32)/libgcc_s.so.$(GCC_SONAME)  /$(gcc_lib_dir)/libgcc_s_32.so \
-	 $(libgcc_dir32)/libgcc_s.so.$(GCC_SONAME)  /$(gcc_lib_dir32)/libgcc_s.so
-  ifeq ($(with_lib32gmath),yes)
-	rm -f $(d)/$(usr_lib32)/libgcc-math.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  $(usr_lib32)/libgcc-math.so.$(GCC_SONAME) /$(gcc_lib_dir32)/libgcc-math.so
-	mv $(d)/$(usr_lib32)/libgcc-math.a $(d)/$(gcc_lib_dir32)/
-  endif
-endif
-ifeq ($(biarchn32),yes)
-	DH_COMPAT=2 dh_movefiles -p$(p_gcc_m) \
-		$(gcc_lib_dirn32)/{libgcc*,libgcov.a,*.o}
-	rm -f $(d)/$(usr_libn32)/libgcc_s.so
-	dh_link -p$(p_gcc_m) \
-	  $(libgcc_dirn32)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dir)/libgcc_s_n32.so \
-	  $(libgcc_dirn32)/libgcc_s.so.$(GCC_SONAME) /$(gcc_lib_dirn32)/libgcc_s.so
-  ifeq ($(with_libn32gmath),yes)
-	rm -f $(d)/$(usr_libn32)/libgcc-math.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_libn32)/libgcc-math.so.$(GCC_SONAME)
/$(gcc_lib_dirn32)/libgcc-math.so
-	mv $(d)/$(usr_libn32)/libgcc-math.a $(d)/$(gcc_lib_dirn32)/
-  endif
-endif
-
-ifeq ($(with_libssp),yes)
-  ifeq ($(biarch64),yes)
-	mv $(d)/$(usr_lib64)/libssp*.a $(d_gcc_m)/$(gcc_lib_dir64)/
-	rm -f $(d)/$(usr_lib64)/$(biarch64subdir)/libssp*.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_lib64)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir64)/libssp.so
-  endif
-  ifeq ($(biarch32),yes)
-	mv $(d)/$(usr_lib32)/libssp*.a $(d_gcc_m)/$(gcc_lib_dir32)/
-	rm -f $(d)/$(usr_lib32)/$(biarch32subdir)/libssp*.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_lib32)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dir32)/libssp.so
-  endif
-  ifeq ($(biarchn32),yes)
-	mv $(d)/$(usr_libn32)/libssp*.a $(d_gcc_m)/$(gcc_lib_dirn32)/
-	rm -f $(d)/$(usr_libn32)/$(biarchn32subdir)/libssp*.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_libn32)/libssp.so.$(SSP_SONAME) /$(gcc_lib_dirn32)/libssp.so
-  endif
-endif
-ifeq ($(with_ssp),yes)
-  ifeq ($(biarch64),yes)
-	mv $(d)/$(usr_lib64)/libssp_nonshared.a $(d_gcc_m)/$(gcc_lib_dir64)/
-  endif
-  ifeq ($(biarch32),yes)
-	mv $(d)/$(usr_lib32)/libssp_nonshared.a $(d_gcc_m)/$(gcc_lib_dir32)/
-  endif
-  ifeq ($(biarchn32),yes)
-	mv $(d)/$(usr_libn32)/libssp_nonshared.a $(d_gcc_m)/$(gcc_lib_dirn32)/
-  endif
-endif
-
-ifeq ($(with_gomp),yes)
-  ifeq ($(biarch64),yes)
-	mv $(d)/$(usr_lib64)/libgomp*.a $(d_gcc_m)/$(gcc_lib_dir64)/
-	rm -f $(d)/$(usr_lib64)/$(biarch64subdir)/libgomp*.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_lib64)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir64)/libgomp.so
-  endif
-  ifeq ($(biarch32),yes)
-	mv $(d)/$(usr_lib32)/libgomp*.a $(d_gcc_m)/$(gcc_lib_dir32)/
-	rm -f $(d)/$(usr_lib32)/$(biarch32subdir)/libgomp*.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_lib32)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dir32)/libgomp.so
-  endif
-  ifeq ($(biarchn32),yes)
-	mv $(d)/$(usr_libn32)/libgomp*.a $(d_gcc_m)/$(gcc_lib_dirn32)/
-	rm -f $(d)/$(usr_libn32)/$(biarchn32subdir)/libgomp*.{la,so}
-	dh_link -p$(p_gcc_m) \
-	  /$(usr_libn32)/libgomp.so.$(GOMP_SONAME) /$(gcc_lib_dirn32)/libgomp.so
-  endif
-endif
+	$(foreach flavour,$(flavours), \
+		$(call do_gcc_multi,$(flavour)))

 	debian/dh_doclink -p$(p_gcc_m) $(p_base)
 	debian/dh_rmemptydirs -p$(p_gcc_m)
diff --git a/debian/rules.defs b/debian/rules.defs
index 30d3dcd..2a0bb9d 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -956,12 +956,14 @@ biarch_cpu := $(strip $(patsubst
$(DEB_TARGET_GNU_CPU)=%,%, \
 biarch64 := no
 biarch32 := no
 biarchn32 := no
+flavours :=
 define gen_biarch
   ifneq (yes,$$(call envfilt, biarch, , ,yes))
     biarch$1archs :=
   endif
   ifneq (,$$(findstring /$$(DEB_TARGET_ARCH)/,$$(biarch$1archs)))
     biarch$1 := yes
+    flavours += $1
     #biarch$1subdir = $$(biarch_cpu)-$$(DEB_TARGET_GNU_SYSTEM)
     biarch$1subdir = $1
     ifeq ($$(with_libgcc),yes)
-- 
1.7.1


From 46b539c3cb378a975f0b3b144ec6d09b111259d7 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Sun, 29 Aug 2010 16:34:28 -0400
Subject: [PATCH 3/8] merge rules for libgcc biarch variants

note that d_lgcc et.al. are still needed for libstdcxx.mk

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.d/binary-libgcc.mk |  202 +++++++++++----------------------------
 1 files changed, 54 insertions(+), 148 deletions(-)

diff --git a/debian/rules.d/binary-libgcc.mk b/debian/rules.d/binary-libgcc.mk
index c18ec11..b45a4b4 100644
--- a/debian/rules.d/binary-libgcc.mk
+++ b/debian/rules.d/binary-libgcc.mk
@@ -32,169 +32,75 @@ p_ln32gccdbg	= libn32gcc$(GCC_SONAME)-dbg$(cross_lib_arch)
 d_ln32gcc	= debian/$(p_ln32gcc)
 d_ln32gccdbg	= debian/$(p_ln32gccdbg)

-# ----------------------------------------------------------------------
-$(binary_stamp)-libgcc: $(install_dependencies)
+define __do_libgcc
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	rm -rf $(d_lgcc) $(d_lgccdbg)
-	dh_installdirs -p$(p_lgcc) \
-		$(docdir)/$(p_lgcc) \
-		$(libgcc_dir)
-
-ifeq ($(with_shared_libgcc),yes)
-	mv $(d)/$(usr_lib)/libgcc_s.so.$(GCC_SONAME) $(d_lgcc)/$(libgcc_dir)/.
-endif
-
-ifeq ($(with_standalone_gcj),yes)
-	debian/dh_doclink -p$(p_lgcc) $(p_jbase)
-	debian/dh_doclink -p$(p_lgccdbg) $(p_jbase)
-else
-	debian/dh_doclink -p$(p_lgcc) $(p_base)
-	debian/dh_doclink -p$(p_lgccdbg) $(p_base)
-endif
-	debian/dh_rmemptydirs -p$(p_lgcc)
-	debian/dh_rmemptydirs -p$(p_lgccdbg)
-	dh_strip -v -p$(p_lgcc) --dbg-package=$(p_lgccdbg)
-	dh_compress -p$(p_lgcc) -p$(p_lgccdbg)
-	dh_fixperms -p$(p_lgcc) -p$(p_lgccdbg)
-ifeq ($(with_shared_libgcc),yes)
-	dh_makeshlibs -p$(p_lgcc) \
-		-- -v$(DEB_LIBGCC_VERSION)
-	$(call cross_mangle_shlibs,$(p_lgcc))
-  ifeq ($(DEB_TARGET_ARCH),armel)
-	grep -q '^ __aeabi' $(d_lgcc)/DEBIAN/symbols \
-	  || cat debian/libgcc1.symbols.aeabi >> $(d_lgcc)/DEBIAN/symbols
-  endif
-endif
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_lgcc)
-	$(call cross_mangle_substvars,$(p_lgcc))
-	dh_gencontrol -p$(p_lgcc) -p$(p_lgccdbg) \
+	rm -rf $(d_l) $(d_d)
+
+	dh_installdirs -p$(p_l) \
+		$(docdir)/$(p_l) \
+		$(libgcc_dir$(2))
+	$(if $(filter yes,$(with_shared_libgcc)),
+		mv $(d)/$(usr_lib$(2))/libgcc_s.so.$(GCC_SONAME) \
+			$(d_l)/$(libgcc_dir$(2))/.
+	)
+
+	debian/dh_doclink -p$(p_l) $(if $(3),$(3),$(p_base))
+	debian/dh_doclink -p$(p_d) $(if $(3),$(3),$(p_base))
+	debian/dh_rmemptydirs -p$(p_l)
+	debian/dh_rmemptydirs -p$(p_d)
+	dh_strip -p$(p_l) --dbg-package=$(p_d)
+
+	$(if $(filter yes,$(with_shared_libgcc)),
+		dh_makeshlibs -p$(p_l) -p$(p_d) \
+			-- -v$(DEB_LIBGCC_VERSION)
+		$(call cross_mangle_shlibs,$(p_l))
+		$(if $(filter $(DEB_TARGET_ARCH),armel),
+			grep -q '^ __aeabi' $(d_l)/DEBIAN/symbols \
+			  || cat debian/libgcc1.symbols.aeabi \
+				>> $(d_l)/DEBIAN/symbols
+		)
+	)
+
+	$(cross_shlibdeps) dh_shlibdeps -p$(p_l)
+	$(call cross_mangle_substvars,$(p_l))
+
+	dh_compress -p$(p_l) -p$(p_d)
+	dh_fixperms -p$(p_l) -p$(p_d)
+	dh_gencontrol -p$(p_l) -p$(p_d) \
 		-- -v$(DEB_LIBGCC_VERSION) $(common_substvars)
+	$(call cross_mangle_control,$(p_l))

-	mkdir -p $(d_lgcc)/usr/share/lintian/overrides
-	echo '$(p_lgcc): package-name-doesnt-match-sonames' \
-		> $(d_lgcc)/usr/share/lintian/overrides/$(p_lgcc)
+	$(if $(2),,	# only for native
+		mkdir -p $(d_l)/usr/share/lintian/overrides
+		echo '$(p_l): package-name-doesnt-match-sonames' \
+			> $(d_l)/usr/share/lintian/overrides/$(p_l)
+	)

-	dh_installdeb -p$(p_lgcc) -p$(p_lgccdbg)
-	dh_md5sums -p$(p_lgcc) -p$(p_lgccdbg)
-	dh_builddeb -p$(p_lgcc) -p$(p_lgccdbg)
+	dh_installdeb -p$(p_l) -p$(p_d)
+	dh_md5sums -p$(p_l) -p$(p_d)
+	dh_builddeb -p$(p_l) -p$(p_d)

 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+endef

+do_libgcc = $(call __do_libgcc,lib$(1)gcc$(GCC_SONAME),$(1),$(2))
 # ----------------------------------------------------------------------
-$(binary_stamp)-lib64gcc: $(install_dependencies)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_l64gcc) $(d_l64gccdbg)
-	dh_installdirs -p$(p_l64gcc) \
-		$(docdir)/$(p_l64gcc) \
-		$(libgcc_dir64)
-
-ifeq ($(with_shared_libgcc),yes)
-	mv $(d)/$(usr_lib64)/libgcc_s.so.$(GCC_SONAME) $(d_l64gcc)/$(libgcc_dir64)/.
-endif

-	debian/dh_doclink -p$(p_l64gcc) $(p_base)
-	debian/dh_doclink -p$(p_l64gccdbg) $(p_base)
-	debian/dh_rmemptydirs -p$(p_l64gcc)
-	debian/dh_rmemptydirs -p$(p_l64gccdbg)
-	dh_strip -p$(p_l64gcc) --dbg-package=$(p_l64gccdbg)
-	dh_compress -p$(p_l64gcc) -p$(p_l64gccdbg)
-	dh_fixperms -p$(p_l64gcc) -p$(p_l64gccdbg)
-
-ifeq ($(with_shared_libgcc),yes)
-	dh_makeshlibs -p$(p_l64gcc) \
-		-- -v$(DEB_LIBGCC_VERSION)
-	$(call cross_mangle_shlibs,$(p_l64gcc))
+$(binary_stamp)-libgcc: $(install_dependencies)
+ifeq ($(with_standalone_gcj),yes)
+	$(call do_libgcc,,$(p_jbase))
+else
+	$(call do_libgcc,,)
 endif
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_l64gcc)
-	$(call cross_mangle_substvars,$(p_l64gcc))
-
-	dh_gencontrol -p$(p_l64gcc) -p$(p_l64gccdbg) \
-		-- -v$(DEB_LIBGCC_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_l64gcc))
-	dh_installdeb -p$(p_l64gcc) -p$(p_l64gccdbg)
-	dh_md5sums -p$(p_l64gcc) -p$(p_l64gccdbg)
-	dh_builddeb -p$(p_l64gcc) -p$(p_l64gccdbg)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)

-# ----------------------------------------------------------------------
+$(binary_stamp)-lib64gcc: $(install_dependencies)
+	$(call do_libgcc,64,)

 $(binary_stamp)-lib32gcc: $(install_dependencies)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_l32gcc) $(d_l32gccdbg)
-
-	dh_installdirs -p$(p_l32gcc) \
-		$(docdir)/$(p_l32gcc) \
-		$(libgcc_dir32)
-	mv $(d)/$(usr_lib32)/libgcc_s.so.$(GCC_SONAME) \
-		$(d_l32gcc)/$(libgcc_dir32)/.
-
-	debian/dh_doclink -p$(p_l32gcc) $(p_base)
-	debian/dh_doclink -p$(p_l32gccdbg) $(p_base)
-	debian/dh_rmemptydirs -p$(p_l32gcc)
-	debian/dh_rmemptydirs -p$(p_l32gccdbg)
-	dh_strip -p$(p_l32gcc) --dbg-package=$(p_l32gccdbg)
-
-	dh_makeshlibs -p$(p_l32gcc) -p$(p_l32gccdbg) \
-		-- -v$(DEB_LIBGCC_VERSION)
-	$(call cross_mangle_shlibs,$(p_l32gcc))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_l32gcc)
-	$(call cross_mangle_substvars,$(p_l32gcc))
-
-	dh_compress -p$(p_l32gcc) -p$(p_l32gccdbg)
-	dh_fixperms -p$(p_l32gcc) -p$(p_l32gccdbg)
-	dh_gencontrol -p$(p_l32gcc) -p$(p_l32gccdbg) \
-		-- -v$(DEB_LIBGCC_VERSION) $(common_substvars)
-	rm -f debian/lib32gcc1.preinst
-	dh_installdeb -p$(p_l32gcc) -p$(p_l32gccdbg)
-	dh_md5sums -p$(p_l32gcc) -p$(p_l32gccdbg)
-	dh_builddeb -p$(p_l32gcc) -p$(p_l32gccdbg)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
-
-# ----------------------------------------------------------------------
+	$(call do_libgcc,32,)

 $(binary_stamp)-libn32gcc: $(install_dependencies)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_ln32gcc) $(d_ln32gccdbg)
-
-	dh_installdirs -p$(p_ln32gcc) \
-		$(docdir)/$(p_ln32gcc) \
-		$(libgcc_dirn32)
-	mv $(d)/$(usr_libn32)/libgcc_s.so.$(GCC_SONAME) \
-		$(d_ln32gcc)/$(libgcc_dirn32)/.
-
-	debian/dh_doclink -p$(p_ln32gcc) $(p_base)
-	debian/dh_doclink -p$(p_ln32gccdbg) $(p_base)
-	debian/dh_rmemptydirs -p$(p_ln32gcc)
-	debian/dh_rmemptydirs -p$(p_ln32gccdbg)
-	dh_strip -p$(p_ln32gcc) --dbg-package=$(p_ln32gccdbg)
-
-	dh_makeshlibs -p$(p_ln32gcc) -p$(p_ln32gccdbg) \
-		-- -v$(DEB_LIBGCC_VERSION)
-	$(call cross_mangle_shlibs,$(p_ln32gcc))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_ln32gcc)
-	$(call cross_mangle_substvars,$(p_ln32gcc))
-
-	dh_compress -p$(p_ln32gcc) -p$(p_ln32gccdbg)
-	dh_fixperms -p$(p_ln32gcc) -p$(p_ln32gccdbg)
-	dh_gencontrol -p$(p_ln32gcc) -p$(p_ln32gccdbg) \
-		-- -v$(DEB_LIBGCC_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_ln32gcc))
-	dh_installdeb -p$(p_ln32gcc) -p$(p_ln32gccdbg)
-	dh_md5sums -p$(p_ln32gcc) -p$(p_ln32gccdbg)
-	dh_builddeb -p$(p_ln32gcc) -p$(p_ln32gccdbg)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+	$(call do_libgcc,n32,)
-- 
1.7.1


From 5bbefba34be979725d80e90e21e414cb89d409eb Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon, 30 Aug 2010 18:09:30 -0400
Subject: [PATCH 4/8] fix NO_BIARCH handling of with_lib*

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.defs |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/debian/rules.defs b/debian/rules.defs
index 2a0bb9d..f9ac9f8 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -1047,30 +1047,36 @@ endif
 ifeq ($(no_biarch_libs),yes)
   with_lib64gcc		:= no
   with_lib64cxx		:= no
+  with_lib64cxxdbg	:= no
   with_lib64objc	:= no
   with_lib64ffi		:= no
   with_lib64gcj		:= no
-  with_lib64fortran	:= no
+  with_lib64gfortran	:= no
   with_lib64mudflap	:= no
   with_lib64ssp		:= no
+  with_lib64gomp	:= no

   with_lib32gcc		:= no
   with_lib32cxx		:= no
+  with_lib32cxxdbg	:= no
   with_lib32objc	:= no
   with_lib32ffi		:= no
   with_lib32gcj		:= no
-  with_lib32fortran	:= no
+  with_lib32gfortran	:= no
   with_lib32mudflap	:= no
   with_lib32ssp		:= no
+  with_lib32gomp	:= no

   with_libn32gcc	:= no
   with_libn32cxx	:= no
+  with_libn32cxxdbg	:= no
   with_libn32objc	:= no
   with_libn32ffi	:= no
   with_libn32gcj	:= no
-  with_libn32fortran	:= no
+  with_libn32gfortran	:= no
   with_libn32mudflap	:= no
   with_libn32ssp	:= no
+  with_libn32gomp	:= no

   ifeq ($(PKGSOURCE),gcc-snapshot)
     #biarch64	:= disabled for snapshot build
-- 
1.7.1


From ce0cef3d862a27da6f2911274f03e2ce7589e22e Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Tue, 31 Aug 2010 13:05:39 -0400
Subject: [PATCH 5/8] merge rules for libstdc++, fixes

n32 variant of libstdc++-dbg removed _pic.a from the wrong place

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.d/binary-libstdcxx.mk |  334 +++++++++---------------------------
 1 files changed, 80 insertions(+), 254 deletions(-)

diff --git a/debian/rules.d/binary-libstdcxx.mk
b/debian/rules.d/binary-libstdcxx.mk
index 809a312..a245f16 100644
--- a/debian/rules.d/binary-libstdcxx.mk
+++ b/debian/rules.d/binary-libstdcxx.mk
@@ -51,7 +51,6 @@ d_pic	= debian/$(p_pic)
 d_dbg	= debian/$(p_dbg)
 d_dbg64	= debian/$(p_dbg64)
 d_dbg32	= debian/$(p_dbg32)
-d_dbgn32= debian/$(p_dbgn32)
 d_libd	= debian/$(p_libd)

 dirs_dev = \
@@ -116,285 +115,111 @@ debian/README.libstdc++-baseline:
 	fi

 # ----------------------------------------------------------------------
-$(binary_stamp)-libstdcxx: $(install_stamp)
+define __do_libstdcxx
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	rm -rf $(d_lib)
-	dh_installdirs -p$(p_lib) \
-		$(docdir) \
-		$(usr_lib)
-
-	cp -a $(d)/$(usr_lib)/libstdc++.so.* \
-		$(d_lib)/$(usr_lib)/
-
-	debian/dh_doclink -p$(p_lib) $(p_base)
-	debian/dh_rmemptydirs -p$(p_lib)
-
-	dh_strip -p$(p_lib)
-	dh_compress -p$(p_lib)
-	dh_fixperms -p$(p_lib)
-
-	dh_makeshlibs -p$(p_lib)
-	$(call cross_mangle_shlibs,$(p_lib))
-	$(cross_shlibdeps) dh_shlibdeps \
-		-L$(p_lgcc) -l:$(d)/$(usr_lib):$(d_lgcc)/$(libdir):\
-		-p$(p_lib)
-	$(call cross_mangle_substvars,$(p_lib))
-
-	dh_gencontrol -p$(p_lib) -- -v$(DEB_VERSION) $(common_substvars)
-	dh_installdeb -p$(p_lib)
-	dh_md5sums -p$(p_lib)
-	dh_builddeb -p$(p_lib)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
-
-# ----------------------------------------------------------------------
-
-libc64_map = i386=amd64 sparc=sparc64 powerpc=ppc64 s390=s390x
mips=mips64 mipsel=mips64
-libc64_name = $(patsubst $(DEB_TARGET_ARCH)=%,%, \
-		$(filter $(DEB_TARGET_ARCH)=%,$(libc64_map)))
-libc64_dep = $(if $(libc64_name),libc6-$(libc64_name)$(cross_lib_arch))
+	rm -rf $(d_l)

-$(binary_stamp)-lib64stdcxx: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_lib64)
-	dh_installdirs -p$(p_lib64) \
+	dh_installdirs -p$(p_l) \
 		$(docdir) \
-		$(usr_lib64)
-
-	cp -a $(d)/$(usr_lib64)/libstdc++.so.* \
-		$(d_lib64)/$(usr_lib64)/.
+		$(usr_lib$(2))

-	dh_strip -p$(p_lib64)
+	cp -a $(d)/$(usr_lib$(2))/libstdc++.so.* \
+		$(d_l)/$(usr_lib$(2))/.

-	debian/dh_doclink -p$(p_lib64) $(p_base)
-	debian/dh_rmemptydirs -p$(p_lib64)
+	debian/dh_doclink -p$(p_l) $(p_base)
+	debian/dh_rmemptydirs -p$(p_l)

-	dh_compress -p$(p_lib64)
-	dh_fixperms -p$(p_lib64)
+	dh_strip -p$(p_l)
+	dh_compress -p$(p_l)
+	dh_fixperms -p$(p_l)

-	dh_makeshlibs -p$(p_lib64)
-	$(call cross_mangle_shlibs,$(p_lib64))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_lib64) \
-		-L $(p_l64gcc) -l:$(d)/$(PF)/lib64:$(d_l64gcc)/lib64
-	$(call cross_mangle_substvars,$(p_lib64))
+	dh_makeshlibs -p$(p_l)
+	$(call cross_mangle_shlibs,$(p_l))
+	$(cross_shlibdeps) dh_shlibdeps -p$(p_l) \
+		-L$(p_l$(2)gcc) -l:$(d)/$(usr_lib$(2)):
+	$(call cross_mangle_substvars,$(p_l))

-	dh_gencontrol -p$(p_lib64) -- -v$(DEB_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_lib64))
-	dh_installdeb -p$(p_lib64)
-	dh_md5sums -p$(p_lib64)
-	dh_builddeb -p$(p_lib64)
+	dh_gencontrol -p$(p_l) -- -v$(DEB_VERSION) $(common_substvars)
+	$(call cross_mangle_control,$(p_l))
+	dh_installdeb -p$(p_l)
+	dh_md5sums -p$(p_l)
+	dh_builddeb -p$(p_l)

 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+endef

-# ----------------------------------------------------------------------
-$(binary_stamp)-lib64stdcxxdbg: $(install_stamp)
+define __do_libstdcxx_dbg
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	rm -rf $(d_dbg64)
-	dh_installdirs -p$(p_dbg64) \
-		$(usr_lib64)
-ifeq ($(with_lib64cxx),yes)
-	cp -a $(d)/$(usr_lib64)/libstdc++.so.* \
-		$(d_dbg64)/$(usr_lib64)/.
-	dh_strip -p$(p_dbg64) --keep-debug
-	rm -f $(d_dbg64)/$(usr_lib64)/libstdc++.so.*
-  ifneq ($(with_common_libs),yes)
-	: # remove the debug symbols for libstdc++ built by a newer version of GCC
-	rm -rf $(d_dbg64)/usr/lib/debug/$(PF)
-  endif
-endif
-	echo 'shlibs:Depends=$(p_l64gcc) (>= $(DEB_LIBGCC_SOVERSION)),
$(libc64_dep)' \
-		> debian/$(p_dbg64).substvars
-
-ifeq ($(with_debug),yes)
-	mv $(d)/$(usr_lib64)/debug $(d_dbg64)/$(usr_lib64)/.
-	rm -f $(d_dbg64)/$(usr_lib64)/debug/libstdc++_pic.a
-endif
-
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_dbg64) \
-		-L$(p_l64gcc) -l:$(d)/$(PF)/lib64:$(d_l64gcc)/lib64:
-	$(call cross_mangle_substvars,$(p_dbg64))
-
-	debian/dh_doclink -p$(p_dbg64) $(p_base)
-	debian/dh_rmemptydirs -p$(p_dbg64)
-
-	dh_compress -p$(p_dbg64)
-	dh_fixperms -p$(p_dbg64)
-	dh_gencontrol -p$(p_dbg64) -- -v$(DEB_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_dbg64))
-
-	dh_installdeb -p$(p_dbg64)
-	dh_md5sums -p$(p_dbg64)
-	dh_builddeb -p$(p_dbg64)
+	rm -rf $(d_d)
+	dh_installdirs -p$(p_d) \
+		$(usr_lib$(2))
+
+	$(if $(filter yes,$(with_lib$(2)cxx)),
+		cp -a $(d)/$(usr_lib$(2))/libstdc++.so.* \
+			$(d_d)/$(usr_lib$(2))/.;
+		dh_strip -p$(p_d) --keep-debug;
+		$(if $(filter yes,$(with_common_libs)),, # if !with_common_libs
+			# remove the debug symbols for libstdc++
+			# built by a newer version of GCC
+			rm -rf $(d_d)/usr/lib/debug/$(PF);
+		)
+		rm -f $(d_d)/$(usr_lib$(2))/libstdc++.so.*
+	)
+
+	$(if $(filter yes,$(with_debug)),
+		mv $(d)/$(usr_lib$(2))/debug $(d_d)/$(usr_lib$(2))/.;
+		rm -f $(d_d)/$(usr_lib$(2))/debug/libstdc++_pic.a
+	)
+
+	$(cross_shlibdeps) dh_shlibdeps -p$(p_d) \
+		-L$(p_l$(2)gcc) -l:$(d)/$(usr_lib$(2)):
+	$(call cross_mangle_substvars,$(p_d))
+
+	debian/dh_doclink -p$(p_d) $(p_base)
+	debian/dh_rmemptydirs -p$(p_d)
+
+	dh_compress -p$(p_d)
+	dh_fixperms -p$(p_d)
+	dh_gencontrol -p$(p_d) -- -v$(DEB_VERSION) $(common_substvars)
+	$(call cross_mangle_control,$(p_d))
+
+	dh_installdeb -p$(p_d)
+	dh_md5sums -p$(p_d)
+	dh_builddeb -p$(p_d)

 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+endef

-# ----------------------------------------------------------------------
-$(binary_stamp)-lib32stdcxx: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_lib32)
-
-	dh_installdirs -p$(p_lib32) \
-		$(docdir) \
-		$(usr_lib32)
-
-	cp -a $(d)/$(usr_lib32)/libstdc++.so.* \
-		$(d_lib32)/$(usr_lib32)/.
-
-	debian/dh_doclink -p$(p_lib32) $(p_base)
-	debian/dh_rmemptydirs -p$(p_lib32)
-
-	dh_strip -p$(p_lib32)
-	dh_compress -p$(p_lib32)
-	dh_fixperms -p$(p_lib32)
-
-	dh_makeshlibs -p$(p_lib32)
-	$(call cross_mangle_shlibs,$(p_lib32))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_lib32) \
-		-L$(p_l32gcc) -l:$(d)/$(PF)/lib32:$(d_l32gcc)/lib32:
-	$(call cross_mangle_substvars,$(p_lib32))
-
-	dh_gencontrol -p$(p_lib32) -- -v$(DEB_VERSION) $(common_substvars)
-	dh_installdeb -p$(p_lib32)
-	dh_md5sums -p$(p_lib32)
-	dh_builddeb -p$(p_lib32)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+do_libstdcxx = $(call __do_libstdcxx,lib$(1)stdc++$(CXX_SONAME),$(1))
+do_libstdcxx_dbg = $(call
__do_libstdcxx_dbg,lib$(1)stdc++$(CXX_SONAME)$(libstdc_ext),$(1))

 # ----------------------------------------------------------------------
-$(binary_stamp)-lib32stdcxxdbg: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_dbg32)
-	dh_installdirs -p$(p_dbg32) \
-		$(usr_lib32)
-
-ifeq ($(with_lib32cxx),yes)
-	cp -a $(d)/$(usr_lib32)/libstdc++.so.* \
-		$(d_dbg32)/$(usr_lib32)/.
-	dh_strip -p$(p_dbg32) --keep-debug
-  ifneq ($(with_common_libs),yes)
-	: # remove the debug symbols for libstdc++ built by a newer version of GCC
-	rm -rf $(d_dbg32)/usr/lib/debug/$(PF)
-  endif
-	rm -f $(d_dbg32)/$(usr_lib32)/libstdc++.so.*
-endif
-
-ifeq ($(with_debug),yes)
-	mv $(d)/$(usr_lib32)/debug $(d_dbg32)/$(usr_lib32)/.
-	rm -f $(d_dbg32)/$(usr_lib32)/debug/libstdc++_pic.a
-endif
-
-	debian/dh_doclink -p$(p_dbg32) $(p_base)
-	debian/dh_rmemptydirs -p$(p_dbg32)
-
-	dh_compress -p$(p_dbg32)
-	dh_fixperms -p$(p_dbg32)
-
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_dbg32) \
-		-L$(p_l32gcc) -l:$(d)/$(PF)/lib32:$(d_l32gcc)/lib32:
-	$(call cross_mangle_substvars,$(p_dbg32))
-
-	dh_gencontrol -p$(p_dbg32) -- -v$(DEB_VERSION) $(common_substvars)
+$(binary_stamp)-libstdcxx: $(install_stamp)
+	$(call do_libstdcxx,)

-	dh_installdeb -p$(p_dbg32)
-	dh_md5sums -p$(p_dbg32)
-	dh_builddeb -p$(p_dbg32)
+$(binary_stamp)-lib64stdcxx: $(install_stamp)
+	$(call do_libstdcxx,64)

-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+$(binary_stamp)-lib32stdcxx: $(install_stamp)
+	$(call do_libstdcxx,32)

-# ----------------------------------------------------------------------
 $(binary_stamp)-libn32stdcxx: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_libn32)
-
-	dh_installdirs -p$(p_libn32) \
-		$(docdir) \
-		$(usr_libn32)
-
-	cp -a $(d)/$(usr_libn32)/libstdc++.so.* \
-		$(d_libn32)/$(usr_libn32)/.
-
-	debian/dh_doclink -p$(p_libn32) $(p_base)
-	debian/dh_rmemptydirs -p$(p_libn32)
+	$(call do_libstdcxx,n32)

-	dh_strip -p$(p_libn32)
-	dh_compress -p$(p_libn32)
-	dh_fixperms -p$(p_libn32)
-
-	dh_makeshlibs -p$(p_libn32)
-	$(call cross_mangle_shlibs,$(p_libn32))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_libn32) \
-		-L$(p_ln32gcc) -l:$(d)/$(usr_libn32):$(d_ln32gcc)/$(libn32):
-	$(call cross_mangle_substvars,$(p_libn32))
-
-	dh_gencontrol -p$(p_libn32) -- -v$(DEB_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_libn32))
-	dh_installdeb -p$(p_libn32)
-	dh_md5sums -p$(p_libn32)
-	dh_builddeb -p$(p_libn32)
+$(binary_stamp)-lib64stdcxxdbg: $(install_stamp)
+	$(call do_libstdcxx_dbg,64)

-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+$(binary_stamp)-lib32stdcxxdbg: $(install_stamp)
+	$(call do_libstdcxx_dbg,32)

-# ----------------------------------------------------------------------
 $(binary_stamp)-libn32stdcxxdbg: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_dbgn32)
-	dh_installdirs -p$(p_dbgn32) \
-		$(usr_libn32)
-
-ifeq ($(with_libn32cxx),yes)
-	cp -a $(d)/$(usr_libn32)/libstdc++.so.* \
-		$(d_dbgn32)/$(usr_libn32)/.
-	dh_strip -p$(p_dbgn32) --keep-debug
-  ifneq ($(with_common_libs),yes)
-	: # remove the debug symbols for libstdc++ built by a newer version of GCC
-	rm -rf $(d_dbgn32)/usr/lib/debug/$(PF)
-  endif
-	rm -f $(d_dbgn32)/$(usr_libn32)/libstdc++.so.*
-endif
-
-ifeq ($(with_debug),yes)
-	mv $(d)/$(usr_libn32)/debug $(d_dbgn32)/$(usr_libn32)/.
-	rm -f $(d_dbgn32)/$(libn32)/debug/libstdc++_pic.a
-endif
-
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_dbgn32) \
-		-L$(p_ln32gcc) -l:$(d)/$(PF)/$(libn32):$(d_ln32gcc)/$(libn32):
-	$(call cross_mangle_substvars,$(p_dbgn32))
-
-	debian/dh_doclink -p$(p_dbgn32) $(p_base)
-	debian/dh_rmemptydirs -p$(p_dbgn32)
-
-	dh_compress -p$(p_dbgn32)
-	dh_fixperms -p$(p_dbgn32)
-	dh_gencontrol -p$(p_dbgn32) -- -v$(DEB_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_dbgn32))
-
-	dh_installdeb -p$(p_dbgn32)
-	dh_md5sums -p$(p_dbgn32)
-	dh_builddeb -p$(p_dbgn32)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+	$(call do_libstdcxx_dbg,n32)

 # ----------------------------------------------------------------------
 libcxxdev_deps = $(install_stamp)
@@ -482,11 +307,12 @@ endif
 	dh_compress -p$(p_dev) -p$(p_pic) -p$(p_dbg) -X.txt
 	dh_fixperms -p$(p_dev) -p$(p_pic) -p$(p_dbg)
 # XXX: what about biarchn32?
-ifeq ($(biarch64),yes)
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_dev) -p$(p_pic) -p$(p_dbg) -Xlib64
-else
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_dev) -p$(p_pic) -p$(p_dbg) -Xlib32/debug
-endif
+#ifeq ($(biarch64),yes)
+#	$(cross_shlibdeps) dh_shlibdeps -p$(p_dev) -p$(p_pic) -p$(p_dbg) -Xlib64
+#else
+#	$(cross_shlibdeps) dh_shlibdeps -p$(p_dev) -p$(p_pic) -p$(p_dbg)
-Xlib32/debug
+#endif
+	$(cross_shlibdeps) dh_shlibdeps -p$(p_dev) -p$(p_pic) -p$(p_dbg)
 	$(call cross_mangle_substvars,$(p_dbg))
 	dh_gencontrol -p$(p_dev) -p$(p_pic) -p$(p_dbg) \
 		-- -v$(DEB_VERSION) $(common_substvars)
-- 
1.7.1


From ff9116feae81a5022ee8c9577cb3544cf0e1bc79 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Tue, 31 Aug 2010 13:45:15 -0400
Subject: [PATCH 6/8] merge libgfortran rules

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.d/binary-fortran.mk |  195 ++++++++------------------------------
 debian/rules.d/binary-gcc.mk     |    9 --
 debian/rules2                    |    9 ++
 3 files changed, 48 insertions(+), 165 deletions(-)

diff --git a/debian/rules.d/binary-fortran.mk b/debian/rules.d/binary-fortran.mk
index 17f4ead..cfed225 100644
--- a/debian/rules.d/binary-fortran.mk
+++ b/debian/rules.d/binary-fortran.mk
@@ -27,25 +27,10 @@ p_g95	= gfortran$(pkg_ver)$(cross_bin_arch)
 p_g95_m	= gfortran$(pkg_ver)-multilib$(cross_bin_arch)
 p_g95d	= gfortran$(pkg_ver)-doc
 p_flib	= libgfortran$(FORTRAN_SONAME)$(cross_lib_arch)
-p_f32lib= lib32gfortran$(FORTRAN_SONAME)$(cross_lib_arch)
-p_f64lib= lib64gfortran$(FORTRAN_SONAME)$(cross_lib_arch)
-p_fn32lib= libn32gfortran$(FORTRAN_SONAME)$(cross_lib_arch)
-p_flibdbg	= libgfortran$(FORTRAN_SONAME)-dbg$(cross_lib_arch)
-p_f32libdbg	= lib32gfortran$(FORTRAN_SONAME)-dbg$(cross_lib_arch)
-p_f64libdbg	= lib64gfortran$(FORTRAN_SONAME)-dbg$(cross_lib_arch)
-p_fn32libdbg	= libn32gfortran$(FORTRAN_SONAME)-dbg$(cross_lib_arch)

 d_g95	= debian/$(p_g95)
 d_g95_m	= debian/$(p_g95_m)
 d_g95d	= debian/$(p_g95d)
-d_flib	= debian/$(p_flib)
-d_f32lib= debian/$(p_f32lib)
-d_f64lib= debian/$(p_f64lib)
-d_fn32lib= debian/$(p_fn32lib)
-d_flibdbg	= debian/$(p_flibdbg)
-d_f32libdbg	= debian/$(p_f32libdbg)
-d_f64libdbg	= debian/$(p_f64libdbg)
-d_fn32libdbg	= debian/$(p_fn32libdbg)

 dirs_g95 = \
 	$(docdir)/$(p_base)/fortran \
@@ -57,7 +42,6 @@ dirs_g95 = \
 files_g95 = \
 	$(PF)/bin/$(cmd_prefix)gfortran$(pkg_ver) \
 	$(gcc_lib_dir)/finclude \
-	$(gcc_lib_dir)/libgfortranbegin.a \
 	$(gcc_lexec_dir)/f951

 ifneq ($(GFDL_INVARIANT_FREE),yes)
@@ -65,130 +49,56 @@ ifneq ($(GFDL_INVARIANT_FREE),yes)
 	$(PF)/share/man/man1/$(cmd_prefix)gfortran$(pkg_ver).1
 endif

-dirs_flib = \
-	$(docdir) \
-	$(usr_lib) \
-
-files_flib = \
-	$(usr_lib)/libgfortran.so.*
-
 # ----------------------------------------------------------------------
-$(binary_stamp)-libgfortran: $(install_stamp)
+define __do_fortran
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	rm -rf $(d_flib)$(d_flibdbg)
-	dh_installdirs -p$(p_flib) $(dirs_flib)
-	DH_COMPAT=2 dh_movefiles -p$(p_flib) $(files_flib)
-	debian/dh_doclink -p$(p_flib) $(p_base)
-	debian/dh_doclink -p$(p_flibdbg) $(p_base)
-
-	dh_strip -p$(p_flib) --dbg-package=$(p_flibdbg)
-	dh_compress -p$(p_flib) -p$(p_flibdbg)
-	dh_fixperms -p$(p_flib) -p$(p_flibdbg)
-	dh_makeshlibs -p$(p_flib)
-	$(call cross_mangle_shlibs,$(p_flib))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_flib)
-	$(call cross_mangle_substvars,$(p_flib))
-	dh_gencontrol -p$(p_flib) -p$(p_flibdbg) \
+	rm -rf $(d_l) $(d_d)
+	dh_installdirs -p$(p_l) $(2)
+	DH_COMPAT=2 dh_movefiles -p$(p_l) $(2)/libgfortran.so.*
+
+	debian/dh_doclink -p$(p_l) $(p_base)
+	debian/dh_doclink -p$(p_d) $(p_base)
+
+	dh_strip -p$(p_l) --dbg-package=$(p_d)
+	dh_compress -p$(p_l) -p$(p_d)
+	dh_fixperms -p$(p_l) -p$(p_d)
+	dh_makeshlibs -p$(p_l)
+	$(call cross_mangle_shlibs,$(p_l))
+	$(cross_shlibdeps) dh_shlibdeps -p$(p_l)
+	$(call cross_mangle_substvars,$(p_l))
+	dh_gencontrol -p$(p_l) -p$(p_d) \
 		-- -v$(DEB_VERSION) $(common_substvars)
-	dh_installdeb -p$(p_flib) -p$(p_flibdbg)
-	dh_md5sums -p$(p_flib) -p$(p_flibdbg)
-	dh_builddeb -p$(p_flib) -p$(p_flibdbg)
+	$(call cross_mangle_control,$(p_l))
+	dh_installdeb -p$(p_l) -p$(p_d)
+	dh_md5sums -p$(p_l) -p$(p_d)
+	dh_builddeb -p$(p_l) -p$(p_d)

 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+endef

-# ----------------------------------------------------------------------
-$(binary_stamp)-lib64fortran: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_f64lib) $(d_f64libdbg)
-	dh_installdirs -p$(p_f64lib) \
-		$(usr_lib64)
-	DH_COMPAT=2 dh_movefiles -p$(p_f64lib) \
-		$(usr_lib64)/libgfortran.so.*
-
-	debian/dh_doclink -p$(p_f64lib) $(p_base)
-	debian/dh_doclink -p$(p_f64libdbg) $(p_base)
-
-	dh_strip -p$(p_f64lib) --dbg-package=$(p_f64libdbg)
-	dh_compress -p$(p_f64lib) -p$(p_f64libdbg)
-	dh_fixperms -p$(p_f64lib) -p$(p_f64libdbg)
-	dh_makeshlibs -p$(p_f64lib)
-	$(call cross_mangle_shlibs,$(p_f64lib))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_f64lib)
-	$(call cross_mangle_substvars,$(p_f64lib))
-	dh_gencontrol -p$(p_f64lib) -p$(p_f64libdbg) \
-		-- -v$(DEB_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_f64lib))
-	dh_installdeb -p$(p_f64lib) -p$(p_f64libdbg)
-	dh_md5sums -p$(p_f64lib) -p$(p_f64libdbg)
-	dh_builddeb -p$(p_f64lib) -p$(p_f64libdbg)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+do_fortran = $(call
__do_fortran,lib$(1)gfortran$(FORTRAN_SONAME),$(usr_lib$(1)))

+define do_fortran_dev
+	dh_installdirs -p$(2) $(gcc_lib_dir$(1))
+	DH_COMPAT=2 dh_movefiles -p$(2) \
+		$(gcc_lib_dir$(1))/libgfortranbegin.a
+	$(call install_gcc_lib,libgfortran,$(FORTRAN_SONAME),$(1),$(2))
+endef
 # ----------------------------------------------------------------------
-$(binary_stamp)-lib32fortran: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
+$(binary_stamp)-libgfortran: $(install_stamp)
+	$(call do_fortran,)

-	rm -rf $(d_f32lib) $(d_f32libdbg)
-	dh_installdirs -p$(p_f32lib) \
-		$(usr_lib32)
-	DH_COMPAT=2 dh_movefiles -p$(p_f32lib) \
-		$(usr_lib32)/libgfortran.so.*
-
-	debian/dh_doclink -p$(p_f32lib) $(p_base)
-	debian/dh_doclink -p$(p_f32libdbg) $(p_base)
-
-	dh_strip -p$(p_f32lib) --dbg-package=$(p_f32libdbg)
-	dh_compress -p$(p_f32lib) -p$(p_f32libdbg)
-	dh_fixperms -p$(p_f32lib) -p$(p_f32libdbg)
-	dh_makeshlibs -p$(p_f32lib)
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_f32lib)
-	$(call cross_mangle_substvars,$(p_f32lib))
-	dh_gencontrol -p$(p_f32lib) -p$(p_f32libdbg) \
-		-- -v$(DEB_VERSION) $(common_substvars)
-	dh_installdeb -p$(p_f32lib) -p$(p_f32libdbg)
-	dh_md5sums -p$(p_f32lib) -p$(p_f32libdbg)
-	dh_builddeb -p$(p_f32lib) -p$(p_f32libdbg)
+$(binary_stamp)-lib64fortran: $(install_stamp)
+	$(call do_fortran,64)

-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+$(binary_stamp)-lib32fortran: $(install_stamp)
+	$(call do_fortran,32)

-# ----------------------------------------------------------------------
 $(binary_stamp)-libn32fortran: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	mv $(install_stamp) $(install_stamp)-tmp
-
-	rm -rf $(d_fn32lib) $(d_fn32libdbg)
-	dh_installdirs -p$(p_fn32lib) \
-		$(usr_libn32)
-	DH_COMPAT=2 dh_movefiles -p$(p_fn32lib) \
-		$(usr_libn32)/libgfortran.so.*
-
-	debian/dh_doclink -p$(p_fn32lib) $(p_base)
-	debian/dh_doclink -p$(p_fn32libdbg) $(p_base)
-
-	dh_strip -p$(p_fn32lib) --dbg-package=$(p_fn32libdbg)
-	dh_compress -p$(p_fn32lib) -p$(p_fn32libdbg)
-	dh_fixperms -p$(p_fn32lib) -p$(p_fn32libdbg)
-	dh_makeshlibs -p$(p_fn32lib)
-	$(call cross_mangle_shlibs,$(p_fn32lib))
-	$(cross_shlibdeps) dh_shlibdeps -p$(p_fn32lib)
-	$(call cross_mangle_substvars,$(p_fn32lib))
-	dh_gencontrol -p$(p_fn32lib) -p$(p_fn32libdbg) \
-		-- -v$(DEB_VERSION) $(common_substvars)
-	$(call cross_mangle_control,$(p_fn32lib))
-	dh_installdeb -p$(p_fn32lib) -p$(p_fn32libdbg)
-	dh_md5sums -p$(p_fn32lib) -p$(p_fn32libdbg)
-	dh_builddeb -p$(p_fn32lib) -p$(p_fn32libdbg)
-
-	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+	$(call do_fortran,n32)

 # ----------------------------------------------------------------------
 $(binary_stamp)-fdev: $(install_stamp)
@@ -201,11 +111,7 @@ $(binary_stamp)-fdev: $(install_stamp)

 	DH_COMPAT=2 dh_movefiles -p$(p_g95) $(files_g95)

-	rm -f $(d)/$(usr_lib)/libgfortran*.so
-	mv $(d)/$(usr_lib)/libgfortran*.a $(d_g95)/$(gcc_lib_dir)/
-	dh_link -p$(p_g95) \
-	  /$(usr_lib)/libgfortran.so.$(FORTRAN_SONAME) \
-	  /$(gcc_lib_dir)/libgfortran.so
+	$(call do_fortran_dev,,$(p_g95))

 ifneq ($(DEB_CROSS),yes)
 	ln -sf gfortran$(pkg_ver) \
@@ -244,33 +150,10 @@ $(binary_stamp)-fdev-multi: $(install_stamp)
 	mv $(install_stamp) $(install_stamp)-tmp

 	rm -rf $(d_g95_m)
-	dh_installdirs -p$(p_g95_m) \
-		$(docdir) \
-		$(gcc_lib_dir)/$(biarchsubdirs)
-	DH_COMPAT=2 dh_movefiles -p$(p_g95_m) \
-		$(gcc_lib_dir)/$(biarchsubdirs)/libgfortranbegin.a
-
-ifeq ($(biarch64),yes)
-	rm -f $(d)/$(usr_lib64)/libgfortran*.{la,so}
-	mkdir -p $(d_g95_m)/$(gcc_lib_dir64)
-	mv $(d)/$(usr_lib64)/libgfortran*.a $(d_g95_m)/$(gcc_lib_dir64)/
-	dh_link -p$(p_g95_m) \
-	  /$(usr_lib64)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir64)/libgfortran.so
-endif
-ifeq ($(biarch32),yes)
-	rm -f $(d)/$(usr_lib32)/libgfortran*.{la,so}
-	mkdir -p $(d_g95_m)/$(gcc_lib_dir32)
-	mv $(d)/$(usr_lib32)/libgfortran*.a $(d_g95_m)/$(gcc_lib_dir32)/
-	dh_link -p$(p_g95_m) \
-	  /$(usr_lib32)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dir32)/libgfortran.so
-endif
-ifeq ($(biarchn32),yes)
-	rm -f $(d)/$(usr_libn32)/libgfortran*.{la,so}
-	mkdir -p $(d_g95_m)/$(gcc_lib_dirn32)
-	mv $(d)/$(usr_libn32)/libgfortran*.a $(d_g95_m)/$(gcc_lib_dirn32)/
-	dh_link -p$(p_g95_m) \
-	  /$(usr_libn32)/libgfortran.so.$(FORTRAN_SONAME)
/$(gcc_lib_dirn32)/libgfortran.so
-endif
+	dh_installdirs -p$(p_g95_m) $(docdir)
+
+	$(foreach flavour,$(flavours), \
+		$(call do_fortran_dev,$(flavour),$(p_g95_m)))

 	debian/dh_doclink -p$(p_g95_m) $(p_base)
 	debian/dh_rmemptydirs -p$(p_g95_m)
diff --git a/debian/rules.d/binary-gcc.mk b/debian/rules.d/binary-gcc.mk
index 2f82774..46e768f 100644
--- a/debian/rules.d/binary-gcc.mk
+++ b/debian/rules.d/binary-gcc.mk
@@ -93,15 +93,6 @@ d_gcc_m	= debian/$(p_gcc_m)
 p_pld	= gcc$(pkg_ver)-plugin-dev
 d_pld	= debian/$(p_pld)

-# install_gcc_lib(lib,soname,flavour,package)
-define install_gcc_lib
-	mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3))/
-	rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so}
-	dh_link -p$(4) \
-	  /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so
-
-endef
-
 # misc_gcc_libs(flavour,package)
 define misc_gcc_libs
 	dh_installdirs -p$(2) $(gcc_lib_dir$(1))
diff --git a/debian/rules2 b/debian/rules2
index a813d60..8a30890 100644
--- a/debian/rules2
+++ b/debian/rules2
@@ -613,6 +613,15 @@ libgcc_dir32 = $(PFL)/lib32	# yes, really;
lib32gcc_s ends up in usr
 libgcc_dirn32 = $(RPF)/lib32
 libgcc_dir64 = $(RPF)/lib64

+# install_gcc_lib(lib,soname,flavour,package)
+define install_gcc_lib
+	mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3))/
+	rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so}
+	dh_link -p$(4) \
+	  /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so
+
+endef
+
 checkdirs = $(builddir)
 ifeq ($(with_separate_libgcj),yes)
   ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
-- 
1.7.1


From 7d963d25bb428640dea95e1d5732111f4aa44718 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Tue, 31 Aug 2010 14:29:08 -0400
Subject: [PATCH 7/8] merge rules for objc-multi

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/rules.d/binary-cxx.mk  |   48 ++++++++++--------------------
 debian/rules.d/binary-objc.mk |   66 ++++++++++------------------------------
 2 files changed, 33 insertions(+), 81 deletions(-)

diff --git a/debian/rules.d/binary-cxx.mk b/debian/rules.d/binary-cxx.mk
index 718f117..d187087 100644
--- a/debian/rules.d/binary-cxx.mk
+++ b/debian/rules.d/binary-cxx.mk
@@ -96,6 +96,19 @@ endif
 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)

 # ----------------------------------------------------------------------
+define do_cxx
+	dh_installdirs -p$(p_cxx_m) $(gcc_lib_dir($1))
+	mv $(d)/$(usr_lib$(1))/lib*c++*.{a,so} $(d)/$(gcc_lib_dir$(1))/.
+	DH_COMPAT=2 dh_movefiles -p$(p_cxx_m) \
+		$(gcc_lib_dir$(1))/libstdc++.{a,so} \
+	        $(gcc_lib_dir$(1))/libsupc++.a \
+		$(gcc_lib_dir$(1))/libstdc++_pic.a
+	dh_link -p$(p_cxx_m) \
+		/$(usr_lib$(1))/libstdc++.so.$(CXX_SONAME) \
+		/$(gcc_lib_dir$(1))/libstdc++.so
+
+endef
+
 $(binary_stamp)-cxx-multi: $(install_stamp)
 	dh_testdir
 	dh_testroot
@@ -103,39 +116,10 @@ $(binary_stamp)-cxx-multi: $(install_stamp)

 	rm -rf $(d_cxx_m)
 	dh_installdirs -p$(p_cxx_m) \
-		$(docdir) \
-		$(gcc_lib_dir)/$(biarchsubdirs)
-
-ifeq ($(biarch64),yes)
-	mv $(d)/$(usr_lib64)/lib*c++*.{a,so} $(d)/$(gcc_lib_dir64)/.
-endif
-ifeq ($(biarch32),yes)
-	mv $(d)/$(usr_lib32)/lib*c++*.{a,so} $(d)/$(gcc_lib_dir32)/.
-endif
-ifeq ($(biarchn32),yes)
-	mv $(d)/$(usr_libn32)/lib*c++*.{a,so} $(d)/$(gcc_lib_dirn32)/.
-endif
+		$(docdir)

-	DH_COMPAT=2 dh_movefiles -p$(p_cxx_m) \
-		$(gcc_lib_dir)/$(biarchsubdirs)/libstdc++.{a,so} \
-	        $(gcc_lib_dir)/$(biarchsubdirs)/libsupc++.a \
-		$(gcc_lib_dir)/$(biarchsubdirs)/libstdc++_pic.a
-
-ifeq ($(biarch64),yes)
-	dh_link -p$(p_cxx_m) \
-		/$(usr_lib64)/libstdc++.so.$(CXX_SONAME) \
-		/$(gcc_lib_dir64)/libstdc++.so
-endif
-ifeq ($(biarch32),yes)
-	dh_link -p$(p_cxx_m) \
-		/$(usr_lib32)/libstdc++.so.$(CXX_SONAME) \
-		/$(gcc_lib_dir32)/libstdc++.so
-endif
-ifeq ($(biarchn32),yes)
-	dh_link -p$(p_cxx_m) \
-		/$(usr_libn32)/libstdc++.so.$(CXX_SONAME) \
-		/$(gcc_lib_dirn32)/libstdc++.so
-endif
+	$(foreach flavour,$(flavours), \
+		$(call do_cxx,$(flavour)))

 	debian/dh_doclink -p$(p_cxx_m) $(p_base)
 	debian/dh_rmemptydirs -p$(p_cxx_m)
diff --git a/debian/rules.d/binary-objc.mk b/debian/rules.d/binary-objc.mk
index 520d295..23001a2 100644
--- a/debian/rules.d/binary-objc.mk
+++ b/debian/rules.d/binary-objc.mk
@@ -16,28 +16,29 @@ dirs_objc = \

 files_objc = \
 	$(gcc_lexec_dir)/cc1obj \
-	$(gcc_lib_dir)/include/objc \
-	$(gcc_lib_dir)/libobjc*.a
+	$(gcc_lib_dir)/include/objc
+
+define do_objc
+	dh_installdirs -p$(2) $(gcc_lib_dir$(1))
+	$(call install_gcc_lib,libobjc,$(OBJC_SONAME),$(1),$(2))
+	$(if $(filter yes,$(with_objc_gc)),
+		dh_link -p$(2) \
+		  /$(usr_lib$(1))/libobjc_gc.so.$(OBJC_SONAME) \
+		  /$(gcc_lib_dir$(1))/libobjc_gc.so
+	)
+
+endef

 $(binary_stamp)-objc: $(install_stamp)
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp

-	rm -f $(d)/$(usr_lib)/libobjc.{la,so}
-	mv $(d)/$(usr_lib)/libobjc*.a $(d)/$(gcc_lib_dir)/
-
 	rm -rf $(d_objc)
 	dh_installdirs -p$(p_objc) $(dirs_objc)
 	DH_COMPAT=2 dh_movefiles -p$(p_objc) $(files_objc)

-	dh_link -p$(p_objc) \
-	  /$(usr_lib)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir)/libobjc.so
-ifeq ($(with_objc_gc),yes)
-	dh_link -p$(p_objc) \
-	  /$(usr_lib)/libobjc_gc.so.$(OBJC_SONAME) \
-	  /$(gcc_lib_dir)/libobjc_gc.so
-endif
+	$(call do_objc,,$(p_objc))

 	cp -p $(srcdir)/libobjc/{README*,THREADS*} \
 		$(d_objc)/$(docdir)/$(p_base)/ObjC/.
@@ -67,43 +68,10 @@ $(binary_stamp)-objc-multi: $(install_stamp)
 	mv $(install_stamp) $(install_stamp)-tmp

 	rm -rf $(d_objc_m)
-	dh_installdirs -p$(p_objc_m) \
-		$(docdir) \
-		$(gcc_lib_dir)/$(biarchsubdirs)
-
-ifeq ($(biarch64),yes)
-	rm -f $(d)/$(usr_lib64)/libobjc*.{la,so}
-	mkdir -p $(d_objc_m)/$(gcc_lib_dir64)
-	mv $(d)/$(usr_lib64)/libobjc*.a $(d_objc_m)/$(gcc_lib_dir64)/
-	dh_link -p$(p_objc_m) \
-	  /$(usr_lib64)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir64)/libobjc.so
-  ifeq ($(with_objc_gc),yes)
-	dh_link -p$(p_objc_m) \
-	  /$(usr_lib64)/libobjc_gc.so.$(OBJC_SONAME) /$(gcc_lib_dir64)/libobjc_gc.so
-  endif
-endif
-ifeq ($(biarch32),yes)
-	rm -f $(d)/$(usr_lib32)/libobjc*.{la,so}
-	mkdir -p $(d_objc_m)/$(gcc_lib_dir32)
-	mv $(d)/$(usr_lib32)/libobjc*.a $(d_objc_m)/$(gcc_lib_dir32)/
-	dh_link -p$(p_objc_m) \
-	  /$(usr_lib32)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dir32)/libobjc.so
-  ifeq ($(with_objc_gc),yes)
-	dh_link -p$(p_objc_m) \
-	  /$(usr_lib32)/libobjc_gc.so.$(OBJC_SONAME) /$(gcc_lib_dir32)/libobjc_gc.so
-  endif
-endif
-ifeq ($(biarchn32),yes)
-	rm -f $(d)/$(usr_libn32)/libobjc*.{la,so}
-	mkdir -p $(d_objc_m)/$(gcc_lib_dirn32)
-	mv $(d)/$(usr_libn32)/libobjc*.a $(d_objc_m)/$(gcc_lib_dirn32)/
-	dh_link -p$(p_objc_m) \
-	  /$(usr_libn32)/libobjc.so.$(OBJC_SONAME) /$(gcc_lib_dirn32)/libobjc.so
-  ifeq ($(with_objc_gc),yes)
-	dh_link -p$(p_objc_m) \
-	  /$(usr_libn32)/libobjc_gc.so.$(OBJC_SONAME) /$(gcc_lib_dirn32)/libobjc_gc.so
-  endif
-endif
+	dh_installdirs -p$(p_objc_m) $(docdir)
+
+	$(foreach flavour,$(flavours), \
+		$(call do_objc,$(flavour),$(p_objc_m)))

 	debian/dh_doclink -p$(p_objc_m) $(p_base)

-- 
1.7.1


From beee23ddcf59f775542e86d7de5a4b0a9a1506c0 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Wed, 1 Sep 2010 17:06:29 -0400
Subject: [PATCH 8/8] gcc-hppa64 in cross-gcc-to-hppa build

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 debian/control.m4 |    4 ++--
 debian/rules.defs |    4 +---
 debian/rules2     |   14 ++++++++++----
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/debian/control.m4 b/debian/control.m4
index d6884f3..037af6c 100644
--- a/debian/control.m4
+++ b/debian/control.m4
@@ -447,9 +447,8 @@ Description: Files for GNU GCC plugin development.
 ')`'dnl cdev

 ifenabled(`cdev',`
-ifdef(`TARGET', `', `
 Package: gcc`'PV-hppa64
-Architecture: hppa
+Architecture: ifdef(`TARGET',`any',hppa)
 Section: devel
 Priority: PRI(optional)
 Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends}
@@ -457,6 +456,7 @@ Conflicts: gcc-3.3-hppa64 (<= 1:3.3.4-5),
gcc-3.4-hppa64 (<= 3.4.1-3)
 Description: The GNU C compiler (cross compiler for hppa64)
  This is the GNU C compiler, a fairly portable optimizing compiler for C.

+ifdef(`TARGET', `', `
 Package: gcc`'PV-spu
 Architecture: powerpc ppc64
 Section: devel
diff --git a/debian/rules.defs b/debian/rules.defs
index f9ac9f8..0ddbbfb 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -841,9 +841,7 @@ else
   # hppa64 build ----------------
   hppa64_no_snap := no
   ifeq ($(DEB_TARGET_ARCH),hppa)
-    ifneq ($(DEB_CROSS),yes)
-      with_hppa64 := yes
-    endif
+    with_hppa64 := yes
   endif
   ifeq ($(hppa64_no_snap)-$(PKGSOURCE),yes-gcc-snapshot)
     with_hppa64 := disabled for snapshot build
diff --git a/debian/rules2 b/debian/rules2
index 8a30890..9d34499 100644
--- a/debian/rules2
+++ b/debian/rules2
@@ -925,6 +925,12 @@ ifeq ($(versioned_packages),yes)
   hppa64_configure_flags += --program-suffix=-$(BASE_VERSION)
 endif

+ifeq ($(DEB_CROSS),yes)
+	  CC_for_hppa64_cross="$(CC)"
+else
+	  CC_for_hppa64_cross="$(builddir)/gcc/xgcc -B$(builddir)/gcc/"
+endif
+
 $(configure_hppa64_stamp): $(build_stamp)
 	dh_testdir
 	rm -f $(configure_hppa64_stamp) $(build_hppa64_stamp)
@@ -934,7 +940,7 @@ $(configure_hppa64_stamp): $(build_stamp)
 	cd $(builddir_hppa64) && \
 	  $(SET_PATH) \
 	  $(SET_SHELL) \
-	  CC="$(builddir)/gcc/xgcc -B$(builddir)/gcc/" \
+	  CC="$(CC_for_hppa64_cross)" \
 	     ../src/configure \
 		--enable-languages=c \
 		--prefix=/$(PF) \
@@ -949,8 +955,8 @@ $(configure_hppa64_stamp): $(build_stamp)
 		--with-as=/usr/bin/hppa64-linux-gnu-as \
 		--with-ld=/usr/bin/hppa64-linux-gnu-ld \
 		--includedir=/usr/hppa64-linux-gnu/include \
-		--host=hppa-linux-gnu \
-		--build=hppa-linux-gnu \
+		--build=$(DEB_BUILD_GNU_TYPE) \
+		--host=$(DEB_HOST_GNU_TYPE) \
 		--target=hppa64-linux-gnu
 	touch $(configure_hppa64_stamp)

@@ -959,7 +965,7 @@ $(build_hppa64_stamp): $(configure_hppa64_stamp)
 	  $(SET_SHELL) \
 	  $(SET_LOCPATH) \
 	    $(MAKE) -C $(builddir_hppa64) $(NJOBS) \
-		CC="$(builddir)/gcc/xgcc -B$(builddir)/gcc/" \
+		CC="$(CC_for_hppa64_cross)" \
 		$(CFLAGS_TO_PASS) \
 		$(LDFLAGS_TO_PASS)
 	touch $(build_hppa64_stamp)
-- 
1.7.1



-- 
 Héctor Orón

"Our Sun unleashes tremendous flares expelling hot gas into the Solar
System, which one day will disconnect us."

-- Day DVB-T stop working nicely
Video flare: http://antwrp.gsfc.nasa.gov/apod/ap100510.html




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#553045; Package gcc-4.4. (Fri, 03 Sep 2010 00:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Fri, 03 Sep 2010 00:30:02 GMT) Full text and rfc822 format available.

Message #55 received at 553045@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: Hector Oron <hector.oron@gmail.com>
Cc: 553045@bugs.debian.org
Subject: Re: Bug#553045: but 4.4.1-1 is to be installed.
Date: Fri, 03 Sep 2010 02:27:17 +0200
On 03.09.2010 01:31, Hector Oron wrote:
> Attached you can find a patchset that applies clean on svn sid/gcc-4.4
> HEAD. It builds BI/TRI-ARCH and NON BIARCH builds.

no, current svn already builds these.  at a first glance these patches are about 
refactoring. I'll look at these next week.  Please don't hijack existing bug 
reports for new issues.




Merged 553045 553047 577674 604774. Request was from Hector Oron <zumbi@debian.org> to control@bugs.debian.org. (Mon, 20 Dec 2010 15:09:03 GMT) Full text and rfc822 format available.

Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. (Fri, 18 Nov 2011 13:30:04 GMT) Full text and rfc822 format available.

Notification sent to Hector Oron <hector.oron@gmail.com>:
Bug acknowledged by developer. (Fri, 18 Nov 2011 13:30:04 GMT) Full text and rfc822 format available.

Message #62 received at 553045-done@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: 553045-done@bugs.debian.org
Subject: refactoring patches were applied
Date: Fri, 18 Nov 2011 14:27:37 +0100
the refactoring patches were applied; I assume that at least 4.6 does build.
please submit a new patch if gcc-4.4 still ftbfs.




Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. (Fri, 18 Nov 2011 13:30:08 GMT) Full text and rfc822 format available.

Notification sent to Hector Oron <hector.oron@gmail.com>:
Bug acknowledged by developer. (Fri, 18 Nov 2011 13:30:09 GMT) Full text and rfc822 format available.

Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. (Fri, 18 Nov 2011 13:30:10 GMT) Full text and rfc822 format available.

Notification sent to Hector Oron <zumbi@debian.org>:
Bug acknowledged by developer. (Fri, 18 Nov 2011 13:30:11 GMT) Full text and rfc822 format available.

Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. (Fri, 18 Nov 2011 13:30:15 GMT) Full text and rfc822 format available.

Notification sent to Hector Oron <hector.oron@gmail.com>:
Bug acknowledged by developer. (Fri, 18 Nov 2011 13:30:15 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 17 Dec 2011 07:33:35 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 15:53:21 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.