[uClibc] [buildroot] Patch to add libstdc++ installation in root filesystem

Thomas Petazzoni thomas.petazzoni at enix.org
Thu Sep 9 13:53:13 UTC 2004


Hello,

Enclosed is a small patch that changes a few options of the main
Makefile to allow automatic installation of the libstdc++ in the root
filesystem.

Previsously, when INSTALL_LIBSTDCPP option was true, the c++ compiler
and the libstdc++ were built. The name was strange, because it was
talking about installing the standard C++ library, not building the C++
compiler and its library.

With this patch there are two different options :

 * BUILD_CPP which has the same effect as the old INSTALL_LIBSTDCPP,
 that is compile the C++ compiler and the C++ library.

 * INSTALL_LIBSTDCPP now allows to install the C++ standard library
 inside the root filesystem

To be clean, I also rennamed the INSTALL_LIBGCJ option to BUILD_GCJ.

The patch affect :
 - Makefile
 - make/gcc-uclibc-3.x.mk
 - make/gcc-uclibc-2.95.mk
 - make/ccache.mk

I have tested it successfully with gcc-3.4, but I didn't tested it with
gcc-2.95 so my changes in gcc-uclibc-2.95.mk might be wrong.

Feel free to ask for more details,

Thomas
-- 
PETAZZONI Thomas - thomas.petazzoni at enix.org 
http://thomas.enix.org - Jabber: kos_tom at sourcecode.de
KOS: http://kos.enix.org/ - Lolut: http://lolut.utbm.info
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /var/cvs/buildroot/Makefile,v
retrieving revision 1.85
diff -u -r1.85 Makefile
--- Makefile	3 Sep 2004 01:12:33 -0000	1.85
+++ Makefile	9 Sep 2004 13:47:19 -0000
@@ -160,13 +160,15 @@
 # If you want multilib enabled, enable this...
 MULTILIB:=--enable-multilib
 
-# Build/install c++ compiler and libstdc++?
+# Build c++ compiler and libstdc++?
+BUILD_CPP:=true
+
+# Install c++ libraries in target ?
 INSTALL_LIBSTDCPP:=true
 
 # Build/install java compiler and libgcj? (requires c++)
 # WARNING!!! DOES NOT BUILD FOR TARGET WITHOUT INTERVENTION!!!  mjn3
-#INSTALL_LIBGCJ:=true
-INSTALL_LIBGCJ:=false
+BUILD_GCJ:=false
 
 # For SMP machines some stuff can be run in parallel
 #JLEVEL=-j3
@@ -264,8 +266,8 @@
 ARCH_FPU_SUFFIX:=
 endif
 
-ifeq ($(INSTALL_LIBGCJ),true)
-INSTALL_LIBSTDCPP:=true
+ifeq ($(BUILD_GCJ),true)
+BUILD_CPP:=true
 endif
 
 # WARNING -- uClibc currently disables large file support on cris.
Index: make/ccache.mk
===================================================================
RCS file: /var/cvs/buildroot/make/ccache.mk,v
retrieving revision 1.10
diff -u -r1.10 ccache.mk
--- make/ccache.mk	3 Sep 2004 00:49:33 -0000	1.10
+++ make/ccache.mk	9 Sep 2004 13:47:19 -0000
@@ -61,7 +61,7 @@
 		ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-gcc; \
 		ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-cc; \
 		ln -fs ../usr/bin/ccache $(OPTIMIZE_FOR_CPU)-linux-uclibc-gcc);
