diff options
-rw-r--r-- | Makefile | 36 | ||||
-rw-r--r-- | make/binutils.mk | 244 | ||||
-rw-r--r-- | make/gcc-2.95.mk | 290 | ||||
-rw-r--r-- | make/gcc-3.3.mk (renamed from make/uclibc_toolchain.mk) | 418 | ||||
-rw-r--r-- | make/gcc_target.mk | 414 | ||||
-rw-r--r-- | make/kernel-headers.mk | 63 | ||||
-rw-r--r-- | make/uclibc.mk | 121 | ||||
-rw-r--r-- | make/uclibc_toolchain_2_95.mk | 555 | ||||
-rw-r--r-- | sources/binutils-001-debian.patch | 185 | ||||
-rw-r--r-- | sources/binutils-001_ld_makefile.patch | 22 | ||||
-rw-r--r-- | sources/binutils-002-uclibc.patch | 12 | ||||
-rw-r--r-- | sources/binutils-006_better_file_error.patch | 17 | ||||
-rw-r--r-- | sources/binutils-009_signed_char_fix.patch | 12 | ||||
-rw-r--r-- | sources/binutils-012_check_ldrunpath_length.patch | 21 | ||||
-rw-r--r-- | sources/binutils-906-hjl_libtool_dso.patch | 38 |
15 files changed, 1050 insertions, 1398 deletions
@@ -19,8 +19,6 @@ # USA -TARGETS= -DISABLE_NLS= ############################################################# # # EDIT this stuff to suit your system and preferences @@ -70,26 +68,40 @@ OPTIMIZE_FOR_CPU=$(ARCH) EXTRA_GCC_CONFIG_OPTIONS= #EXTRA_GCC_CONFIG_OPTIONS=--without-float -# Uncomment the following if you don't want gettext support. -DISABLE_NLS:=--disable-nls +# Enable the following if you want locale/gettext/i18n support. +#ENABLE_LOCALE:=true +ENABLE_LOCALE:=false + +# If you want multilib enabled, enable this... +MULTILIB:=--enable-multilib + +#Install libstdc++? +INSTALL_LIBSTDCPP=true ############################################################# # # The list of stuff to build for the target filesystem # ############################################################# +TARGETS:= # The toolchain comes next if we are building one ifeq ($(USE_UCLIBC_TOOLCHAIN),true) -TARGETS+=uclibc_toolchain +TARGETS+=binutils uclibc-configured gcc3_3 +#TARGETS+=binutils uclibc gcc_2_95 +else +TARGETS+=uclibc endif -# Do you want user mode Linux (x86 only), or are you building a -# real kernel # that will run on its own? Perhaps you have a +# Do you want user mode Linux (x86 only), or are you building a +# your own kernel that will run on its own? Perhaps you have a # kernel you have already configured and you want to use that? +# The default is to just use a set of known working kernel +# headers. Unless you want to build a kernel, I recommend just +# using that... +TARGETS+=kernel-headers #TARGETS+=linux #TARGETS+=user-mode-linux #TARGETS+=system-linux -TARGETS+=kernel-headers # The default minimal set TARGETS+=busybox tinylogin @@ -187,6 +199,14 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \ GCC=$(TARGET_CROSS)gcc \ CXX=$(TARGET_CROSS)g++ \ RANLIB=$(TARGET_CROSS)ranlib +#Directory in which to build the toolchain +TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH) +ifeq ($(ENABLE_LOCALE),true) +DISABLE_NLS:= +else +DISABLE_NLS:=--disable-nls +endif + all: world diff --git a/make/binutils.mk b/make/binutils.mk new file mode 100644 index 000000000..d5cb75d91 --- /dev/null +++ b/make/binutils.mk @@ -0,0 +1,244 @@ +############################################################# +# +# build binutils for use on the host system +# +############################################################# +BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils +BINUTILS_SOURCE:=binutils-2.14.90.0.6.tar.bz2 +BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.14.90.0.6 +BINUTILS_CAT:=bzcat + +BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-build +$(DL_DIR)/$(BINUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) + +$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) + mkdir -p $(TOOL_BUILD_DIR) + mkdir -p $(DL_DIR) + mkdir -p $(STAGING_DIR) + mkdir -p $(STAGING_DIR)/include + mkdir -p $(STAGING_DIR)/lib/gcc-lib + mkdir -p $(STAGING_DIR)/usr/lib + mkdir -p $(STAGING_DIR)/usr/bin; + mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/ + (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../lib) + (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include) + (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include sys-include) + (cd $(STAGING_DIR)/usr/lib; ln -fs ../../lib/gcc-lib) + $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(BINUTILS_DIR)/.unpacked + +$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked + # Apply any files named binutils-*.patch from the source directory to binutils + $(SOURCE_DIR)/patch-kernel.sh $(BINUTILS_DIR) $(SOURCE_DIR) binutils-*.patch + # + # Hack binutils to use the correct default shared lib loader + # + (cd $(BINUTILS_DIR); perl -i -p -e "s,#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\",\ + #define ELF_DYNAMIC_INTERPRETER \"/lib/ld-uClibc.so.0\",;" \ + `grep -lr ELF_DYNAMIC_INTERPRETER *`); + touch $(BINUTILS_DIR)/.patched + +$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched + mkdir -p $(BINUTILS_DIR1) + (cd $(BINUTILS_DIR1); CC=$(HOSTCC) \ + CC_FOR_HOST=$(HOSTCC) \ + CXX_FOR_HOST=$(HOSTCC) \ + $(BINUTILS_DIR)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_HOST_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=$(STAGING_DIR) \ + --exec-prefix=$(STAGING_DIR) \ + --bindir=$(STAGING_DIR)/bin \ + --sbindir=$(STAGING_DIR)/sbin \ + --sysconfdir=$(STAGING_DIR)/etc \ + --datadir=$(STAGING_DIR)/share \ + --includedir=$(STAGING_DIR)/include \ + --libdir=$(STAGING_DIR)/lib \ + --localstatedir=$(STAGING_DIR)/var \ + --mandir=$(STAGING_DIR)/man \ + --infodir=$(STAGING_DIR)/info \ + --enable-targets=$(GNU_TARGET_NAME) \ + --with-sysroot=$(STAGING_DIR) \ + --with-lib-path="$(STAGING_DIR)/usr/lib:$(STAGING_DIR)/lib" \ + $(MULTILIB) \ + --program-prefix=$(ARCH)-uclibc-); + touch $(BINUTILS_DIR1)/.configured + +$(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured + $(MAKE) CC_FOR_HOST=$(HOSTCC) \ + CXX_FOR_HOST=$(HOSTCC) \ + -C $(BINUTILS_DIR1); + +$(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump + $(MAKE) CC_FOR_HOST=$(HOSTCC) \ + CXX_FOR_HOST=$(HOSTCC) \ + -C $(BINUTILS_DIR1) install; + rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ + $(STAGING_DIR)/share/locale + mkdir -p $(STAGING_DIR)/usr/bin; + set -e; \ + for app in addr2line ar as c++filt gprof ld nm objcopy \ + objdump ranlib readelf size strings strip ; \ + do \ + if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \ + (cd $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin; \ + ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ + ); \ + (cd $(STAGING_DIR)/usr/bin; \ + ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ + ); \ + fi; \ + done; + +$(STAGING_DIR)/lib/libg.a: + mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin + $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ar rv $(STAGING_DIR)/lib/libg.a; + +binutils: $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld $(STAGING_DIR)/lib/libg.a + +binutils-clean: + rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* + -$(MAKE) -C $(BINUTILS_DIR1) clean + +binutils-dirclean: + rm -rf $(BINUTILS_DIR1) + + + +############################################################# +# +# build binutils for use on the target system +# +############################################################# +BINUTILS_DIR2:=$(BUILD_DIR)/binutils-target +$(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched + mkdir -p $(BINUTILS_DIR2) + mkdir -p $(TARGET_DIR)/usr/include + mkdir -p $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/ + (cd $(BINUTILS_DIR2); ln -fs $(ARCH)-linux build-$(GNU_TARGET_NAME)) + (cd $(BINUTILS_DIR2); \ + AR=ar \ + AS=as \ + LD=ld \ + NM=nm \ + RANLIB=ranlib \ + CC=$(HOSTCC) \ + GCC=$(HOSTCC) \ + CXX=$(HOSTCC) \ + AR_FOR_TARGET=$(TARGET_CROSS)ar \ + AS_FOR_TARGET=$(TARGET_CROSS)as \ + LD_FOR_TARGET=$(TARGET_CROSS)ld \ + NM_FOR_TARGET=$(TARGET_CROSS)nm \ + OBJDUMP_FOR_TARGET=$(TARGET_CROSS)objdump \ + OBJCOPY_FOR_TARGET=$(TARGET_CROSS)objcopy \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc \ + GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ + CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ + RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ + $(BINUTILS_DIR)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --libdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --enable-shared $(MULTILIB) \ + --program-prefix="" \ + ); + touch $(BINUTILS_DIR2)/.configured + +$(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured + $(MAKE) -C $(BINUTILS_DIR2) \ + AR=ar \ + AS=as \ + LD=ld \ + NM=nm \ + RANLIB=ranlib \ + CC=$(HOSTCC) \ + GCC=$(HOSTCC) \ + CXX=$(HOSTCC) \ + AR_FOR_TARGET=$(TARGET_CROSS)ar \ + AS_FOR_TARGET=$(TARGET_CROSS)as \ + LD_FOR_TARGET=$(TARGET_CROSS)ld \ + NM_FOR_TARGET=$(TARGET_CROSS)nm \ + OBJDUMP_FOR_TARGET=$(TARGET_CROSS)objdump \ + OBJCOPY_FOR_TARGET=$(TARGET_CROSS)objcopy \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc \ + GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ + CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ + RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib + touch -c $(BINUTILS_DIR2)/binutils/objdump + +$(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump + $(MAKE) -C $(BINUTILS_DIR2) \ + AR=ar \ + AS=as \ + LD=ld \ + NM=nm \ + RANLIB=ranlib \ + CC=$(HOSTCC) \ + GCC=$(HOSTCC) \ + CXX=$(HOSTCC) \ + AR_FOR_TARGET=$(TARGET_CROSS)ar \ + AS_FOR_TARGET=$(TARGET_CROSS)as \ + LD_FOR_TARGET=$(TARGET_CROSS)ld \ + NM_FOR_TARGET=$(TARGET_CROSS)nm \ + OBJDUMP_FOR_TARGET=$(TARGET_CROSS)objdump \ + OBJCOPY_FOR_TARGET=$(TARGET_CROSS)objcopy \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc \ + GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ + CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ + RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ + prefix=/usr \ + exec_prefix=/usr \ + bindir=/usr/bin \ + sbindir=/usr/sbin \ + libexecdir=/usr/lib \ + datadir=/usr/share \ + sysconfdir=/etc \ + localstatedir=/var \ + libdir=/usr/lib \ + infodir=/usr/info \ + mandir=/usr/man \ + includedir=/usr/include \ + DESTDIR=$(TARGET_DIR) install + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + -$(STRIP) $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/bin/* > /dev/null 2>&1 + -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1 + +$(TARGET_DIR)/usr/lib/libg.a: + $(TARGET_CROSS)ar rv $(TARGET_DIR)/usr/lib/libg.a; + cp $(BINUTILS_DIR)/include/ansidecl.h $(TARGET_DIR)/usr/include/ + cp $(BINUTILS_DIR)/include/bfdlink.h $(TARGET_DIR)/usr/include/ + cp $(BINUTILS_DIR)/include/dis-asm.h $(TARGET_DIR)/usr/include/ + cp $(BINUTILS_DIR)/include/libiberty.h $(TARGET_DIR)/usr/include/ + cp $(BINUTILS_DIR)/include/symcat.h $(TARGET_DIR)/usr/include/ + cp $(BINUTILS_DIR2)/bfd/bfd.h $(TARGET_DIR)/usr/include/ + cp -a $(BINUTILS_DIR2)/bfd/.libs/* $(TARGET_DIR)/usr/lib/ + cp -a $(BINUTILS_DIR2)/opcodes/.libs/* $(TARGET_DIR)/usr/lib/ + cp -a $(BINUTILS_DIR2)/libiberty/libiberty.a $(TARGET_DIR)/usr/lib/ + +binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld $(TARGET_DIR)/usr/lib/libg.a + +binutils_target-clean: + rm -f $(TARGET_DIR)/bin/$(GNU_TARGET_NAME)* + -$(MAKE) -C $(BINUTILS_DIR2) clean + +binutils_target-dirclean: + rm -rf $(BINUTILS_DIR2) + + + + + diff --git a/make/gcc-2.95.mk b/make/gcc-2.95.mk new file mode 100644 index 000000000..4ce930de0 --- /dev/null +++ b/make/gcc-2.95.mk @@ -0,0 +1,290 @@ +# Makefile for to build a gcc/uClibc toolchain +# +# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +ifeq ($(GCC_2_95_TOOLCHAIN),true) + +GCC_SITE:=http://www.uclibc.org/downloads/toolchain +GCC_SOURCE:=gcc-20011006.tar.bz2 +GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-20011006 +GCC_CAT:=bzcat + +STLPORT_SITE=http://www.stlport.org/archive +STLPORT_SOURCE=STLport-4.5.3.tar.gz +STLPORT_DIR=$(TOOL_BUILD_DIR)/STLport-4.5.3 + + + +############################################################# +# +# Setup some initial stuff +# +############################################################# +ifeq ($(INSTALL_LIBSTDCPP),true) +TARGET_LANGUAGES:=c,c++ +STLPORT_TARGET=stlport +else +TARGET_LANGUAGES:=c +STLPORT_TARGET= +endif + +############################################################# +# +# Next build first pass gcc compiler +# +############################################################# +GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-2.95-initial +$(DL_DIR)/$(GCC_SOURCE): + $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) + +$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) + $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(GCC_DIR)/.unpacked + +$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked + # Apply any files named gcc-*.patch from the source directory to gcc + $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc2.95-mega.patch.bz2 + touch $(GCC_DIR)/.patched + +$(GCC_DIR)/.gcc_2_95_build_hacks: $(GCC_DIR)/.patched + # + # Hack things to use the correct shared lib loader + # + (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\ + if [ -n "$$LIST" ] ; then \ + perl -i -p -e "s,-dynamic-linker.*\.so[\.0-9]*},\ + -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi); + # + # Prevent system glibc start files from leaking in uninvited... + # + perl -i -p -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\ + \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; + perl -i -p -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\ + \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; + # + # Prevent system glibc include files from leaking in uninvited... + # + perl -i -p -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ + $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; + perl -i -p -e "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ + $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; + perl -i -p -e "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ + \"$(STAGING_DIR)/include\",;" $(GCC_DIR)/gcc/cppdefault.h; + # + # Prevent system glibc libraries from being found by collect2 + # when it calls locatelib() and rummages about the system looking + # for libraries with the correct name... + # + perl -i -p -e "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c + perl -i -p -e "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c + # + # Prevent gcc from using the unwind-dw2-fde-glibc code + # + perl -i -p -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ + #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c; + # + # Use atexit() directly, rather than cxa_atexit + # + perl -i -p -e "s,int flag_use_cxa_atexit = 1;,int flag_use_cxa_atexit = 0;,g;"\ + $(GCC_DIR)/gcc/cp/decl2.c; + # + # We do not wish to build the libstdc++ library provided with gcc, + # since it doesn't seem to work at all with uClibc plus gcc 2.95... + # + mv $(GCC_DIR)/libstdc++ $(GCC_DIR)/libstdc++.orig + mv $(GCC_DIR)/libio $(GCC_DIR)/libio.orig + touch $(GCC_DIR)/.gcc_2_95_build_hacks + +# The --without-headers option stopped working with gcc 3.0 and has never been +# fixed, so we need to actually have working C library header files prior to +# the step or libgcc will not build... +$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc_2_95_build_hacks + mkdir -p $(GCC_BUILD_DIR1) + (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \ + RANLIB=$(TARGET_CROSS)ranlib CC=$(HOSTCC) \ + $(GCC_DIR)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_HOST_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=$(STAGING_DIR) \ + --exec-prefix=$(STAGING_DIR) \ + --bindir=$(STAGING_DIR)/bin \ + --sbindir=$(STAGING_DIR)/sbin \ + --sysconfdir=$(STAGING_DIR)/etc \ + --datadir=$(STAGING_DIR)/share \ + --includedir=$(STAGING_DIR)/include \ + --libdir=$(STAGING_DIR)/lib \ + --localstatedir=$(STAGING_DIR)/var \ + --mandir=$(STAGING_DIR)/man \ + --infodir=$(STAGING_DIR)/info \ + --with-local-prefix=$(STAGING_DIR)/usr/local \ + --oldincludedir=$(STAGING_DIR)/include $(MULTILIB) \ + --enable-target-optspace $(DISABLE_NLS) --with-gnu-ld \ + --disable-shared --enable-languages=c --disable-__cxa_atexit \ + $(EXTRA_GCC_CONFIG_OPTIONS) --program-prefix=$(ARCH)-uclibc-); + touch $(GCC_BUILD_DIR1)/.configured + +$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured + PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) \ + AR_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ar \ + RANLIB_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ranlib + touch $(GCC_BUILD_DIR1)/.compiled + +$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc: $(GCC_BUILD_DIR1)/.compiled + PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install; + #Cleanup then mess when --program-prefix mysteriously fails + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-uclibc-cpp + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc + rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov + rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ + $(STAGING_DIR)/share/locale + +gcc_2_95_initial: binutils $(UCLIBC_DIR)/.configured $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc + +gcc_2_95_initial-clean: + rm -rf $(GCC_BUILD_DIR1) + rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* + +gcc_2_95_initial-dirclean: + rm -rf $(GCC_BUILD_DIR1) + + + +############################################################# +# +# STLport -- an alternative C++ library +# +############################################################# +STLPORT_PATCH=$(SOURCE_DIR)/STLport-4.5.3.patch +$(DL_DIR)/$(STLPORT_SOURCE): + $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE) + +$(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH) + zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1 + +$(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile + $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR) + +$(STAGING_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a + $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR) install +ifneq ($(HAS_MMU),true) + rm -f $(STAGING_DIR)/lib/libstdc++*.so* +endif + +stlport: $(STAGING_DIR)/lib/libstdc++.a + +stlport-clean: + rm -f $(STAGING_DIR)/lib/libstdc++* + rm -f $(STAGING_DIR)/include/c++* + -$(MAKE) -C $(STLPORT_DIR) clean + +stlport-dirclean: + rm -f $(STAGING_DIR)/lib/libstdc++* + rm -f $(STAGING_DIR)/include/g++-v3* + rm -rf $(STLPORT_DIR) + + + +############################################################# +# +# second pass compiler build. Build the compiler targeting +# the newly built shared uClibc library. +# +############################################################# +GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-2.95-final +$(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.patched + touch $(GCC_DIR)/.g++_build_hacks + +$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.g++_build_hacks + mkdir -p $(GCC_BUILD_DIR2) + (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \ + RANLIB=$(TARGET_CROSS)ranlib LD=$(TARGET_CROSS)ld \ + NM=$(TARGET_CROSS)nm CC=$(HOSTCC) \ + $(GCC_DIR)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_HOST_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=$(STAGING_DIR) \ + --exec-prefix=$(STAGING_DIR) \ + --bindir=$(STAGING_DIR)/bin \ + --sbindir=$(STAGING_DIR)/sbin \ + --sysconfdir=$(STAGING_DIR)/etc \ + --datadir=$(STAGING_DIR)/share \ + --localstatedir=$(STAGING_DIR)/var \ + --mandir=$(STAGING_DIR)/man \ + --infodir=$(STAGING_DIR)/info \ + --with-local-prefix=$(STAGING_DIR)/usr/local \ + --libdir=$(STAGING_DIR)/lib \ + --includedir=$(STAGING_DIR)/include \ + --with-gxx-include-dir=$(STAGING_DIR)/include/c++ \ + --oldincludedir=$(STAGING_DIR)/include \ + --enable-shared $(MULTILIB) \ + --enable-target-optspace $(DISABLE_NLS) \ + --with-gnu-ld --disable-__cxa_atexit \ + --enable-languages=$(TARGET_LANGUAGES) \ + $(EXTRA_GCC_CONFIG_OPTIONS) \ + --program-prefix=$(ARCH)-uclibc- \ + ); + touch $(GCC_BUILD_DIR2)/.configured + +$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured + PATH=$(TARGET_PATH) CC=$(HOSTCC) \ + AR_FOR_TARGET=$(TARGET_CROSS)ar RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ + LD_FOR_TARGET=$(TARGET_CROSS)ld NM_FOR_TARGET=$(TARGET_CROSS)nm \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc $(MAKE) -C $(GCC_BUILD_DIR2) + touch $(GCC_BUILD_DIR2)/.compiled + +$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled + touch $(GCC_BUILD_DIR2)/.installed + +$(STAGING_DIR)/bin/$(ARCH)-uclibc-g++: $(GCC_BUILD_DIR2)/.compiled + PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install; + -mv $(STAGING_DIR)/bin/gcc $(STAGING_DIR)/usr/bin; + -mv $(STAGING_DIR)/bin/protoize $(STAGING_DIR)/usr/bin; + -mv $(STAGING_DIR)/bin/unprotoize $(STAGING_DIR)/usr/bin; + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-uclibc-cpp + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++ $(STAGING_DIR)/bin/$(ARCH)-uclibc-c++ + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-g++ $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++ + -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++filt $(STAGING_DIR)/bin/$(ARCH)-uclibc-c++filt + rm -f $(STAGING_DIR)/bin/cpp $(STAGING_DIR)/bin/gcov $(STAGING_DIR)/bin/*gccbug + rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-$(ARCH)-uclibc-* + rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ + $(STAGING_DIR)/share/locale + # Strip the host binaries + -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/* + set -e; \ + for app in cc gcc c89 cpp c++ g++ ; do \ + if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \ + (cd $(STAGING_DIR)/usr/bin; \ + ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ + ); \ + fi; \ + done; + +gcc_2_95: binutils uclibc-configured gcc_2_95_initial uclibc \ + $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++ $(STLPORT_TARGET) + +gcc_2_95-clean: + rm -rf $(GCC_BUILD_DIR2) + rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* + +gcc_2_95-dirclean: + rm -rf $(GCC_BUILD_DIR2) + +endif diff --git a/make/uclibc_toolchain.mk b/make/gcc-3.3.mk index 95014159f..ae201b01e 100644 --- a/make/uclibc_toolchain.mk +++ b/make/gcc-3.3.mk @@ -16,197 +16,37 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -ifeq ($(USE_UCLIBC_TOOLCHAIN),true) ifneq ($(GCC_2_95_TOOLCHAIN),true) -############################################################# -# -# You should probably leave this stuff alone unless you are -# hacking on the toolchain... -# -############################################################# -#Directory in which to build the toolchain -TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH) - -#Install libstdc++? -INSTALL_LIBSTDCPP=true - -TARGET_LANGUAGES:=c,c++ - -# If you want multilib enabled, enable this... -MULTILIB:=--enable-multilib - -############################################################# -# -# Where we can find things.... -# -# for various dependancy reasons, these need to live -# here at the top... Easier to find things here anyways... -# -############################################################# -BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils -BINUTILS_SOURCE:=binutils-2.14.90.0.6.tar.bz2 -BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.14.90.0.6 -BINUTILS_CAT:=bzcat - -ifeq ($(USE_UCLIBC_SNAPSHOT),true) -# Be aware that this changes daily.... -UCLIBC_DIR=$(BUILD_DIR)/uClibc -UCLIBC_SOURCE=uClibc-snapshot.tar.bz2 -UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots -else -UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.21 -UCLIBC_SOURCE:=uClibc-0.9.21.tar.bz2 -UCLIBC_SITE:=http://www.uclibc.org/downloads -endif - +# Older stuff... #GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/ #GCC_SOURCE:=gcc-3.3.tar.gz #GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-3.3 #GCC_CAT:=zcat + +# Shiney new stuff... GCC_SITE:=http://gcc.get-software.com/releases/gcc-3.3.1 GCC_SOURCE:=gcc-3.3.1.tar.bz2 GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-3.3.1 GCC_CAT:=bzcat - - - -############################################################# -# -# Setup some initial paths -# -############################################################# -$(STAGING_DIR)/.setup: - mkdir -p $(TOOL_BUILD_DIR) - mkdir -p $(DL_DIR) - mkdir -p $(STAGING_DIR) - mkdir -p $(STAGING_DIR)/include - mkdir -p $(STAGING_DIR)/lib/gcc-lib - mkdir -p $(STAGING_DIR)/usr/lib - mkdir -p $(STAGING_DIR)/usr/bin; - mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/ - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../lib) - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include) - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include sys-include) - (cd $(STAGING_DIR)/usr/lib; ln -fs ../../lib/gcc-lib) - touch $(STAGING_DIR)/.setup - - ############################################################# # # Setup some initial stuff # ############################################################# -uclibc_toolchain: gcc_final - -uclibc_toolchain-source: $(DL_DIR)/$(BINUTILS_SOURCE) $(DL_DIR)/$(UCLIBC_SOURCE) $(DL_DIR)/$(GCC_SOURCE) - -uclibc_toolchain-clean: gcc_final-clean uclibc-clean gcc_initial-clean binutils-clean - -uclibc_toolchain-dirclean: gcc_final-dirclean uclibc-dirclean gcc_initial-dirclean binutils-dirclean - - - -############################################################# -# -# build binutils -# -############################################################# -BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-build -$(DL_DIR)/$(BINUTILS_SOURCE): - $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) - -$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) - $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - - touch $(BINUTILS_DIR)/.unpacked - -$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked - # Apply any files named binutils-*.patch from the source directory to binutils - $(SOURCE_DIR)/patch-kernel.sh $(BINUTILS_DIR) $(SOURCE_DIR) binutils-*.patch - # - # Hack binutils to use the correct default shared lib loader - # - (cd $(BINUTILS_DIR); perl -i -p -e "s,#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\",\ - #define ELF_DYNAMIC_INTERPRETER \"/lib/ld-uClibc.so.0\",;" \ - `grep -lr ELF_DYNAMIC_INTERPRETER *`); - touch $(BINUTILS_DIR)/.patched - -$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched - mkdir -p $(BINUTILS_DIR1) - (cd $(BINUTILS_DIR1); CC=$(HOSTCC) \ - CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - $(BINUTILS_DIR)/configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_HOST_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=$(STAGING_DIR) \ - --exec-prefix=$(STAGING_DIR) \ - --bindir=$(STAGING_DIR)/bin \ - --sbindir=$(STAGING_DIR)/sbin \ - --sysconfdir=$(STAGING_DIR)/etc \ - --datadir=$(STAGING_DIR)/share \ - --includedir=$(STAGING_DIR)/include \ - --libdir=$(STAGING_DIR)/lib \ - --localstatedir=$(STAGING_DIR)/var \ - --mandir=$(STAGING_DIR)/man \ - --infodir=$(STAGING_DIR)/info \ - --enable-targets=$(GNU_TARGET_NAME) \ - --with-sysroot=$(STAGING_DIR) \ - --with-lib-path="$(STAGING_DIR)/usr/lib:$(STAGING_DIR)/lib" \ - $(MULTILIB) \ - --program-prefix=$(ARCH)-uclibc-); - touch $(BINUTILS_DIR1)/.configured - -$(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured - $(MAKE) CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - -C $(BINUTILS_DIR1); - -$(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump - $(MAKE) CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - -C $(BINUTILS_DIR1) install; - rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ - $(STAGING_DIR)/share/locale - mkdir -p $(STAGING_DIR)/usr/bin; - set -e; \ - for app in addr2line ar as c++filt gprof ld nm objcopy \ - objdump ranlib readelf size strings strip ; \ - do \ - if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \ - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin; \ - ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ - ); \ - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ - ); \ - fi; \ - done; - -$(STAGING_DIR)/lib/libg.a: - mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin - $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ar rv $(STAGING_DIR)/lib/libg.a; - -binutils: $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld $(STAGING_DIR)/lib/libg.a - -binutils-clean: - rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* - -$(MAKE) -C $(BINUTILS_DIR1) clean - -binutils-dirclean: - rm -rf $(BINUTILS_DIR1) - - - +ifeq ($(INSTALL_LIBSTDCPP),true) +TARGET_LANGUAGES:=c,c++ +else +TARGET_LANGUAGES:=c +endif ############################################################# # -# Next build first pass gcc compiler +# build the first pass gcc compiler # ############################################################# -GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-initial +GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-3.3-initial $(DL_DIR)/$(GCC_SOURCE): $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) @@ -219,7 +59,7 @@ $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc-*.patch touch $(GCC_DIR)/.patched -$(GCC_DIR)/.gcc_build_hacks: $(GCC_DIR)/.patched +$(GCC_DIR)/.gcc3_3_build_hacks: $(GCC_DIR)/.patched # # Hack things to use the correct shared lib loader # @@ -255,12 +95,12 @@ $(GCC_DIR)/.gcc_build_hacks: $(GCC_DIR)/.patched # perl -i -p -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c; - touch $(GCC_DIR)/.gcc_build_hacks + touch $(GCC_DIR)/.gcc3_3_build_hacks # The --without-headers option stopped working with gcc 3.0 and has never been # # fixed, so we need to actually have working C library header files prior to # # the step or libgcc will not build... -$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc_build_hacks +$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc3_3_build_hacks mkdir -p $(GCC_BUILD_DIR1) (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \ RANLIB=$(TARGET_CROSS)ranlib CC=$(HOSTCC) \ @@ -301,99 +141,24 @@ $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc: $(GCC_BUILD_DIR1)/.compiled rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ $(STAGING_DIR)/share/locale -gcc_initial: binutils $(UCLIBC_DIR)/.configured $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc +gcc3_3_initial: binutils uclibc-configured $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc -gcc_initial-clean: +gcc3_3_initial-clean: rm -rf $(GCC_BUILD_DIR1) rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* -gcc_initial-dirclean: +gcc3_3_initial-dirclean: rm -rf $(GCC_BUILD_DIR1) ############################################################# # -# uClibc is built in two stages. First, we install the uClibc -# include files so that gcc can be built. Later when gcc for -# the target arch has been compiled, we can actually compile -# uClibc for the target... -# -############################################################# -$(DL_DIR)/$(UCLIBC_SOURCE): - $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE) - -$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) - bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf - - touch $(UCLIBC_DIR)/.unpacked - -$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(BUILD_DIR)/linux/.configured - perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCROSS=$(TARGET_CROSS),g' \ - $(UCLIBC_DIR)/Rules.mak - cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config - perl -i -p -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"$(STAGING_DIR)\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^SYSTEM_DEVEL_PREFIX=.*,SYSTEM_DEVEL_PREFIX=\"$(STAGING_DIR)\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^DEVEL_TOOL_PREFIX=.*,DEVEL_TOOL_PREFIX=\"$(STAGING_DIR)/usr\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH=\"/lib\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^GCC_BIN.*,GCC_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc,g' \ - $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile - perl -i -p -e 's,^LD_BIN.*,LD_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ld,g' \ - $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile - $(MAKE) -C $(UCLIBC_DIR) oldconfig - $(MAKE) -C $(UCLIBC_DIR) headers - zcat $(DL_DIR)/uClibc-locale-030818.tgz | tar -C $(UCLIBC_DIR)/extra/locale -xvf - - $(MAKE) -C $(UCLIBC_DIR)/extra/locale pregen - $(MAKE) -C $(UCLIBC_DIR) install_dev; - touch $(UCLIBC_DIR)/.configured - -$(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured - $(MAKE) -C $(UCLIBC_DIR) - -$(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a - $(MAKE) -C $(UCLIBC_DIR) install_dev install_runtime install_utils - -ifneq ($(TARGET_DIR),) -$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a - $(MAKE) -C $(UCLIBC_DIR) DEVEL_PREFIX=$(TARGET_DIR) \ - SYSTEM_DEVEL_PREFIX=$(TARGET_DIR) \ - DEVEL_TOOL_PREFIX=$(TARGET_DIR)/usr install_runtime - -$(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0 - $(MAKE) -C $(UCLIBC_DIR) PREFIX=$(TARGET_DIR) install_target_utils - (cd $(TARGET_DIR)/sbin; ln -sf /bin/true ldconfig) - -UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd -endif - -uclibc: $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc $(STAGING_DIR)/lib/libc.a \ - $(UCLIBC_TARGETS) - -uclibc-clean: - -$(MAKE) -C $(UCLIBC_DIR) clean - rm -f $(UCLIBC_DIR)/.config - -uclibc-dirclean: - rm -rf $(UCLIBC_DIR) - - - - - -############################################################# -# # second pass compiler build. Build the compiler targeting # the newly built shared uClibc library. # ############################################################# -GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-final +GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-3.3-final $(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.patched # # Hack up the soname for libstdc++ @@ -486,28 +251,155 @@ GCC_TARGETS= $(TARGET_DIR)/lib/libgcc_s.so.0.9.9 endif endif -gcc_final: $(STAGING_DIR)/.setup binutils gcc_initial uclibc \ + +gcc3_3: binutils uclibc-configured gcc3_3_initial uclibc \ $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++ $(GCC_TARGETS) -gcc_final-clean: +gcc3_3-clean: rm -rf $(GCC_BUILD_DIR2) rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* -gcc_final-dirclean: +gcc3_3-dirclean: rm -rf $(GCC_BUILD_DIR2) + + + + ############################################################# # -# Packup the toolchain binaries +# Next build target gcc compiler # ############################################################# -$(ARCH)-uclibc-toolchain.tar.bz2: gcc_final - rm -f $(ARCH)-uclibc-toolchain.tar.bz2 - tar -cf $(ARCH)-uclibc-toolchain.tar $(STAGING_DIR) - bzip2 -9 $(ARCH)-uclibc-toolchain.tar - -tarball: $(ARCH)-uclibc-toolchain.tar.bz2 +GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-3.3-target +$(GCC_BUILD_DIR3)/.gcc3_3_build_hacks: $(GCC_DIR3_DEPENDS) + # + # Make certain the uClibc start files are found + # + perl -i -p -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1=\ + \"/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; + perl -i -p -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2=\ + \"/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; + # + # Make certain the uClibc include files are found + # + perl -i -p -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ + /usr/include,;" $(GCC_DIR)/gcc/Makefile.in; + perl -i -p -e "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ + /usr/include,;" $(GCC_DIR)/gcc/Makefile.in; + perl -i -p -e "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ + \"/usr/include\",;" $(GCC_DIR)/gcc/cppdefault.h; + mkdir -p $(GCC_BUILD_DIR3) + touch $(GCC_BUILD_DIR3)/.gcc3_3_build_hacks + +$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.gcc3_3_build_hacks + mkdir -p $(GCC_BUILD_DIR3) + (cd $(GCC_BUILD_DIR3); ln -fs $(ARCH)-linux build-$(GNU_TARGET_NAME)) + (cd $(GCC_BUILD_DIR3); \ + $(TARGET_CONFIGURE_OPTS) \ + CC_FOR_BUILD=$(TARGET_CROSS)gcc \ + CXX_FOR_BUILD=$(TARGET_CROSS)g++ \ + AR_FOR_TARGET=$(TARGET_CROSS)ar \ + AS_FOR_TARGET=$(TARGET_CROSS)as \ + LD_FOR_TARGET=$(TARGET_CROSS)ld \ + NM_FOR_TARGET=$(TARGET_CROSS)nm \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc \ + GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ + CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ + RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ + $(GCC_DIR)/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(ARCH)-linux \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --with-local-prefix=/usr/local \ + --libdir=/usr/lib \ + --disable-shared $(MULTILIB) \ + --enable-target-optspace $(DISABLE_NLS) \ + --with-gnu-ld --disable-__cxa_atexit \ + --enable-languages=$(TARGET_LANGUAGES) \ + $(EXTRA_GCC_CONFIG_OPTIONS) \ + --program-prefix="" \ + ); + touch $(GCC_BUILD_DIR3)/.configured + +$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured + $(MAKE) -C $(GCC_BUILD_DIR3) \ + CC_FOR_BUILD=$(HOSTCC) \ + CXX_FOR_BUILD=$(HOSTCC) \ + AR_FOR_TARGET=$(TARGET_CROSS)ar \ + AS_FOR_TARGET=$(TARGET_CROSS)as \ + LD_FOR_TARGET=$(TARGET_CROSS)ld \ + NM_FOR_TARGET=$(TARGET_CROSS)nm \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc \ + GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ + CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ + RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib + touch $(GCC_BUILD_DIR3)/.compiled + +$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled + $(MAKE) -C $(GCC_BUILD_DIR3) \ + CC_FOR_BUILD=$(HOSTCC) \ + CXX_FOR_BUILD=$(HOSTCC) \ + AR_FOR_TARGET=$(TARGET_CROSS)ar \ + AS_FOR_TARGET=$(TARGET_CROSS)as \ + LD_FOR_TARGET=$(TARGET_CROSS)ld \ + NM_FOR_TARGET=$(TARGET_CROSS)nm \ + CC_FOR_TARGET=$(TARGET_CROSS)gcc \ + GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ + CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ + RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ + prefix=/usr \ + exec_prefix=/usr \ + bindir=/usr/bin \ + sbindir=/usr/sbin \ + libexecdir=/usr/lib \ + datadir=/usr/share \ + sysconfdir=/etc \ + localstatedir=/var \ + libdir=/usr/lib \ + infodir=/usr/info \ + mandir=/usr/man \ + includedir=/usr/include \ + DESTDIR=$(TARGET_DIR) install + (cd $(TARGET_DIR)/usr/bin; ln -fs gcc cc) + (cd $(TARGET_DIR)/lib; ln -fs /usr/bin/cpp) + rm -rf $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/include + rm -rf $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/sys-include + rm -rf $(TARGET_DIR)/usr/include/include $(TARGET_DIR)/usr/usr + #-cp -dpf $(STAGING_DIR)/lib/libgcc* $(TARGET_DIR)/lib/ + #-chmod a-x $(STAGING_DIR)/lib/*++* + #-cp -a $(STAGING_DIR)/lib/*++* $(TARGET_DIR)/lib/ + #-cp -a $(STAGING_DIR)/include/c++ $(TARGET_DIR)/usr/include/ + -mv $(TARGET_DIR)/lib/*.a $(TARGET_DIR)/usr/lib/ + -mv $(TARGET_DIR)/lib/*.la $(TARGET_DIR)/usr/lib/ + rm -f $(TARGET_DIR)/lib/libstdc++.so + -(cd $(TARGET_DIR)/usr/lib; ln -fs /lib/libstdc++.so.5.0.5 libstdc++.so) + # A nasty hack to work around g++ adding -lgcc_eh to the link + -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/3.3.1/ ; ln -s libgcc.a libgcc_eh.a) + -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) + -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) + rm -f $(TARGET_DIR)/usr/lib/*.la* + rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ + $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc + touch -c $(TARGET_DIR)/usr/bin/gcc + +gcc3_3_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc + +gcc3_3_target-clean: + rm -rf $(GCC_BUILD_DIR3) + rm -f $(TARGET_DIR)/bin/$(GNU_TARGET_NAME)* + +gcc3_3_target-dirclean: + rm -rf $(GCC_BUILD_DIR3) endif -endif diff --git a/make/gcc_target.mk b/make/gcc_target.mk deleted file mode 100644 index 6ba449db3..000000000 --- a/make/gcc_target.mk +++ /dev/null @@ -1,414 +0,0 @@ -# Makefile for to build a gcc/uClibc toolchain linked vs uClibc -# -# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -############################################################# -# -# You should probably leave this stuff alone unless you are -# hacking on the toolchain... -# -############################################################# -TARGET_LANGUAGES:=c,c++ - -# If you want multilib enabled, enable this... -MULTILIB:=--enable-multilib - -ifeq ($(USE_UCLIBC_TOOLCHAIN),true) -GCC_DEPENDANCY=gcc_final -else -BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils -BINUTILS_SOURCE:=binutils-2.14.90.0.5.tar.bz2 -BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.14.90.0.5 -BINUTILS_CAT:=bzcat - -GCC_SITE:=http://gcc.get-software.com/releases/gcc-3.3.1 -GCC_SOURCE:=gcc-3.3.1.tar.bz2 -GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-3.3.1 -GCC_CAT:=bzcat -endif - -############################################################# -# -# Where we can find things.... -# -# for various dependancy reasons, these need to live -# here at the top... Easier to find things here anyways... -# -############################################################# -BINUTILS_DIR2:=$(BUILD_DIR)/binutils-target -GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-target - - -############################################################# -# -# build binutils -# -############################################################# -ifneq ($(USE_UCLIBC_TOOLCHAIN),true) -BINUTILS_DIR2_DEPENDS:=$(BINUTILS_DIR)/.patched -$(DL_DIR)/$(BINUTILS_SOURCE): - $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) - -$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) - $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - - touch $(BINUTILS_DIR)/.unpacked - -$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked - # Apply any files named binutils-*.patch from the source directory to binutils - $(SOURCE_DIR)/patch-kernel.sh $(BINUTILS_DIR) $(SOURCE_DIR) binutils-*.patch - # - # Enable combreloc, since it is such a nice thing to have... - # - -perl -i -p -e "s,link_info.combreloc = false,link_info.combreloc = true,g;" \ - $(BINUTILS_DIR)/ld/ldmain.c - # - # Hack binutils to use the correct shared lib loader - # - (cd $(BINUTILS_DIR); perl -i -p -e "s,#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\"\ - ,#define ELF_DYNAMIC_INTERPRETER \"/lib/ld-uClibc.so.0\",;" \ - `grep -lr "#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\"" $(BINUTILS_DIR)`); - touch $(BINUTILS_DIR)/.patched -endif - -$(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR2_DEPENDS) - mkdir -p $(BINUTILS_DIR2) - mkdir -p $(TARGET_DIR)/usr/include - mkdir -p $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/ - (cd $(BINUTILS_DIR2); ln -fs $(ARCH)-linux build-$(GNU_TARGET_NAME)) - (cd $(BINUTILS_DIR2); $(TARGET_CONFIGURE_OPTS) \ - CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - CC_FOR_BUILD=$(TARGET_CROSS)gcc \ - CXX_FOR_BUILD=$(TARGET_CROSS)g++ \ - AR_FOR_TARGET=$(TARGET_CROSS)ar \ - AS_FOR_TARGET=$(TARGET_CROSS)as \ - LD_FOR_TARGET=$(TARGET_CROSS)ld \ - NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc \ - GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ - CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ - RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ - $(BINUTILS_DIR)/configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_TARGET_NAME) \ - --build=$(ARCH)-linux \ - --prefix=/usr \ - --exec-prefix=/usr \ - --bindir=/usr/bin \ - --sbindir=/usr/sbin \ - --libexecdir=/usr/lib \ - --sysconfdir=/etc \ - --datadir=/usr/share \ - --libdir=/usr/lib \ - --localstatedir=/var \ - --mandir=/usr/man \ - --infodir=/usr/info \ - --enable-shared $(MULTILIB) \ - --program-prefix="" \ - ); - touch $(BINUTILS_DIR2)/.configured - -$(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured - $(MAKE) -C $(BINUTILS_DIR2) \ - $(TARGET_CONFIGURE_OPTS) \ - CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - CC_FOR_BUILD=$(TARGET_CROSS)gcc \ - CXX_FOR_BUILD=$(TARGET_CROSS)g++ \ - AR_FOR_TARGET=$(TARGET_CROSS)ar \ - AS_FOR_TARGET=$(TARGET_CROSS)as \ - LD_FOR_TARGET=$(TARGET_CROSS)ld \ - NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc \ - GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ - CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ - RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib - touch -c $(BINUTILS_DIR2)/binutils/objdump - -$(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump - $(MAKE) -C $(BINUTILS_DIR2) \ - $(TARGET_CONFIGURE_OPTS) \ - CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - CC_FOR_BUILD=$(TARGET_CROSS)gcc \ - CXX_FOR_BUILD=$(TARGET_CROSS)g++ \ - AR_FOR_TARGET=$(TARGET_CROSS)ar \ - AS_FOR_TARGET=$(TARGET_CROSS)as \ - LD_FOR_TARGET=$(TARGET_CROSS)ld \ - NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc \ - GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ - CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ - RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ - prefix=/usr \ - exec_prefix=/usr \ - bindir=/usr/bin \ - sbindir=/usr/sbin \ - libexecdir=/usr/lib \ - datadir=/usr/share \ - sysconfdir=/etc \ - localstatedir=/var \ - libdir=/usr/lib \ - infodir=/usr/info \ - mandir=/usr/man \ - includedir=/usr/include \ - DESTDIR=$(TARGET_DIR) install - rm -rf $(TARGET_DIR)/info $(TARGET_DIR)/man $(TARGET_DIR)/share/doc \ - $(TARGET_DIR)/share/locale - -binutils: $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld - - - rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ - $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc - -$(STRIP) $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/bin/* > /dev/null 2>&1 - -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1 - -$(TARGET_DIR)/usr/lib/libg.a: - $(TARGET_CROSS)ar rv $(TARGET_DIR)/usr/lib/libg.a; - cp $(BINUTILS_DIR)/include/ansidecl.h $(TARGET_DIR)/usr/include/ - cp $(BINUTILS_DIR)/include/bfdlink.h $(TARGET_DIR)/usr/include/ - cp $(BINUTILS_DIR)/include/dis-asm.h $(TARGET_DIR)/usr/include/ - cp $(BINUTILS_DIR)/include/libiberty.h $(TARGET_DIR)/usr/include/ - cp $(BINUTILS_DIR)/include/symcat.h $(TARGET_DIR)/usr/include/ - cp $(BINUTILS_DIR2)/bfd/bfd.h $(TARGET_DIR)/usr/include/ - cp -a $(BINUTILS_DIR2)/bfd/.libs/* $(TARGET_DIR)/usr/lib/ - cp -a $(BINUTILS_DIR2)/opcodes/.libs/* $(TARGET_DIR)/usr/lib/ - cp -a $(BINUTILS_DIR2)/libiberty/libiberty.a $(TARGET_DIR)/usr/lib/ - -binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld $(TARGET_DIR)/usr/lib/libg.a - -binutils_target-clean: - rm -f $(TARGET_DIR)/bin/$(GNU_TARGET_NAME)* - -$(MAKE) -C $(BINUTILS_DIR2) clean - -binutils_target-dirclean: - rm -rf $(BINUTILS_DIR2) - - - - -############################################################# -# -# uClibc just needs its header files and whatnot installed. -# -############################################################# - -$(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/lib/libc.a - $(MAKE) DEVEL_PREFIX=$(TARGET_DIR)/usr SYSTEM_DEVEL_PREFIX=$(TARGET_DIR) \ - DEVEL_TOOL_PREFIX=$(TARGET_DIR) -C $(UCLIBC_DIR) \ - install_dev - #remove the extra copy of the shared libs - rm -f $(TARGET_DIR)/usr/lib/*-*.so - (cd $(TARGET_DIR)/usr/lib; \ - ln -fs /lib/libc.so.0 libc.so; \ - ln -fs /lib/libdl.so.0 libdl.so; \ - ln -fs /lib/libcrypt.so.0 libcrypt.so; \ - ln -fs /lib/libresolv.so.0 libresolv.so; \ - ln -fs /lib/libutil.so.0 libutil.so; \ - ln -fs /lib/libm.so.0 libm.so; \ - ln -fs /lib/libpthread.so.0 libpthread.so; \ - ln -fs /lib/libnsl.so.0 libnsl.so; \ - ) - -uclibc_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/lib/libc.a - -uclibc_target-clean: - rm -f $(TARGET_DIR)/include - -uclibc_target-dirclean: - rm -f $(TARGET_DIR)/include - - - -############################################################# -# -# Next build target gcc compiler -# -############################################################# -ifneq ($(USE_UCLIBC_TOOLCHAIN),true) -GCC_DIR3_DEPENDS:=$(GCC_DIR)/.g++_build_hacks -$(DL_DIR)/$(GCC_SOURCE): - $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) - -$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) - $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - - touch $(GCC_DIR)/.unpacked - -$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked - # Apply any files named gcc-*.patch from the source directory to gcc - $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc-*.patch - touch $(GCC_DIR)/.patched - -$(GCC_DIR)/.gcc_build_hacks: $(GCC_DIR)/.patched - # - # Hack things to use the correct shared lib loader - # - (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\ - if [ -n "$$LIST" ] ; then \ - perl -i -p -e "s,-dynamic-linker.*\.so[\.0-9]*},\ - -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi); - # - # Prevent gcc from using the unwind-dw2-fde-glibc code - # - perl -i -p -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ - #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c; - touch $(GCC_DIR)/.gcc_build_hacks - -$(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.gcc_build_hacks - # - # Hack up the soname for libstdc++ - # - perl -i -p -e "s,\.so\.1,.so.0.9.9,g;" $(GCC_DIR)/gcc/config/t-slibgcc-elf-ver; - perl -i -p -e "s,-version-info.*[0-9]:[0-9]:[0-9],-version-info 9:9:0,g;" \ - $(GCC_DIR)/libstdc++-v3/src/Makefile.am $(GCC_DIR)/libstdc++-v3/src/Makefile.in; - perl -i -p -e "s,3\.0\.0,9.9.0,g;" $(GCC_DIR)/libstdc++-v3/acinclude.m4 \ - $(GCC_DIR)/libstdc++-v3/aclocal.m4 $(GCC_DIR)/libstdc++-v3/configure; - touch $(GCC_DIR)/.g++_build_hacks -endif - -$(GCC_BUILD_DIR3)/.gcc_build_hacks: $(GCC_DIR3_DEPENDS) - # - # Make certain the uClibc start files are found - # - perl -i -p -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1=\ - \"/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; - perl -i -p -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2=\ - \"/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; - # - # Make certain the uClibc include files are found - # - perl -i -p -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ - /usr/include,;" $(GCC_DIR)/gcc/Makefile.in; - perl -i -p -e "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ - /usr/include,;" $(GCC_DIR)/gcc/Makefile.in; - perl -i -p -e "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ - \"/usr/include\",;" $(GCC_DIR)/gcc/cppdefault.h; - mkdir -p $(GCC_BUILD_DIR3) - touch $(GCC_BUILD_DIR3)/.gcc_build_hacks - -$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.gcc_build_hacks - mkdir -p $(GCC_BUILD_DIR3) - (cd $(GCC_BUILD_DIR3); ln -fs $(ARCH)-linux build-$(GNU_TARGET_NAME)) - (cd $(GCC_BUILD_DIR3); \ - $(TARGET_CONFIGURE_OPTS) \ - CC_FOR_BUILD=$(TARGET_CROSS)gcc \ - CXX_FOR_BUILD=$(TARGET_CROSS)g++ \ - AR_FOR_TARGET=$(TARGET_CROSS)ar \ - AS_FOR_TARGET=$(TARGET_CROSS)as \ - LD_FOR_TARGET=$(TARGET_CROSS)ld \ - NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc \ - GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ - CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ - RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ - $(GCC_DIR)/configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_TARGET_NAME) \ - --build=$(ARCH)-linux \ - --prefix=/usr \ - --exec-prefix=/usr \ - --bindir=/usr/bin \ - --sbindir=/usr/sbin \ - --sysconfdir=/etc \ - --datadir=/usr/share \ - --localstatedir=/var \ - --mandir=/usr/man \ - --infodir=/usr/info \ - --with-local-prefix=/usr/local \ - --libdir=/usr/lib \ - --disable-shared $(MULTILIB) \ - --enable-target-optspace $(DISABLE_NLS) \ - --with-gnu-ld --disable-__cxa_atexit \ - --enable-languages=$(TARGET_LANGUAGES) \ - $(EXTRA_GCC_CONFIG_OPTIONS) \ - --program-prefix="" \ - ); - touch $(GCC_BUILD_DIR3)/.configured - -#$(TARGET_CONFIGURE_OPTS) \ - -$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured - $(MAKE) -C $(GCC_BUILD_DIR3) \ - CC_FOR_BUILD=$(HOSTCC) \ - CXX_FOR_BUILD=$(HOSTCC) \ - AR_FOR_TARGET=$(TARGET_CROSS)ar \ - AS_FOR_TARGET=$(TARGET_CROSS)as \ - LD_FOR_TARGET=$(TARGET_CROSS)ld \ - NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc \ - GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ - CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ - RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib - touch $(GCC_BUILD_DIR3)/.compiled - -$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled - $(MAKE) -C $(GCC_BUILD_DIR3) \ - CC_FOR_BUILD=$(HOSTCC) \ - CXX_FOR_BUILD=$(HOSTCC) \ - AR_FOR_TARGET=$(TARGET_CROSS)ar \ - AS_FOR_TARGET=$(TARGET_CROSS)as \ - LD_FOR_TARGET=$(TARGET_CROSS)ld \ - NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc \ - GCC_FOR_TARGET=$(TARGET_CROSS)gcc \ - CXX_FOR_TARGET=$(TARGET_CROSS)g++ \ - RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ - prefix=/usr \ - exec_prefix=/usr \ - bindir=/usr/bin \ - sbindir=/usr/sbin \ - libexecdir=/usr/lib \ - datadir=/usr/share \ - sysconfdir=/etc \ - localstatedir=/var \ - libdir=/usr/lib \ - infodir=/usr/info \ - mandir=/usr/man \ - includedir=/usr/include \ - DESTDIR=$(TARGET_DIR) install - (cd $(TARGET_DIR)/usr/bin; ln -fs gcc cc) - (cd $(TARGET_DIR)/lib; ln -fs /usr/bin/cpp) - rm -rf $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/include - rm -rf $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/sys-include - rm -rf $(TARGET_DIR)/usr/include/include $(TARGET_DIR)/usr/usr - #-cp -dpf $(STAGING_DIR)/lib/libgcc* $(TARGET_DIR)/lib/ - #-chmod a-x $(STAGING_DIR)/lib/*++* - #-cp -a $(STAGING_DIR)/lib/*++* $(TARGET_DIR)/lib/ - #-cp -a $(STAGING_DIR)/include/c++ $(TARGET_DIR)/usr/include/ - -mv $(TARGET_DIR)/lib/*.a $(TARGET_DIR)/usr/lib/ - -mv $(TARGET_DIR)/lib/*.la $(TARGET_DIR)/usr/lib/ - rm -f $(TARGET_DIR)/lib/libstdc++.so - -(cd $(TARGET_DIR)/usr/lib; ln -fs /lib/libstdc++.so.5.0.5 libstdc++.so) - # A nasty hack to work around g++ adding -lgcc_eh to the link - -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/3.3.1/ ; ln -s libgcc.a libgcc_eh.a) - -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) - rm -f $(TARGET_DIR)/usr/lib/*.la* - rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ - $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc - touch -c $(TARGET_DIR)/usr/bin/gcc - -gcc_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc - -gcc_target-clean: - rm -rf $(GCC_BUILD_DIR3) - rm -f $(TARGET_DIR)/bin/$(GNU_TARGET_NAME)* - -gcc_target-dirclean: - rm -rf $(GCC_BUILD_DIR3) - diff --git a/make/kernel-headers.mk b/make/kernel-headers.mk new file mode 100644 index 000000000..7eebee821 --- /dev/null +++ b/make/kernel-headers.mk @@ -0,0 +1,63 @@ +############################################################# +# +# Setup the kernel headers. I include a generic package of +# kernel headers here, so you shouldn't need to include your +# own. Be aware these kernel headers _will_ get blown away +# by a 'make clean' so don't put anything sacred in here... +# +############################################################# +ifneq ($(filter $(TARGETS),kernel-headers),) + +LINUX_SITE:=http://www.uclibc.org/downloads/toolchain +LINUX_SOURCE:=kernel-headers-2.4.21.tar.bz2 +LINUX_DIR:=$(BUILD_DIR)/linux + +LINUX_DIR=$(BUILD_DIR)/linux +# Used by pcmcia-cs and others +LINUX_SOURCE_DIR=$(LINUX_DIR) + +$(DL_DIR)/$(LINUX_SOURCE): + $(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE) + +$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) + bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(LINUX_DIR)/.unpacked + +$(LINUX_DIR)/.configured: $(LINUX_DIR)/.unpacked + rm -f $(LINUX_DIR)/include/asm + @if [ "$(ARCH)" = "powerpc" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-ppc$(NOMMU) asm;) \ + elif [ "$(ARCH)" = "mips" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-mips$(NOMMU) asm;) \ + elif [ "$(TARGET_ARCH)" = "mipsel" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-mips$(NOMMU) asm;) \ + elif [ "$(ARCH)" = "arm" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-arm$(NOMMU) asm; \ + cd asm; \ + if [ ! -L proc ] ; then \ + ln -fs proc-armv proc; \ + ln -fs arch-ebsa285 arch; fi); \ + elif [ "$(ARCH)" = "cris" ];then \ + (cd $(LINUX_DIR)/include; ln -fs asm-cris asm;) \ + else \ + (cd $(LINUX_DIR)/include; ln -fs asm-$(ARCH)$(NOMMU) asm;) \ + fi + touch $(LINUX_DIR)/include/linux/autoconf.h; + echo "#define UTS_RELEASE \"2.4.21\"" > $(LINUX_DIR)/include/linux/version.h; + echo "#define LINUX_VERSION_CODE 132117" >> $(LINUX_DIR)/include/linux/version.h; + echo "#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))" >> \ + $(LINUX_DIR)/include/linux/version.h; + touch $(LINUX_DIR)/.configured + +$(LINUX_KERNEL): $(LINUX_DIR)/.configured + +system-linux: $(LINUX_DIR)/.configured + +system-linux-clean: clean + rm -f $(LINUX_KERNEL) + rm -rf $(LINUX_DIR) + +system-linux-dirclean: + rm -rf $(LINUX_DIR) + +endif diff --git a/make/uclibc.mk b/make/uclibc.mk index 4821be5f7..4934b0a0b 100644 --- a/make/uclibc.mk +++ b/make/uclibc.mk @@ -3,26 +3,6 @@ # uClibc (the C library) # ############################################################# -# Copyright (C) 2001, 2002 by Erik Andersen <andersen@codepoet.org> -# Copyright (C) 2002 by Tim Riker <Tim@Rikers.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA - -ifeq ($(USE_UCLIBC_TOOLCHAIN),false) - ifeq ($(USE_UCLIBC_SNAPSHOT),true) # Be aware that this changes daily.... UCLIBC_DIR=$(BUILD_DIR)/uClibc @@ -33,64 +13,109 @@ UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.21 UCLIBC_SOURCE:=uClibc-0.9.21.tar.bz2 UCLIBC_SITE:=http://www.uclibc.org/downloads endif -#UCLIBC_PATCH=$(SOURCE_DIR)/uClibc.patch -ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) -LARGEFILE=true -else -LARGEFILE=false -endif $(DL_DIR)/$(UCLIBC_SOURCE): $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE) uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE) #$(UCLIBC_PATCH) -$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) #$(UCLIBC_PATCH) +$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf - touch $(UCLIBC_DIR)/.unpacked -$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked - perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCC=$(HOSTCC),g' $(UCLIBC_DIR)/Rules.mak +$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(BUILD_DIR)/linux/.configured + perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCROSS=$(TARGET_CROSS),g' \ + $(UCLIBC_DIR)/Rules.mak +ifeq ($(ENABLE_LOCALE),true) + cp $(SOURCE_DIR)/uClibc.config-locale $(UCLIBC_DIR)/.config +else cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config - perl -i -p -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' $(UCLIBC_DIR)/.config - perl -i -p -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"$(STAGING_DIR)\",g' $(UCLIBC_DIR)/.config - perl -i -p -e 's,^SYSTEM_DEVEL_PREFIX=.*,SYSTEM_DEVEL_PREFIX=\"$(STAGING_DIR)\",g' $(UCLIBC_DIR)/.config - perl -i -p -e 's,^DEVEL_TOOL_PREFIX=.*,DEVEL_TOOL_PREFIX=\"$(STAGING_DIR)/usr\",g' $(UCLIBC_DIR)/.config - perl -i -p -e 's,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH=\"/lib\",g' $(UCLIBC_DIR)/.config - perl -i -p -e 's,^GCC_BIN=.*,GCC_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc,g' $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile - perl -i -p -e 's,^LD_BIN=.*,LD_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ld,g' $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile +endif + perl -i -p -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \ + $(UCLIBC_DIR)/.config + perl -i -p -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"$(STAGING_DIR)\",g' \ + $(UCLIBC_DIR)/.config + perl -i -p -e 's,^SYSTEM_DEVEL_PREFIX=.*,SYSTEM_DEVEL_PREFIX=\"$(STAGING_DIR)\",g' \ + $(UCLIBC_DIR)/.config + perl -i -p -e 's,^DEVEL_TOOL_PREFIX=.*,DEVEL_TOOL_PREFIX=\"$(STAGING_DIR)/usr\",g' \ + $(UCLIBC_DIR)/.config + perl -i -p -e 's,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH=\"/lib\",g' \ + $(UCLIBC_DIR)/.config + perl -i -p -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' \ + $(UCLIBC_DIR)/.config + perl -i -p -e 's,^GCC_BIN.*,GCC_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc,g' \ + $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile + perl -i -p -e 's,^LD_BIN.*,LD_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ld,g' \ + $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile $(MAKE) -C $(UCLIBC_DIR) oldconfig + $(MAKE) -C $(UCLIBC_DIR) pregen + $(MAKE) -C $(UCLIBC_DIR) headers + $(MAKE) -C $(UCLIBC_DIR) install_dev; touch $(UCLIBC_DIR)/.configured $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(MAKE) -C $(UCLIBC_DIR) $(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a - $(MAKE) -C $(UCLIBC_DIR) install_dev install_runtime install_toolchain + $(MAKE) -C $(UCLIBC_DIR) install_dev install_runtime install_utils -$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc: $(STAGING_DIR)/lib/libc.a - $(MAKE) -C $(UCLIBC_DIR) install_toolchain - -$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc +ifneq ($(TARGET_DIR),) +$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a $(MAKE) -C $(UCLIBC_DIR) DEVEL_PREFIX=$(TARGET_DIR) \ SYSTEM_DEVEL_PREFIX=$(TARGET_DIR) \ - DEVEL_TOOL_PREFIX=$(TARGET_DIR)/usr \ - install_runtime + DEVEL_TOOL_PREFIX=$(TARGET_DIR)/usr install_runtime $(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0 $(MAKE) -C $(UCLIBC_DIR) PREFIX=$(TARGET_DIR) install_target_utils + (cd $(TARGET_DIR)/sbin; ln -sf /bin/true ldconfig) + +UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd +endif -uclibc: $(BUILD_DIR)/linux/.configured $(STAGING_DIR)/lib/libc.a \ - $(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd +uclibc-configured: $(UCLIBC_DIR)/.configured -uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE) +uclibc: $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc $(STAGING_DIR)/lib/libc.a \ + $(UCLIBC_TARGETS) uclibc-clean: - rm -f $(TARGET_DIR)/lib/libc.so.0 -$(MAKE) -C $(UCLIBC_DIR) clean rm -f $(UCLIBC_DIR)/.config uclibc-dirclean: rm -rf $(UCLIBC_DIR) -endif + + + +############################################################# +# +# uClibc for the target just needs its header files +# and whatnot installed. +# +############################################################# + +$(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/lib/libc.a + $(MAKE) DEVEL_PREFIX=$(TARGET_DIR)/usr SYSTEM_DEVEL_PREFIX=$(TARGET_DIR) \ + DEVEL_TOOL_PREFIX=$(TARGET_DIR) -C $(UCLIBC_DIR) \ + install_dev + #remove the extra copy of the shared libs + rm -f $(TARGET_DIR)/usr/lib/*-*.so + (cd $(TARGET_DIR)/usr/lib; \ + ln -fs /lib/libc.so.0 libc.so; \ + ln -fs /lib/libdl.so.0 libdl.so; \ + ln -fs /lib/libcrypt.so.0 libcrypt.so; \ + ln -fs /lib/libresolv.so.0 libresolv.so; \ + ln -fs /lib/libutil.so.0 libutil.so; \ + ln -fs /lib/libm.so.0 libm.so; \ + ln -fs /lib/libpthread.so.0 libpthread.so; \ + ln -fs /lib/libnsl.so.0 libnsl.so; \ + ) + +uclibc_target: gcc_final uclibc $(TARGET_DIR)/usr/lib/libc.a + +uclibc_target-clean: + rm -f $(TARGET_DIR)/include + +uclibc_target-dirclean: + rm -f $(TARGET_DIR)/include + diff --git a/make/uclibc_toolchain_2_95.mk b/make/uclibc_toolchain_2_95.mk deleted file mode 100644 index 279708df7..000000000 --- a/make/uclibc_toolchain_2_95.mk +++ /dev/null @@ -1,555 +0,0 @@ -# Makefile for to build a gcc/uClibc toolchain -# -# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -ifeq ($(USE_UCLIBC_TOOLCHAIN),true) -ifeq ($(GCC_2_95_TOOLCHAIN),true) - -############################################################# -# -# You should probably leave this stuff alone unless you are -# hacking on the toolchain... -# -############################################################# -#Directory in which to build the toolchain -TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH) - -TARGET_LANGUAGES:=c,c++ - -# If you want multilib enabled, enable this... -MULTILIB:=--enable-multilib - -############################################################# -# -# Where we can find things.... -# -# for various dependancy reasons, these need to live -# here at the top... Easier to find things here anyways... -# -############################################################# -BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils -BINUTILS_SOURCE:=binutils-2.14.90.0.5.tar.bz2 -BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.14.90.0.5 -BINUTILS_CAT:=bzcat - -ifeq ($(USE_UCLIBC_SNAPSHOT),true) -# Be aware that this changes daily.... -UCLIBC_DIR=$(BUILD_DIR)/uClibc -UCLIBC_SOURCE=uClibc-snapshot.tar.bz2 -UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots -else -UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.21 -UCLIBC_SOURCE:=uClibc-0.9.21.tar.bz2 -UCLIBC_SITE:=http://www.uclibc.org/downloads -endif - -GCC_SITE:=http://www.uclibc.org/downloads/toolchain -GCC_SOURCE:=gcc-20011006.tar.bz2 -GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-20011006 - -STLPORT_SITE=http://www.stlport.org/archive -STLPORT_SOURCE=STLport-4.5.3.tar.gz -STLPORT_DIR=$(TOOL_BUILD_DIR)/STLport-4.5.3 - - - -############################################################# -# -# Setup some initial paths -# -############################################################# -$(STAGING_DIR)/.setup: - mkdir -p $(TOOL_BUILD_DIR) - mkdir -p $(DL_DIR) - mkdir -p $(STAGING_DIR) - mkdir -p $(STAGING_DIR)/include - mkdir -p $(STAGING_DIR)/lib/gcc-lib - mkdir -p $(STAGING_DIR)/usr/lib - mkdir -p $(STAGING_DIR)/usr/bin; - mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/ - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../lib) - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include) - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include sys-include) - (cd $(STAGING_DIR)/usr/lib; ln -fs ../../lib/gcc-lib) - touch $(STAGING_DIR)/.setup - - -############################################################# -# -# Setup some initial stuff -# -############################################################# -ifeq ("$(TARGET_LANGUAGES)","c,c++") -STLPORT_TARGET=stlport -endif - -uclibc_toolchain: gcc_final - -uclibc_toolchain-source: $(DL_DIR)/$(BINUTILS_SOURCE) $(DL_DIR)/$(UCLIBC_SOURCE) \ - $(DL_DIR)/$(GCC_SOURCE) $(DL_DIR)/$(STLPORT_SOURCE) - -uclibc_toolchain-clean: gcc_final-clean uclibc-clean gcc_initial-clean binutils-clean - -uclibc_toolchain-dirclean: gcc_final-dirclean uclibc-dirclean gcc_initial-dirclean binutils-dirclean - - -############################################################# -# -# build binutils -# -############################################################# -BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-build -$(DL_DIR)/$(BINUTILS_SOURCE): - $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) - -$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) - $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - - touch $(BINUTILS_DIR)/.unpacked - -$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked - # Apply any files named binutils-*.patch from the source directory to binutils - $(SOURCE_DIR)/patch-kernel.sh $(BINUTILS_DIR) $(SOURCE_DIR) binutils-*.patch - # - # Hack binutils to use the correct default shared lib loader - # - (cd $(BINUTILS_DIR); perl -i -p -e "s,#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\",\ - #define ELF_DYNAMIC_INTERPRETER \"/lib/ld-uClibc.so.0\",;" \ - `grep -lr ELF_DYNAMIC_INTERPRETER *`); - touch $(BINUTILS_DIR)/.patched - -$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched - mkdir -p $(BINUTILS_DIR1) - (cd $(BINUTILS_DIR1); CC=$(HOSTCC) \ - CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - $(BINUTILS_DIR)/configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_HOST_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=$(STAGING_DIR) \ - --exec-prefix=$(STAGING_DIR) \ - --bindir=$(STAGING_DIR)/bin \ - --sbindir=$(STAGING_DIR)/sbin \ - --sysconfdir=$(STAGING_DIR)/etc \ - --datadir=$(STAGING_DIR)/share \ - --includedir=$(STAGING_DIR)/include \ - --libdir=$(STAGING_DIR)/lib \ - --localstatedir=$(STAGING_DIR)/var \ - --mandir=$(STAGING_DIR)/man \ - --infodir=$(STAGING_DIR)/info \ - --enable-targets=$(GNU_TARGET_NAME) \ - --with-sysroot=$(STAGING_DIR) \ - --with-lib-path="$(STAGING_DIR)/usr/lib:$(STAGING_DIR)/lib" \ - $(MULTILIB) \ - --program-prefix=$(ARCH)-uclibc-); - touch $(BINUTILS_DIR1)/.configured - -$(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured - $(MAKE) CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - -C $(BINUTILS_DIR1); - -$(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump - $(MAKE) CC_FOR_HOST=$(HOSTCC) \ - CXX_FOR_HOST=$(HOSTCC) \ - -C $(BINUTILS_DIR1) install; - rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ - $(STAGING_DIR)/share/locale - mkdir -p $(STAGING_DIR)/usr/bin; - set -e; \ - for app in addr2line ar as c++filt gprof ld nm objcopy \ - objdump ranlib readelf size strings strip ; \ - do \ - if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \ - (cd $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin; \ - ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ - ); \ - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ - ); \ - fi; \ - done; - -$(STAGING_DIR)/lib/libg.a: - mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin - $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ar rv $(STAGING_DIR)/lib/libg.a; - -binutils: $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld $(STAGING_DIR)/lib/libg.a - -binutils-clean: - rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* - -$(MAKE) -C $(BINUTILS_DIR1) clean - -binutils-dirclean: - rm -rf $(BINUTILS_DIR1) - - - - -############################################################# -# -# Next build first pass gcc compiler -# -############################################################# -GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-initial -$(DL_DIR)/$(GCC_SOURCE): - $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) - -$(GCC_DIR)/.unpacked: $(STAGING_DIR)/.setup $(DL_DIR)/$(GCC_SOURCE) - bzcat $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - - touch $(GCC_DIR)/.unpacked - -$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked - # Apply any files named gcc-*.patch from the source directory to gcc - $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc2.95-mega.patch.bz2 - touch $(GCC_DIR)/.patched - -$(GCC_DIR)/.gcc_build_hacks: $(GCC_DIR)/.patched - # - # Hack things to use the correct shared lib loader - # - (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\ - if [ -n "$$LIST" ] ; then \ - perl -i -p -e "s,-dynamic-linker.*\.so[\.0-9]*},\ - -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi); - # - # Prevent system glibc start files from leaking in uninvited... - # - perl -i -p -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\ - \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; - perl -i -p -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\ - \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; - # - # Prevent system glibc include files from leaking in uninvited... - # - perl -i -p -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ - $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; - perl -i -p -e "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ - $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; - perl -i -p -e "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ - \"$(STAGING_DIR)/include\",;" $(GCC_DIR)/gcc/cppdefault.h; - # - # Prevent system glibc libraries from being found by collect2 - # when it calls locatelib() and rummages about the system looking - # for libraries with the correct name... - # - perl -i -p -e "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c - perl -i -p -e "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c - # - # Prevent gcc from using the unwind-dw2-fde-glibc code - # - perl -i -p -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ - #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c; - # - # Use atexit() directly, rather than cxa_atexit - # - perl -i -p -e "s,int flag_use_cxa_atexit = 1;,int flag_use_cxa_atexit = 0;,g;"\ - $(GCC_DIR)/gcc/cp/decl2.c; - # - # We do not wish to build the libstdc++ library provided with gcc, - # since it doesn't seem to work at all with uClibc plus gcc 2.95... - # - mv $(GCC_DIR)/libstdc++ $(GCC_DIR)/libstdc++.orig - mv $(GCC_DIR)/libio $(GCC_DIR)/libio.orig - touch $(GCC_DIR)/.gcc_build_hacks - -# The --without-headers option stopped working with gcc 3.0 and has never been -# # fixed, so we need to actually have working C library header files prior to -# # the step or libgcc will not build... -$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc_build_hacks - mkdir -p $(GCC_BUILD_DIR1) - (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \ - RANLIB=$(TARGET_CROSS)ranlib CC=$(HOSTCC) \ - $(GCC_DIR)/configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_HOST_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=$(STAGING_DIR) \ - --exec-prefix=$(STAGING_DIR) \ - --bindir=$(STAGING_DIR)/bin \ - --sbindir=$(STAGING_DIR)/sbin \ - --sysconfdir=$(STAGING_DIR)/etc \ - --datadir=$(STAGING_DIR)/share \ - --includedir=$(STAGING_DIR)/include \ - --libdir=$(STAGING_DIR)/lib \ - --localstatedir=$(STAGING_DIR)/var \ - --mandir=$(STAGING_DIR)/man \ - --infodir=$(STAGING_DIR)/info \ - --with-local-prefix=$(STAGING_DIR)/usr/local \ - --oldincludedir=$(STAGING_DIR)/include $(MULTILIB) \ - --enable-target-optspace $(DISABLE_NLS) --with-gnu-ld \ - --disable-shared --enable-languages=c --disable-__cxa_atexit \ - $(EXTRA_GCC_CONFIG_OPTIONS) --program-prefix=$(ARCH)-uclibc-); - touch $(GCC_BUILD_DIR1)/.configured - -$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) \ - AR_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ar \ - RANLIB_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ranlib - touch $(GCC_BUILD_DIR1)/.compiled - -$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc: $(GCC_BUILD_DIR1)/.compiled - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install; - #Cleanup then mess when --program-prefix mysteriously fails - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-uclibc-cpp - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc - rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov - rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ - $(STAGING_DIR)/share/locale - -gcc_initial: binutils $(UCLIBC_DIR)/.configured $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc - -gcc_initial-clean: - rm -rf $(GCC_BUILD_DIR1) - rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* - -gcc_initial-dirclean: - rm -rf $(GCC_BUILD_DIR1) - - - -############################################################# -# -# uClibc is built in two stages. First, we install the uClibc -# include files so that gcc can be built. Later when gcc for -# the target arch has been compiled, we can actually compile -# uClibc for the target... -# -############################################################# -$(DL_DIR)/$(UCLIBC_SOURCE): - $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE) - -$(UCLIBC_DIR)/.unpacked: $(STAGING_DIR)/.setup $(DL_DIR)/$(UCLIBC_SOURCE) - bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf - - touch $(UCLIBC_DIR)/.unpacked - -$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(BUILD_DIR)/linux/.configured - perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCROSS=$(TARGET_CROSS),g' \ - $(UCLIBC_DIR)/Rules.mak - cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config - perl -i -p -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"$(STAGING_DIR)\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^SYSTEM_DEVEL_PREFIX=.*,SYSTEM_DEVEL_PREFIX=\"$(STAGING_DIR)\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^DEVEL_TOOL_PREFIX=.*,DEVEL_TOOL_PREFIX=\"$(STAGING_DIR)/usr\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH=\"/lib\",g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' \ - $(UCLIBC_DIR)/.config - perl -i -p -e 's,^GCC_BIN.*,GCC_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc,g' \ - $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile - perl -i -p -e 's,^LD_BIN.*,LD_BIN=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ld,g' \ - $(UCLIBC_DIR)/extra/gcc-uClibc/Makefile - $(MAKE) -C $(UCLIBC_DIR) oldconfig - $(MAKE) -C $(UCLIBC_DIR) headers install_dev; - touch $(UCLIBC_DIR)/.configured - -$(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured - $(MAKE) -C $(UCLIBC_DIR) - -$(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a - $(MAKE) -C $(UCLIBC_DIR) install_dev install_runtime install_utils - -ifneq ($(TARGET_DIR),) -$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a - $(MAKE) -C $(UCLIBC_DIR) DEVEL_PREFIX=$(TARGET_DIR) \ - SYSTEM_DEVEL_PREFIX=$(TARGET_DIR) \ - DEVEL_TOOL_PREFIX=$(TARGET_DIR)/usr install_runtime - -$(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0 - $(MAKE) -C $(UCLIBC_DIR) PREFIX=$(TARGET_DIR) install_target_utils - (cd $(TARGET_DIR)/sbin; ln -sf /bin/true ldconfig) - -UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd -endif - -uclibc: $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc $(STAGING_DIR)/lib/libc.a \ - $(UCLIBC_TARGETS) - -uclibc-clean: - -$(MAKE) -C $(UCLIBC_DIR) clean - rm -f $(UCLIBC_DIR)/.config - -uclibc-dirclean: - rm -rf $(UCLIBC_DIR) - - - - - -############################################################# -# -# STLport -- an alternative C++ library -# -############################################################# -STLPORT_PATCH=$(SOURCE_DIR)/STLport-4.5.3.patch -$(DL_DIR)/$(STLPORT_SOURCE): - $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE) - -$(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH) - zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - - cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1 - -$(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile - $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR) - -$(STAGING_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a - $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR) install -ifneq ($(HAS_MMU),true) - rm -f $(STAGING_DIR)/lib/libstdc++*.so* -endif - -stlport: $(STAGING_DIR)/lib/libstdc++.a - -stlport-clean: - rm -f $(STAGING_DIR)/lib/libstdc++* - rm -f $(STAGING_DIR)/include/c++* - -$(MAKE) -C $(STLPORT_DIR) clean - -stlport-dirclean: - rm -f $(STAGING_DIR)/lib/libstdc++* - rm -f $(STAGING_DIR)/include/g++-v3* - rm -rf $(STLPORT_DIR) - - - -############################################################# -# -# second pass compiler build. Build the compiler targeting -# the newly built shared uClibc library. -# -############################################################# -GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-final -$(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.patched - # - # Hack up the soname for libstdc++ - # - #perl -i -p -e "s,\.so\.1,.so.0.9.9,g;" $(GCC_DIR)/gcc/config/t-slibgcc-elf-ver; - #perl -i -p -e "s,-version-info.*[0-9]:[0-9]:[0-9],-version-info 9:9:0,g;" \ - # $(GCC_DIR)/libstdc++-v3/src/Makefile.am $(GCC_DIR)/libstdc++-v3/src/Makefile.in; - #perl -i -p -e "s,3\.0\.0,9.9.0,g;" $(GCC_DIR)/libstdc++-v3/acinclude.m4 \ - # $(GCC_DIR)/libstdc++-v3/aclocal.m4 $(GCC_DIR)/libstdc++-v3/configure; - # - # For now, we don't support locale-ified ctype (we will soon), - # so bypass that problem for now... - # - #perl -i -p -e "s,defined.*_GLIBCPP_USE_C99.*,1,g;" \ - # $(GCC_DIR)/libstdc++-v3/config/locale/generic/c_locale.cc; - #cp $(GCC_DIR)/libstdc++-v3/config/os/generic/bits/ctype_base.h \ - # $(GCC_DIR)/libstdc++-v3/config/os/gnu-linux/bits/ - #cp $(GCC_DIR)/libstdc++-v3/config/os/generic/bits/ctype_inline.h \ - # $(GCC_DIR)/libstdc++-v3/config/os/gnu-linux/bits/ - #cp $(GCC_DIR)/libstdc++-v3/config/os/generic/bits/ctype_noninline.h \ - # $(GCC_DIR)/libstdc++-v3/config/os/gnu-linux/bits/ - touch $(GCC_DIR)/.g++_build_hacks - -$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.g++_build_hacks - mkdir -p $(GCC_BUILD_DIR2) - (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \ - RANLIB=$(TARGET_CROSS)ranlib LD=$(TARGET_CROSS)ld \ - NM=$(TARGET_CROSS)nm CC=$(HOSTCC) \ - $(GCC_DIR)/configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_HOST_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=$(STAGING_DIR) \ - --exec-prefix=$(STAGING_DIR) \ - --bindir=$(STAGING_DIR)/bin \ - --sbindir=$(STAGING_DIR)/sbin \ - --sysconfdir=$(STAGING_DIR)/etc \ - --datadir=$(STAGING_DIR)/share \ - --localstatedir=$(STAGING_DIR)/var \ - --mandir=$(STAGING_DIR)/man \ - --infodir=$(STAGING_DIR)/info \ - --with-local-prefix=$(STAGING_DIR)/usr/local \ - --libdir=$(STAGING_DIR)/lib \ - --includedir=$(STAGING_DIR)/include \ - --with-gxx-include-dir=$(STAGING_DIR)/include/c++ \ - --oldincludedir=$(STAGING_DIR)/include \ - --enable-shared $(MULTILIB) \ - --enable-target-optspace $(DISABLE_NLS) \ - --with-gnu-ld --disable-__cxa_atexit \ - --enable-languages=$(TARGET_LANGUAGES) \ - $(EXTRA_GCC_CONFIG_OPTIONS) \ - --program-prefix=$(ARCH)-uclibc- \ - ); - touch $(GCC_BUILD_DIR2)/.configured - -$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured - PATH=$(TARGET_PATH) CC=$(HOSTCC) \ - AR_FOR_TARGET=$(TARGET_CROSS)ar RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \ - LD_FOR_TARGET=$(TARGET_CROSS)ld NM_FOR_TARGET=$(TARGET_CROSS)nm \ - CC_FOR_TARGET=$(TARGET_CROSS)gcc $(MAKE) -C $(GCC_BUILD_DIR2) - touch $(GCC_BUILD_DIR2)/.compiled - -$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled - touch $(GCC_BUILD_DIR2)/.installed - -$(STAGING_DIR)/bin/$(ARCH)-uclibc-g++: $(GCC_BUILD_DIR2)/.compiled - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install; - -mv $(STAGING_DIR)/bin/gcc $(STAGING_DIR)/usr/bin; - -mv $(STAGING_DIR)/bin/protoize $(STAGING_DIR)/usr/bin; - -mv $(STAGING_DIR)/bin/unprotoize $(STAGING_DIR)/usr/bin; - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-uclibc-cpp - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++ $(STAGING_DIR)/bin/$(ARCH)-uclibc-c++ - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-g++ $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++ - -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++filt $(STAGING_DIR)/bin/$(ARCH)-uclibc-c++filt - rm -f $(STAGING_DIR)/bin/cpp $(STAGING_DIR)/bin/gcov $(STAGING_DIR)/bin/*gccbug - rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-$(ARCH)-uclibc-* - rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \ - $(STAGING_DIR)/share/locale - # Strip the host binaries - -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/* - set -e; \ - for app in cc gcc c89 cpp c++ g++ ; do \ - if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \ - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \ - ); \ - fi; \ - done; - -gcc_final: $(STAGING_DIR)/.setup binutils gcc_initial uclibc \ - $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++ $(STLPORT_TARGET) - -gcc_final-clean: - rm -rf $(GCC_BUILD_DIR2) - rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)* - -gcc_final-dirclean: - rm -rf $(GCC_BUILD_DIR2) - - - -############################################################# -# -# Packup the toolchain binaries -# -############################################################# -$(ARCH)-uclibc-toolchain.tar.bz2: gcc_final - rm -f $(ARCH)-uclibc-toolchain.tar.bz2 - tar -cf $(ARCH)-uclibc-toolchain.tar $(STAGING_DIR) - bzip2 -9 $(ARCH)-uclibc-toolchain.tar - -tarball: $(ARCH)-uclibc-toolchain.tar.bz2 - -endif -endif diff --git a/sources/binutils-001-debian.patch b/sources/binutils-001-debian.patch new file mode 100644 index 000000000..97b8e7fde --- /dev/null +++ b/sources/binutils-001-debian.patch @@ -0,0 +1,185 @@ +--- binutils-2.11.90.0.19.orig/ld/Makefile.am ++++ binutils-2.11.90.0.19/ld/Makefile.am +@@ -19,7 +19,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- binutils-2.11.90.0.19.orig/ld/Makefile.in ++++ binutils-2.11.90.0.19/ld/Makefile.in +@@ -123,7 +123,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -urN binutils-2.11.90.0.27/gprof/gprof.texi binutils-2.11.90.0.27.new/gprof/gprof.texi +--- binutils-2.11.90.0.27/gprof/gprof.texi Tue Jun 19 14:57:58 2001 ++++ binutils-2.11.90.0.27.new/gprof/gprof.texi Mon Aug 27 10:27:23 2001 +@@ -137,6 +137,10 @@ + If more than one profile file is specified, the @code{gprof} + output shows the sum of the profile information in the given profile files. + ++If you use gcc 2.95.x or 3.0 to compile your binaries, you may need ++to add the @samp{-fprofile-arcs} to the compile command line in order ++for the call graphs to be properly stored in gmon.out. ++ + @code{Gprof} calculates the amount of time spent in each routine. + Next, these times are propagated along the edges of the call graph. + Cycles are discovered, and calls into a cycle are made to share the time +@@ -266,6 +270,11 @@ + to do the linking, simply specify @samp{-pg} in addition to your usual + options. The same option, @samp{-pg}, alters either compilation or linking + to do what is necessary for profiling. Here are examples: ++ ++If you use gcc 2.95.x or 3.0.x, you may need to add the ++@samp{-fprofile-arcs} option to the compile line along with @samp{-pg} ++in order to allow the call-graphs to be properly included in the gmon.out ++file. + + @example + cc -g -c myprog.c utils.c -pg +diff -urN binutils-2.11.92.0.5/bfd/opncls.c binutils-2.11.92.0.5.new/bfd/opncls.c +--- binutils-2.11.92.0.5/bfd/opncls.c Mon Oct 1 18:25:21 2001 ++++ binutils-2.11.92.0.5.new/bfd/opncls.c Sat Oct 13 11:26:59 2001 +@@ -127,6 +127,13 @@ + { + bfd *nbfd; + const bfd_target *target_vec; ++ struct stat s; ++ ++ if (stat (filename, &s) == 0) ++ if (S_ISDIR(s.st_mode)) { ++ bfd_set_error (bfd_error_file_not_recognized); ++ return NULL; ++ } + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) +diff -urN binutils-2.11.92.0.12.3/opcodes/i386-dis.c binutils-2.11.92.0.12.3.new/opcodes/i386-dis.c +--- binutils-2.11.92.0.12.3/opcodes/i386-dis.c Fri Nov 16 17:05:55 2001 ++++ binutils-2.11.92.0.12.3.new/opcodes/i386-dis.c Mon Dec 31 15:55:04 2001 +@@ -1830,7 +1830,7 @@ + * The function returns the length of this instruction in bytes. + */ + +-static char intel_syntax; ++static signed char intel_syntax; + static char open_char; + static char close_char; + static char separator_char; +diff -urN binutils-2.12.90.0.12/ld/emultempl/elf32.em binutils-2.12.90.0.12.new/ld/emultempl/elf32.em +--- binutils-2.12.90.0.12/ld/emultempl/elf32.em Wed Jun 19 00:41:59 2002 ++++ binutils-2.12.90.0.12.new/ld/emultempl/elf32.em Wed Jun 26 10:00:26 2002 +@@ -672,6 +672,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, + force)) + break; +@@ -867,6 +869,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf${ELFSIZE}_size_dynamic_sections + (output_bfd, command_line.soname, rpath, + command_line.filter_shlib, +diff -urN binutils-2.13.90.0.18/gprof/gprof.texi binutils-2.13.90.0.18.new/gprof/gprof.texi +--- binutils-2.13.90.0.18/gprof/gprof.texi 2003-02-02 18:29:09.000000000 -0500 ++++ binutils-2.13.90.0.18.new/gprof/gprof.texi 2003-02-02 18:28:37.000000000 -0500 +@@ -185,7 +185,7 @@ + @c man end + + @c man begin SEEALSO +-monitor(3), profil(2), cc(1), prof(1), and the Info entry for @file{gprof}. ++profil(2), cc(1), prof(1), and the Info entry for @file{gprof}. + + ``An Execution Profiler for Modular Programs'', + by S. Graham, P. Kessler, M. McKusick; +diff -urN binutils-2.13.90.0.10/opcodes/alpha-opc.c binutils-2.13.90.0.10.new/opcodes/alpha-opc.c +--- binutils-2.13.90.0.10/opcodes/alpha-opc.c 2002-03-07 14:52:40.000000000 -0500 ++++ binutils-2.13.90.0.10.new/opcodes/alpha-opc.c 2002-10-12 20:16:08.000000000 -0400 +@@ -1101,7 +1101,8 @@ + { "wmb", MFC(0x18,0x4400), BASE, ARG_NONE }, + { "fetch", MFC(0x18,0x8000), BASE, { ZA, PRB } }, + { "fetch_m", MFC(0x18,0xA000), BASE, { ZA, PRB } }, +- { "rpcc", MFC(0x18,0xC000), BASE, { RA } }, ++ { "rpcc", MFC(0x18,0xC000), BASE, { RA, ZB } }, ++ { "rpcc", MFC(0x18,0xC000), BASE, { RA, RB } }, /* ev6 una */ + { "rc", MFC(0x18,0xE000), BASE, { RA } }, + { "ecb", MFC(0x18,0xE800), BASE, { ZA, PRB } }, /* ev56 una */ + { "rs", MFC(0x18,0xF000), BASE, { RA } }, +--- binutils-2.13.90.0.18/bfd/elf64-alpha.c 2003-01-21 19:21:32.000000000 +0100 ++++ binutils-2.13.90.0.18-modif/bfd/elf64-alpha.c 2003-04-11 01:24:26.000000000 +0200 +@@ -4184,9 +4184,12 @@ + + loc = srel->contents; + loc += srel->reloc_count++ * sizeof (Elf64_External_Rela); +- bfd_elf64_swap_reloca_out (abfd, &outrel, loc); +- BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count +- <= srel->_cooked_size); ++ if (loc) ++ { ++ bfd_elf64_swap_reloca_out (abfd, &outrel, loc); ++ BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count ++ <= srel->_cooked_size); ++ } + } + + /* Relocate an Alpha ELF section for a relocatable link. +2003-05-23 H.J. Lu <hongjiu.lu@intel.com> + + * ltmain.sh: Make symlink for shared library if needed. + +opcodes/ + +2003-07-14 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in: Regenerated. + +2003-06-11 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in: Regenerated. + +2003-05-23 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.am (libopcodes_la_LIBADD): Use "-L../bfd -lbfd" + instead of "../bfd/libbfd.la". + * Makefile.in: Regenerated. + +--- binutils/ltmain.sh.dso 2002-03-22 00:16:20.000000000 -0800 ++++ binutils/ltmain.sh 2003-07-14 12:50:17.000000000 -0700 +@@ -4413,6 +4413,10 @@ relink_command=\"$relink_command\"" + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ++ if test -n "$linkname"; then ++ $show "(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)" ++ $run eval '(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)' || exit $? ++ fi + ;; + esac + exit 0 +--- binutils/opcodes/Makefile.am.dso 2003-06-11 07:18:04.000000000 -0700 ++++ binutils/opcodes/Makefile.am 2003-07-14 12:50:18.000000000 -0700 +@@ -283,7 +283,7 @@ disassemble.lo: disassemble.c $(INCDIR)/ + + libopcodes_la_SOURCES = dis-buf.c disassemble.c + libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la +-libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la ++libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd + libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ + + # libtool will build .libs/libopcodes.a. We create libopcodes.a in diff --git a/sources/binutils-001_ld_makefile.patch b/sources/binutils-001_ld_makefile.patch deleted file mode 100644 index c1d2ac1ec..000000000 --- a/sources/binutils-001_ld_makefile.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- binutils-2.11.90.0.19.orig/ld/Makefile.am -+++ binutils-2.11.90.0.19/ld/Makefile.am -@@ -19,7 +19,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ ---- binutils-2.11.90.0.19.orig/ld/Makefile.in -+++ binutils-2.11.90.0.19/ld/Makefile.in -@@ -123,7 +123,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ diff --git a/sources/binutils-002-uclibc.patch b/sources/binutils-002-uclibc.patch new file mode 100644 index 000000000..636a0ce1f --- /dev/null +++ b/sources/binutils-002-uclibc.patch @@ -0,0 +1,12 @@ +diff -urN binutils-2.13.90.0.14/bfd/configure binutils-2.13.90.0.14.new/bfd/configure +--- binutils-2.13.90.0.14/bfd/configure 2002-11-14 12:37:55.000000000 -0500 ++++ binutils-2.13.90.0.14.new/bfd/configure 2002-11-19 16:15:42.000000000 -0500 +@@ -1208,7 +1208,7 @@ + bfd_version_string="\"${VERSION}\"" + if test x${is_release} = x; then + bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h` +- bfd_version_string="\"${VERSION} ${bfd_version_date}\"" ++ bfd_version_string="\"${VERSION} ${bfd_version_date} uClibc\"" + fi + + diff --git a/sources/binutils-006_better_file_error.patch b/sources/binutils-006_better_file_error.patch deleted file mode 100644 index 38ef52966..000000000 --- a/sources/binutils-006_better_file_error.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -urN binutils-2.11.92.0.5/bfd/opncls.c binutils-2.11.92.0.5.new/bfd/opncls.c ---- binutils-2.11.92.0.5/bfd/opncls.c Mon Oct 1 18:25:21 2001 -+++ binutils-2.11.92.0.5.new/bfd/opncls.c Sat Oct 13 11:26:59 2001 -@@ -127,6 +127,13 @@ - { - bfd *nbfd; - const bfd_target *target_vec; -+ struct stat s; -+ -+ if (stat (filename, &s) == 0) -+ if (S_ISDIR(s.st_mode)) { -+ bfd_set_error (bfd_error_file_not_recognized); -+ return NULL; -+ } - - nbfd = _bfd_new_bfd (); - if (nbfd == NULL) diff --git a/sources/binutils-009_signed_char_fix.patch b/sources/binutils-009_signed_char_fix.patch deleted file mode 100644 index b3709dabe..000000000 --- a/sources/binutils-009_signed_char_fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN binutils-2.11.92.0.12.3/opcodes/i386-dis.c binutils-2.11.92.0.12.3.new/opcodes/i386-dis.c ---- binutils-2.11.92.0.12.3/opcodes/i386-dis.c Fri Nov 16 17:05:55 2001 -+++ binutils-2.11.92.0.12.3.new/opcodes/i386-dis.c Mon Dec 31 15:55:04 2001 -@@ -1830,7 +1830,7 @@ - * The function returns the length of this instruction in bytes. - */ - --static char intel_syntax; -+static signed char intel_syntax; - static char open_char; - static char close_char; - static char separator_char; diff --git a/sources/binutils-012_check_ldrunpath_length.patch b/sources/binutils-012_check_ldrunpath_length.patch deleted file mode 100644 index 5aa09abef..000000000 --- a/sources/binutils-012_check_ldrunpath_length.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -urN binutils-2.12.90.0.12/ld/emultempl/elf32.em binutils-2.12.90.0.12.new/ld/emultempl/elf32.em ---- binutils-2.12.90.0.12/ld/emultempl/elf32.em Wed Jun 19 00:41:59 2002 -+++ binutils-2.12.90.0.12.new/ld/emultempl/elf32.em Wed Jun 26 10:00:26 2002 -@@ -672,6 +672,8 @@ - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, - force)) - break; -@@ -867,6 +869,8 @@ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf${ELFSIZE}_size_dynamic_sections - (output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/sources/binutils-906-hjl_libtool_dso.patch b/sources/binutils-906-hjl_libtool_dso.patch deleted file mode 100644 index 3c60e1d9d..000000000 --- a/sources/binutils-906-hjl_libtool_dso.patch +++ /dev/null @@ -1,38 +0,0 @@ -http://sources.redhat.com/ml/binutils/2003-05/msg00739.html - -2003-05-23 H.J. Lu <hongjiu.lu@intel.com> - - * ltmain.sh: Make symlink for shared library if needed. - -opcodes/ - -2003-05-23 H.J. Lu <hongjiu.lu@intel.com> - - * Makefile.am (libopcodes_la_LIBADD): Use "-L../bfd -lbfd" - instead of "../bfd/libbfd.la". - * Makefile.in: Regenerated. - ---- binutils/ltmain.sh.dso 2002-03-22 00:16:20.000000000 -0800 -+++ binutils/ltmain.sh 2003-05-23 22:51:20.000000000 -0700 -@@ -4413,6 +4413,10 @@ relink_command=\"$relink_command\"" - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? -+ if test -n "$linkname"; then -+ $show "(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)" -+ $run eval '(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)' || exit $? -+ fi - ;; - esac - exit 0 ---- binutils/opcodes/Makefile.am.dso 2003-05-19 08:23:00.000000000 -0700 -+++ binutils/opcodes/Makefile.am 2003-05-23 22:46:29.000000000 -0700 -@@ -283,7 +283,7 @@ disassemble.lo: disassemble.c $(INCDIR)/ - - libopcodes_la_SOURCES = dis-buf.c disassemble.c - libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la --libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la -+libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd - libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ - - # libtool will build .libs/libopcodes.a. We create libopcodes.a in |