Re: [v3] libstdc++/49829

2012-01-26 Thread Benjamin Kosnik


> > OK. The attached is closer, but still not quite there.
> 
> one step further, to avoid the endless recursion in the install-debug
> target. unsure if that is the right approach. the install now works,
> but the debug library is now built in the install step, not in the
> build step.

As checked in.

tested x86/linux

-benjamin2012-01-27  Benjamin Kosnik  
	Matthias Klose  

		* configure.ac (GLIBCXX_ENABLE_DEBUG_FLAGS): Use -gdwarf-4 -g3 -O0.
		* configure.in: Regenerated.
		* src/Makefile.am (all-once, install-data-once): New rules.
		(all-local, install-data-local): Use them.
		(build-debug, install-debug): Tweak.
		* src/Makefile.in: Regenerate.


diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index c5f7901..7607e5b 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -124,7 +124,7 @@ GLIBCXX_ENABLE_LONG_LONG([yes])
 GLIBCXX_ENABLE_WCHAR_T([yes])
 GLIBCXX_ENABLE_C99([yes])
 GLIBCXX_ENABLE_CONCEPT_CHECKS([no])
-GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"])
+GLIBCXX_ENABLE_DEBUG_FLAGS(["-gdwarf-4 -g3 -O0"])
 GLIBCXX_ENABLE_DEBUG([no])
 GLIBCXX_ENABLE_PARALLEL([yes])
 GLIBCXX_ENABLE_CXX_FLAGS
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 87b2a16..2cd2774 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -168,16 +168,16 @@ version_arg =
 version_dep =
 endif
 
-# Added rules.
-# 1 debug library
-# 2 supra-convenience library
-if GLIBCXX_BUILD_DEBUG
-all-local: libstdc++convenience.la build_debug
-install-data-local: install_debug
-else
-all-local: libstdc++convenience.la
-install-data-local:
-endif
+
+# Control additional build primary rules.
+# EXTRA_LTLIBRARIES =
+all-once: libstdc++convenience.la $(STAMP_DEBUG)
+install-data-once: $(STAMP_INSTALL_DEBUG)
+
+all-local: all-once
+install-data-local: install-data-once
+clean-local:
+	rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
 
 # Make a non-installed convenience library, so that --disable-static
 # may work.
@@ -188,13 +188,26 @@ libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
 	fi; \
 	echo `date` > stamp-libstdc++convenience;
 
-debugdir = debug
+# Added rules.
+# 1 debug library
+# 2 supra-convenience library
+if GLIBCXX_BUILD_DEBUG
+STAMP_DEBUG = build-debug
+STAMP_INSTALL_DEBUG = install-debug
+CLEAN_DEBUG = debug
+else
+STAMP_DEBUG =
+STAMP_INSTALL_DEBUG =
+CLEAN_DEBUG =
+endif
 
-# Build a set of debug objects here.
+# Build a debug variant.
 # Take care to fix all possibly-relative paths.
+debugdir = ${glibcxx_builddir}/src/debug
 stamp-debug:
 	if test ! -d ${debugdir}; then \
 	  mkdir -p ${debugdir}; \
+	  for d in $(SUBDIRS); do mkdir -p  ${debugdir}/$$d; done; \
 	  (cd ${debugdir}; \
 	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
 	  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
@@ -202,16 +215,30 @@ stamp-debug:
 	  -e 's/VPATH = \.\./VPATH = ..\/../' \
 	  -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
 	  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
-	  -e 's/all-local: build_debug/all-local:/' \
-	  -e 's/install-data-local: install_debug/install-data-local:/' \
-	  < ../Makefile > Makefile) ; \
+	  < ../Makefile > Makefile ; \
+	  for d in . $(SUBDIRS); do \
+	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
+	  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
+	  -e 's/srcdir = \.\./srcdir = ..\/../' \
+	  -e 's/VPATH = \.\./VPATH = ..\/../' \
+	  -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
+	  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
+	  < ../$$d/Makefile > $$d/Makefile ; \
+	  done) ; \
 	fi; \
 	echo `date` > stamp-debug;
 