-ifeq ($(INSTALL_LIBSTDCPP),true)
+ifeq ($(BUILD_CPP),true)
 	[ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-c++ ] && \
 		mv $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-c++ $(STAGING_DIR)/bin-ccache/
 	[ -f $(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-g++ ] && \
Index: make/gcc-uclibc-2.95.mk
===================================================================
RCS file: /var/cvs/buildroot/make/gcc-uclibc-2.95.mk,v
retrieving revision 1.9
diff -u -r1.9 gcc-uclibc-2.95.mk
--- make/gcc-uclibc-2.95.mk	9 Sep 2004 10:50:57 -0000	1.9
+++ make/gcc-uclibc-2.95.mk	9 Sep 2004 13:47:19 -0000
@@ -36,7 +36,7 @@
 #
 #############################################################
 
-ifeq ($(INSTALL_LIBSTDCPP),true)
+ifeq ($(BUILD_CPP),true)
 TARGET_LANGUAGES:=c,c++
 STLPORT_TARGET=stlport
 else
@@ -44,6 +44,13 @@
 STLPORT_TARGET=
 endif
 
+ifeq ($(INSTALL_LIBSTDCPP),true)
+	LIBSTDCPP_TARGET=$(TARGET_DIR)/lib/libstdc++.a
+else
+	LIBSTDCPP_TARGET=
+endif
+
+
 #############################################################
 #
 # build the first pass gcc compiler
@@ -201,8 +208,13 @@
 	);
 	touch $(GCC_BUILD_DIR2)/.installed
 
+$(TARGET_DIR)/lib/libstdc++.a: $(GCC_BUILD_DIR2)/.installed
+	rm -rf $(TARGET_DIR)/usr/lib/libstdc++.*
+	-$(STRIP) $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a
+	-cp -a $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a $(TARGET_DIR)/lib/
+
 gcc: uclibc-configured binutils gcc_initial $(LIBFLOAT_TARGET) uclibc \
-	$(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) $(STLPORT_TARGET)
+	$(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) $(STLPORT_TARGET) $(LIBSTDCPP_TARGET)
 
 gcc-source: $(DL_DIR)/$(GCC_SOURCE)
 
Index: make/gcc-uclibc-3.x.mk
===================================================================
RCS file: /var/cvs/buildroot/make/gcc-uclibc-3.x.mk,v
retrieving revision 1.4
diff -u -r1.4 gcc-uclibc-3.x.mk
--- make/gcc-uclibc-3.x.mk	9 Sep 2004 10:50:57 -0000	1.4
+++ make/gcc-uclibc-3.x.mk	9 Sep 2004 13:47:19 -0000
@@ -39,16 +39,23 @@
 #
 #############################################################
 
-ifeq ($(INSTALL_LIBGCJ),true)
+ifeq ($(BUILD_GCJ),true)
 TARGET_LANGUAGES:=c,c++,java
 else
-ifeq ($(INSTALL_LIBSTDCPP),true)
+ifeq ($(BUILD_CPP),true)
 TARGET_LANGUAGES:=c,c++
 else
 TARGET_LANGUAGES:=c
 endif
 endif
 
+ifeq ($(INSTALL_LIBSTDCPP),true)
+	LIBSTDCPP_TARGET=$(TARGET_DIR)/lib/libstdc++.so.6
+else
+	LIBSTDCPP_TARGET=
+endif
+
+
 #############################################################
 #
 # build the first pass gcc compiler
@@ -195,8 +202,13 @@
 	-$(STRIP) $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libgcc_s.so.1
 	-cp -a $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libgcc_s* $(TARGET_DIR)/lib/
 
+$(TARGET_DIR)/lib/libstdc++.so.6: $(GCC_BUILD_DIR2)/.installed
+	rm -rf $(TARGET_DIR)/usr/lib/libstdc++.so*
+	-$(STRIP) $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.so.6
+	-cp -a $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.so* $(TARGET_DIR)/lib/
+
 gcc: uclibc-configured binutils gcc_initial $(LIBFLOAT_TARGET) uclibc \
-	$(TARGET_DIR)/lib/libgcc_s.so.1 $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS)
+	$(TARGET_DIR)/lib/libgcc_s.so.1 $(LIBSTDCPP_TARGET) $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS)
 
 gcc-source: $(DL_DIR)/$(GCC_SOURCE)
 


More information about the uClibc mailing list