-build_debug: stamp-debug
-	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
-
-# Install debug library here.
-install_debug:
-	(cd ${debugdir} && $(MAKE) \
-	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
+build-debug: stamp-debug
+	  (cd ${debugdir}; \
+	  mv Makefile Makefile.tmp; \
+	  sed -e 's,all-local: all-once,all-local:,' \
+	  -e 's,install-data-local: install-data-once,install-data-local:,' \
+	  -e 's,src/c,src/debug/c,' \
+	  < Makefile.tmp > Makefile ; \
+	  $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
+	  toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ;
+
+# Install debug library.
+install-debug: build-debug
+	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
+	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;


Re: [v3] libstdc++/49829

2012-01-25 Thread Matthias Klose

On 25.01.2012 06:26, Benjamin Kosnik wrote:




this breaks builds configured with --enable-libstdcxx-debug.


confirmed


  Tried
the following (not yet working) fix.


OK. The attached is closer, but still not quite there.


one step further, to avoid the endless recursion in the install-debug target. 
unsure if that is the right approach. the install now works, but the debug 
library is now built in the install step, not in the build step.


  Matthias
Index: src/Makefile.am
===
--- src/Makefile.am (revision 183514)
+++ src/Makefile.am (working copy)
@@ -172,13 +172,23 @@
 # 1 debug library
 # 2 supra-convenience library
 if GLIBCXX_BUILD_DEBUG
-all-local: libstdc++convenience.la build_debug
-install-data-local: install_debug
+STAMP_DEBUG = build-debug
+STAMP_INSTALL_DEBUG = install-debug
+CLEAN_DEBUG = debug
 else
-all-local: libstdc++convenience.la
-install-data-local:
+STAMP_DEBUG =
+STAMP_INSTALL_DEBUG =
+CLEAN_DEBUG =
 endif
 
+all-local-once: libstdc++convenience.la $(STAMP_DEBUG)
+install-data-local-once: $(STAMP_INSTALL_DEBUG)
+
+all-local: all-local-once
+install-data-local: install-data-local-once
+clean-local:
+   rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
+
 # Make a non-installed convenience library, so that --disable-static
 # may work.
 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
@@ -188,13 +198,13 @@
fi; \
echo `date` > stamp-libstdc++convenience;
 
-debugdir = debug
-
-# Build a set of debug objects here.
+# Build a debug variant.
 # Take care to fix all possibly-relative paths.
+debugdir = ${glibcxx_builddir}/src/debug
 stamp-debug:
if test ! -d ${debugdir}; then \
  mkdir -p ${debugdir}; \
+ for d in $(SUBDIRS); do mkdir -p  ${debugdir}/$$d; done; \
  (cd ${debugdir}; \
  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
@@ -202,16 +212,27 @@
  -e 's/VPATH = \.\./VPATH = ..\/../' \
  -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
- -e 's/all-local: build_debug/all-local:/' \
- -e 's/install-data-local: install_debug/install-data-local:/' \
- < ../Makefile > Makefile) ; \
+ -e 's/all-local: all-local-once/all-local:/' \
+ -e 's/install-data-local: 
install-data-local-once/install-data-local:/' \
+ < ../Makefile > Makefile ; \
+ for d in . $(SUBDIRS); do \
+ sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
+ -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
+ -e 's/srcdir = \.\./srcdir = ..\/../' \
+ -e 's/VPATH = \.\./VPATH = ..\/../' \
+ -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
+ -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
+ < ../$$d/Makefile > $$d/Makefile ; \
+ done) ; \
fi; \
echo `date` > stamp-debug;
 
-build_debug: stamp-debug
-   (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
+build-debug: stamp-debug
+   (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' libstdc++.la)
 
-# Install debug library here.
-install_debug:
-   (cd ${debugdir} && $(MAKE) \
-   toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
+# Install debug library.
+install-debug: stamp-debug
+   (if [ $$(basename $(CURDIR)) != debug ]; then \
+ cd ${debugdir} && $(MAKE) \
+ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install; \
+   fi)


Re: [v3] libstdc++/49829

2012-01-25 Thread Dominique Dhumieres
Revision 183457 breaks bootstrap on darwin (pr51985).

TIA

Dominique


Re: [v3] libstdc++/49829

2012-01-24 Thread Benjamin Kosnik


> this breaks builds configured with --enable-libstdcxx-debug.

confirmed

>  Tried
> the following (not yet working) fix.

OK. The attached is closer, but still not quite there.

-benjamindiff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 87b2a16..59cc57d 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -172,13 +172,23 @@ endif
 # 1 debug library
 # 2 supra-convenience library
 if GLIBCXX_BUILD_DEBUG
-all-local: libstdc++convenience.la build_debug
-install-data-local: install_debug
+STAMP_DEBUG = build-debug
+STAMP_INSTALL_DEBUG = install-debug
+CLEAN_DEBUG = debug
 else
-all-local: libstdc++convenience.la
-install-data-local:
+STAMP_DEBUG =
+STAMP_INSTALL_DEBUG =
+CLEAN_DEBUG =
 endif
 
+all-local-once: libstdc++convenience.la $(STAMP_DEBUG)
+install-data-local-once: $(STAMP_INSTALL_DEBUG)
+
+all-local: all-local-once
+install-data-local: install-data-local-once
+clean-local:
+	rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
+
 # Make a non-installed convenience library, so that --disable-static
 # may work.
 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
@@ -188,13 +198,13 @@ libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
 	fi; \
 	echo `date` > stamp-libstdc++convenience;
 
-debugdir = debug
-
-# Build a set of debug objects here.
+# Build a debug variant.
 # Take care to fix all possibly-relative paths.
+debugdir = ${glibcxx_builddir}/src/debug
 stamp-debug:
 	if test ! -d ${debugdir}; then \
 	  mkdir -p ${debugdir}; \
+	  for d in $(SUBDIRS); do mkdir -p  ${debugdir}/$$d; done; \
 	  (cd ${debugdir}; \
 	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
 	  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
@@ -202,16 +212,25 @@ stamp-debug:
 	  -e 's/VPATH = \.\./VPATH = ..\/../' \
 	  -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
 	  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
-	  -e 's/all-local: build_debug/all-local:/' \
-	  -e 's/install-data-local: install_debug/install-data-local:/' \
-	  < ../Makefile > Makefile) ; \
+	  -e 's/all-local: all-local-once/all-local:/' \
+	  -e 's/install-data-local: install-data-local-once/install-data-local:/' \
+	  < ../Makefile > Makefile ; \
+	  for d in . $(SUBDIRS); do \
+	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
+	  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
+	  -e 's/srcdir = \.\./srcdir = ..\/../' \
+	  -e 's/VPATH = \.\./VPATH = ..\/../' \
+	  -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
+	  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
+	  < ../$$d/Makefile > $$d/Makefile ; \
+	  done) ; \
 	fi; \
 	echo `date` > stamp-debug;
 
-build_debug: stamp-debug
-	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
+build-debug: stamp-debug
+	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' libstdc++.la)
 
-# Install debug library here.
-install_debug:
+# Install debug library.
+install-debug: stamp-debug
 	(cd ${debugdir} && $(MAKE) \
 	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)


Re: [v3] libstdc++/49829

2012-01-24 Thread Matthias Klose

On 24.01.2012 00:27, Benjamin Kosnik wrote:


This modularizes the libstdc++ sources such that the resulting library
binaries are now composed of three convenience libraries. In short:


this breaks builds configured with --enable-libstdcxx-debug. Tried the following 
(not yet working) fix.


  Matthias


Index: src/Makefile.am
===
--- src/Makefile.am (revision 183477)
+++ src/Makefile.am (working copy)
@@ -194,8 +194,9 @@
 # Take care to fix all possibly-relative paths.
 stamp-debug:
if test ! -d ${debugdir}; then \
- mkdir -p ${debugdir}; \
+ for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \
  (cd ${debugdir}; \
+ for d in . $(SUBDIRS); do \
  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
  -e 's/srcdir = \.\./srcdir = ..\/../' \
@@ -204,7 +205,8 @@
  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
  -e 's/all-local: build_debug/all-local:/' \
  -e 's/install-data-local: install_debug/install-data-local:/' \
- < ../Makefile > Makefile) ; \
+ < ../$$d/Makefile > $$d/Makefile; \
+ done); \
fi; \
echo `date` > stamp-debug;
 


Re: [v3] libstdc++/49829

2012-01-23 Thread Benjamin Kosnik


> tested x86-64/linux
> tested x86-64/linux -x- arm-eabi
> tested x86-64/linux -x- cris-elf

Here is the missing bit, as tested above.

-benjamindiff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index aa25a7e..87b2a16 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -184,9 +184,9 @@ endif
 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
 	$(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \
 	if test ! -f .libs/libstdc++.a; then \
-	  $(LN_S) .libs/libstdc++convenience.a .libs/libstdc++.a; \
-	  stamp-libstdc++convenience; \
-	fi;
+	  cp .libs/libstdc++convenience.a .libs/libstdc++.a; \
+	fi; \
+	echo `date` > stamp-libstdc++convenience;
 
 debugdir = debug
 


[v3] libstdc++/49829

2012-01-23 Thread Benjamin Kosnik

This modularizes the libstdc++ sources such that the resulting library
binaries are now composed of three convenience libraries. In short:

libstdc++.[a, so] == libc++98 + libc++11 + libsupc++

Arguably, this is the way it should have been done all along. And
certainly since the C++11 support hit 5 or more files

In any case, this helps resolve the knots gcc/libstdc++ config and
build get themselves into when gcc requires static libstdc++, but the
build says no-static (--disable-static). 

There are some warts that need addressing by a proper build maintainer.

1) dependency tracking for libstdc++convenience.la. Help. It's not
installed and not really used in most cases, so this isn't crucial.
But, perfection is a cruel mistress, and I'd like to get this right.

2) I suppose the docs should be updated to reflect this. To-do.

I'm trying to get over my fear of using git for check-ins that require
a bunch of renames etc etc. So, this is my first one of these. If I did
it all wrong, please let me know gently and I'll try to fix it.

This patch is huge due to all the re-names. Please check out the patch
posted in bugzilla instead.

best,
benjamin

tested x86-64/linux
tested x86-64/linux -x- arm-eabi
tested x86-64/linux -x- cris-elf