mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 00:14:05 +02:00
massive cleanup of toolchain/
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4038 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
1b14a20c70
commit
94266d6389
114
include/host-build.mk
Normal file
114
include/host-build.mk
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
ifneq ($(strip $(PKG_CAT)),)
|
||||||
|
ifeq ($(PKG_CAT),unzip)
|
||||||
|
UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||||
|
else
|
||||||
|
UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
|
||||||
|
endif
|
||||||
|
define Build/Prepare/Default
|
||||||
|
$(UNPACK)
|
||||||
|
@if [ -d ./patches ]; then \
|
||||||
|
$(PATCH) $(PKG_BUILD_DIR) ./patches; \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
$(call Build/Prepare/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure/Default
|
||||||
|
@(cd $(PKG_BUILD_DIR)/$(3); \
|
||||||
|
[ -x configure ] && \
|
||||||
|
$(2) \
|
||||||
|
CPPFLAGS="-I$(STAGING_DIR)/host/include" \
|
||||||
|
LDFLAGS="-L$(STAGING_DIR)/host/lib" \
|
||||||
|
./configure \
|
||||||
|
--target=$(GNU_TARGET_NAME) \
|
||||||
|
--host=$(GNU_TARGET_NAME) \
|
||||||
|
--build=$(GNU_HOST_NAME) \
|
||||||
|
--program-prefix="" \
|
||||||
|
--program-suffix="" \
|
||||||
|
--prefix=/usr \
|
||||||
|
--exec-prefix=/usr \
|
||||||
|
--bindir=/usr/bin \
|
||||||
|
--sbindir=/usr/sbin \
|
||||||
|
--libexecdir=/usr/lib \
|
||||||
|
--sysconfdir=/etc \
|
||||||
|
--datadir=/usr/share \
|
||||||
|
--localstatedir=/var \
|
||||||
|
--mandir=/usr/man \
|
||||||
|
--infodir=/usr/info \
|
||||||
|
$(DISABLE_NLS) \
|
||||||
|
$(1); \
|
||||||
|
true; \
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
$(call Build/Configure/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile/Default
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR) $(1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
$(call Build/Compile/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
ifneq ($(strip $(PKG_SOURCE)),)
|
||||||
|
source: $(DL_DIR)/$(PKG_SOURCE)
|
||||||
|
|
||||||
|
$(DL_DIR)/$(PKG_SOURCE):
|
||||||
|
mkdir -p $(DL_DIR)
|
||||||
|
$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
|
||||||
|
|
||||||
|
$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
define HostBuild
|
||||||
|
$(PKG_BUILD_DIR)/.prepared:
|
||||||
|
@-rm -rf $(PKG_BUILD_DIR)
|
||||||
|
@mkdir -p $(PKG_BUILD_DIR)
|
||||||
|
$(call Build/Prepare)
|
||||||
|
touch $$@
|
||||||
|
|
||||||
|
$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
|
||||||
|
$(call Build/Configure)
|
||||||
|
touch $$@
|
||||||
|
|
||||||
|
$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
|
||||||
|
$(call Build/Compile)
|
||||||
|
touch $$@
|
||||||
|
|
||||||
|
$(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
|
||||||
|
$(call Build/Install)
|
||||||
|
touch $$@
|
||||||
|
|
||||||
|
ifdef Build/Install
|
||||||
|
install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
|
||||||
|
endif
|
||||||
|
|
||||||
|
package-clean: FORCE
|
||||||
|
$(call Build/Clean)
|
||||||
|
$(call Build/Uninstall)
|
||||||
|
rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
|
||||||
|
|
||||||
|
source:
|
||||||
|
prepare: $(PKG_BUILD_DIR)/.prepared
|
||||||
|
configure: $(PKG_BUILD_DIR)/.configured
|
||||||
|
|
||||||
|
compile-targets: $(PKG_BUILD_DIR)/.built
|
||||||
|
compile: compile-targets
|
||||||
|
|
||||||
|
install-targets:
|
||||||
|
install: install-targets
|
||||||
|
|
||||||
|
clean-targets:
|
||||||
|
clean: FORCE
|
||||||
|
@$(MAKE) clean-targets
|
||||||
|
$(call Build/Clean)
|
||||||
|
rm -rf $(PKG_BUILD_DIR)
|
||||||
|
|
||||||
|
endef
|
@ -201,14 +201,15 @@ define BuildPackage
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
ifneq ($(strip $(PKG_CAT)),)
|
ifneq ($(strip $(PKG_CAT)),)
|
||||||
|
ifeq ($(PKG_CAT),unzip)
|
||||||
|
UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||||
|
else
|
||||||
|
UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
|
||||||
|
endif
|
||||||
define Build/Prepare/Default
|
define Build/Prepare/Default
|
||||||
@if [ "$(PKG_CAT)" = "unzip" ]; then \
|
$(UNPACK)
|
||||||
unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) ; \
|
|
||||||
else \
|
|
||||||
$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - ; \
|
|
||||||
fi
|
|
||||||
@if [ -d ./patches ]; then \
|
@if [ -d ./patches ]; then \
|
||||||
$(PATCH) $(PKG_BUILD_DIR) ./patches ; \
|
$(PATCH) $(PKG_BUILD_DIR) ./patches; \
|
||||||
fi
|
fi
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Main makefile for the toolchain
|
# Main makefile for the toolchain
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
TARGETS-y:=sed kernel-headers utils binutils gcc uClibc ipkg-utils libnotimpl squashfs jffs2 lzma
|
TARGETS-y:=sed kernel-headers sstrip binutils gcc uClibc ipkg-utils libnotimpl squashfs jffs2 lzma
|
||||||
TARGETS-$(CONFIG_GDB) += gdb
|
TARGETS-$(CONFIG_GDB) += gdb
|
||||||
|
|
||||||
TARGETS_DOWNLOAD:=$(patsubst %,%-source,$(TARGETS-y))
|
TARGETS_DOWNLOAD:=$(patsubst %,%-source,$(TARGETS-y))
|
||||||
@ -12,12 +12,13 @@ download: $(TARGETS_DOWNLOAD)
|
|||||||
install: $(TARGETS_INSTALL)
|
install: $(TARGETS_INSTALL)
|
||||||
clean: $(TARGETS_CLEAN)
|
clean: $(TARGETS_CLEAN)
|
||||||
|
|
||||||
uClibc-prepare: kernel-headers-prepare sed-install utils-install
|
kernel-headers-prepare: sed-install
|
||||||
|
uClibc-prepare: kernel-headers-prepare sstrip-install
|
||||||
binutils-prepare: uClibc-prepare
|
binutils-prepare: uClibc-prepare
|
||||||
gcc-prepare: binutils-install
|
gcc-prepare: binutils-install
|
||||||
uClibc-compile: gcc-prepare
|
uClibc-compile: gcc-compile
|
||||||
gcc-compile: uClibc-install
|
gcc-install: uClibc-install
|
||||||
squashfs-compile: lzma-compile
|
squashfs-compile: lzma-install
|
||||||
|
|
||||||
TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
|
TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
|
||||||
|
|
||||||
|
@ -1,105 +1,59 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
#############################################################
|
PKG_NAME:=binutils
|
||||||
#
|
PKG_VERSION:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))#"))
|
||||||
# build binutils for use on the host system
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
BINUTILS_VERSION:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))#"))
|
|
||||||
|
|
||||||
BINUTILS_SITE:=http://www.fr.kernel.org/pub/linux/devel/binutils \
|
STABLE_SITE:=http://ftp.gnu.org/gnu/binutils/ \
|
||||||
http://www.fi.kernel.org/pub/linux/devel/binutils \
|
|
||||||
http://ftp.kernel.org/pub/linux/devel/binutils \
|
|
||||||
http://www.de.kernel.org/pub/linux/devel/binutils
|
|
||||||
|
|
||||||
BINUTILS_STABLE_SITE:=http://ftp.gnu.org/gnu/binutils/ \
|
|
||||||
ftp://gatekeeper.dec.com/pub/GNU/ \
|
ftp://gatekeeper.dec.com/pub/GNU/ \
|
||||||
ftp://ftp.uu.net/archive/systems/gnu/ \
|
ftp://ftp.uu.net/archive/systems/gnu/ \
|
||||||
ftp://ftp.eu.uu.net/pub/gnu/ \
|
ftp://ftp.eu.uu.net/pub/gnu/ \
|
||||||
ftp://ftp.funet.fi/pub/gnu/prep/ \
|
ftp://ftp.funet.fi/pub/gnu/prep/ \
|
||||||
ftp://ftp.leo.org/pub/comp/os/unix/gnu/
|
ftp://ftp.leo.org/pub/comp/os/unix/gnu/
|
||||||
|
|
||||||
|
DEVEL_SITE:=http://www.fr.kernel.org/pub/linux/devel/binutils \
|
||||||
|
http://www.fi.kernel.org/pub/linux/devel/binutils \
|
||||||
|
http://ftp.kernel.org/pub/linux/devel/binutils \
|
||||||
|
http://www.de.kernel.org/pub/linux/devel/binutils
|
||||||
|
|
||||||
ifeq ($(BINUTILS_VERSION),2.16.1)
|
ifeq ($(BINUTILS_VERSION),2.16.1)
|
||||||
BINUTILS_SITE:=$(BINUTILS_STABLE_SITE)
|
PKG_SOURCE_URL:=$(STABLE_SITE)
|
||||||
|
else
|
||||||
|
PKG_SOURCE_URL:=$(DEVEL_SITE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
|
PKG_SOURCE:=binutils-$(PKG_VERSION).tar.bz2
|
||||||
BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
|
PKG_MD5SUM:=unknown
|
||||||
BINUTILS_CAT:=bzcat
|
PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
PKG_CAT:=bzcat
|
||||||
|
|
||||||
BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
|
include $(INCLUDE_DIR)/host-build.mk
|
||||||
|
|
||||||
$(DL_DIR)/$(BINUTILS_SOURCE):
|
|
||||||
mkdir -p $(DL_DIR)
|
|
||||||
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(BINUTILS_SOURCE) x $(BINUTILS_SITE)
|
|
||||||
|
|
||||||
$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
|
define Build/Prepare
|
||||||
mkdir -p $(TOOL_BUILD_DIR)
|
$(call Build/Prepare/Default)
|
||||||
$(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
|
if [ -d ./patches/$(PKG_VERSION) ]; then \
|
||||||
touch $(BINUTILS_DIR)/.unpacked
|
$(SCRIPT_DIR)/patch-kernel.sh $(PKG_BUILD_DIR) ./patches/$(PKG_VERSION); \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
|
define Build/Configure
|
||||||
# Apply appropriate binutils patches.
|
(cd $(PKG_BUILD_DIR); \
|
||||||
$(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.patch
|
./configure \
|
||||||
$(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
|
|
||||||
touch $(BINUTILS_DIR)/.patched
|
|
||||||
|
|
||||||
$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
|
|
||||||
mkdir -p $(BINUTILS_DIR1)
|
|
||||||
(cd $(BINUTILS_DIR1); \
|
|
||||||
$(BINUTILS_DIR)/configure \
|
|
||||||
--prefix=$(STAGING_DIR) \
|
--prefix=$(STAGING_DIR) \
|
||||||
--build=$(GNU_HOST_NAME) \
|
--build=$(GNU_HOST_NAME) \
|
||||||
--host=$(GNU_HOST_NAME) \
|
--host=$(GNU_HOST_NAME) \
|
||||||
--target=$(REAL_GNU_TARGET_NAME) \
|
--target=$(REAL_GNU_TARGET_NAME) \
|
||||||
--disable-werror \
|
--disable-werror \
|
||||||
$(DISABLE_NLS) \
|
--disable-nls \
|
||||||
$(MULTILIB) \
|
);
|
||||||
$(SOFT_FLOAT_CONFIG_OPTION) );
|
endef
|
||||||
touch $(BINUTILS_DIR1)/.configured
|
|
||||||
|
|
||||||
$(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
|
define Build/Compile
|
||||||
$(MAKE) -C $(BINUTILS_DIR1) -j $(CONFIG_JLEVEL) all
|
$(MAKE) -C $(PKG_BUILD_DIR) -j $(CONFIG_JLEVEL) all
|
||||||
|
endef
|
||||||
# Make install will put gettext data in staging_dir/share/locale.
|
|
||||||
# Unfortunatey, it isn't configureable.
|
|
||||||
$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
|
|
||||||
$(MAKE) -C $(BINUTILS_DIR1) -j $(CONFIG_JLEVEL) install
|
|
||||||
|
|
||||||
|
|
||||||
#############################################################
|
|
||||||
#
|
|
||||||
# build binutils for use on the target system
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
|
|
||||||
$(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
|
|
||||||
mkdir -p $(BINUTILS_DIR2)
|
|
||||||
(cd $(BINUTILS_DIR2); \
|
|
||||||
PATH=$(TARGET_PATH) \
|
|
||||||
CFLAGS="$(TARGET_CFLAGS)" \
|
|
||||||
CFLAGS_FOR_BUILD="-O2 -g" \
|
|
||||||
$(BINUTILS_DIR)/configure \
|
|
||||||
--prefix=/usr \
|
|
||||||
--exec-prefix=/usr \
|
|
||||||
--build=$(GNU_HOST_NAME) \
|
|
||||||
--host=$(REAL_GNU_TARGET_NAME) \
|
|
||||||
--target=$(REAL_GNU_TARGET_NAME) \
|
|
||||||
$(DISABLE_NLS) \
|
|
||||||
$(MULTILIB) \
|
|
||||||
$(SOFT_FLOAT_CONFIG_OPTION) );
|
|
||||||
touch $(BINUTILS_DIR2)/.configured
|
|
||||||
|
|
||||||
$(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
|
|
||||||
PATH=$(TARGET_PATH) \
|
|
||||||
$(MAKE) -C $(BINUTILS_DIR2) -j $(CONFIG_JLEVEL) all
|
|
||||||
|
|
||||||
source: $(DL_DIR)/$(BINUTILS_SOURCE)
|
|
||||||
prepare: $(BINUTILS_DIR)/.patched
|
|
||||||
compile: $(BINUTILS_DIR1)/binutils/objdump
|
|
||||||
install: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
|
|
||||||
clean: FORCE
|
|
||||||
rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
|
|
||||||
rm -rf $(BINUTILS_DIR) $(BINUTILS_DIR1)
|
|
||||||
|
|
||||||
|
define Build/Install
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR) -j $(CONFIG_JLEVEL) install
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call HostBuild))
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
|
# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
|
||||||
# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
|
# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
|
||||||
# Copyright (C) 2005 Felix Fietkau <openwrt@nbd.name>
|
# Copyright (C) 2005-2006 Felix Fietkau <nbd@openwrt.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -20,68 +20,36 @@
|
|||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
GCC_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
|
PKG_NAME:=gcc
|
||||||
|
PKG_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
|
||||||
|
|
||||||
#GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(GCC_VERSION)
|
PKG_SOURCE:=gcc-$(PKG_VERSION).tar.bz2
|
||||||
GCC_SITE:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(GCC_VERSION) \
|
PKG_MD5SUM:=unknown
|
||||||
http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(GCC_VERSION)
|
PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
|
||||||
|
http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
|
||||||
|
ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
|
||||||
|
PKG_CAT:=bzcat
|
||||||
|
|
||||||
GCC_SOURCE:=gcc-$(GCC_VERSION).tar.bz2
|
PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/gcc-$(PKG_VERSION)
|
||||||
GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)
|
|
||||||
GCC_CAT:=bzcat
|
|
||||||
|
|
||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Setup some initial stuff
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_INSTALL_LIBGCJ),y)
|
|
||||||
TARGET_LANGUAGES:=c,c++,java
|
|
||||||
else
|
|
||||||
ifeq ($(CONFIG_INSTALL_LIBSTDCPP),y)
|
|
||||||
TARGET_LANGUAGES:=c,c++
|
|
||||||
else
|
|
||||||
TARGET_LANGUAGES:=c
|
TARGET_LANGUAGES:=c
|
||||||
|
ifeq ($(CONFIG_INSTALL_LIBSTDCPP),y)
|
||||||
|
TARGET_LANGUAGES:=$(TARGET_LANGUAGES),c++
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_INSTALL_LIBGCJ),y)
|
||||||
|
TARGET_LANGUAGES:=$(TARGET_LANGUAGES),java
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#############################################################
|
include $(INCLUDE_DIR)/host-build.mk
|
||||||
#
|
|
||||||
# build the first pass gcc compiler
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-initial
|
BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(PKG_VERSION)-initial
|
||||||
|
BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-$(PKG_VERSION)-final
|
||||||
|
|
||||||
$(DL_DIR)/$(GCC_SOURCE):
|
|
||||||
mkdir -p $(DL_DIR)
|
|
||||||
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(GCC_SOURCE) x $(GCC_SITE)
|
|
||||||
|
|
||||||
$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
|
define Stage1/Configure
|
||||||
mkdir -p $(TOOL_BUILD_DIR)
|
mkdir -p $(BUILD_DIR1)
|
||||||
$(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
|
(cd $(BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \
|
||||||
touch $(GCC_DIR)/.unpacked
|
$(PKG_BUILD_DIR)/configure \
|
||||||
|
|
||||||
$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
|
|
||||||
# Apply any files named gcc-*.patch from the source directory to gcc
|
|
||||||
$(SCRIPT_DIR)/patch-kernel.sh $(GCC_DIR) ./$(GCC_VERSION) \*.patch
|
|
||||||
# Note: The soft float situation has improved considerably with gcc 3.4.x.
|
|
||||||
# We can dispense with the custom spec files, as well as libfloat for the arm case.
|
|
||||||
# However, we still need a patch for arm. There's a similar patch for gcc 3.3.x
|
|
||||||
# which needs to be integrated so we can kill of libfloat for good.
|
|
||||||
$(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(GCC_DIR)/gcc/version.c
|
|
||||||
$(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(GCC_DIR)/gcc/version.c
|
|
||||||
touch $(GCC_DIR)/.patched
|
|
||||||
|
|
||||||
# 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)/.patched
|
|
||||||
mkdir -p $(GCC_BUILD_DIR1)
|
|
||||||
(cd $(GCC_BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \
|
|
||||||
$(GCC_DIR)/configure \
|
|
||||||
--prefix=$(STAGING_DIR) \
|
--prefix=$(STAGING_DIR) \
|
||||||
--build=$(GNU_HOST_NAME) \
|
--build=$(GNU_HOST_NAME) \
|
||||||
--host=$(GNU_HOST_NAME) \
|
--host=$(GNU_HOST_NAME) \
|
||||||
@ -92,41 +60,25 @@ $(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
|
|||||||
--disable-__cxa_atexit \
|
--disable-__cxa_atexit \
|
||||||
--enable-target-optspace \
|
--enable-target-optspace \
|
||||||
--with-gnu-ld \
|
--with-gnu-ld \
|
||||||
$(DISABLE_NLS) \
|
--disable-nls \
|
||||||
$(MULTILIB) \
|
|
||||||
);
|
);
|
||||||
touch $(GCC_BUILD_DIR1)/.configured
|
endef
|
||||||
|
define Stage1/Compile
|
||||||
|
PATH=$(TARGET_PATH) $(MAKE) -C $(BUILD_DIR1) all-gcc
|
||||||
|
endef
|
||||||
|
define Stage1/Install
|
||||||
|
PATH=$(TARGET_PATH) $(MAKE) -C $(BUILD_DIR1) install-gcc
|
||||||
|
endef
|
||||||
|
|
||||||
$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
|
define Stage2/Configure
|
||||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc
|
mkdir -p $(BUILD_DIR2)
|
||||||
touch $(GCC_BUILD_DIR1)/.compiled
|
|
||||||
|
|
||||||
$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
|
|
||||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc
|
|
||||||
|
|
||||||
#############################################################
|
|
||||||
#
|
|
||||||
# second pass compiler build. Build the compiler targeting
|
|
||||||
# the newly built shared uClibc library.
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Sigh... I had to rework things because using --with-gxx-include-dir
|
|
||||||
# causes issues with include dir search order for g++. This seems to
|
|
||||||
# have something to do with "path translations" and possibly doesn't
|
|
||||||
# affect gcc-target. However, I haven't tested gcc-target yet so no
|
|
||||||
# guarantees. mjn3
|
|
||||||
|
|
||||||
GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-final
|
|
||||||
$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/lib/libc.a
|
|
||||||
mkdir -p $(GCC_BUILD_DIR2)
|
|
||||||
# Important! Required for limits.h to be fixed.
|
# Important! Required for limits.h to be fixed.
|
||||||
rm -rf $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
|
rm -rf $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
|
||||||
ln -sf ../include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
|
ln -sf ../include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
|
||||||
rm -rf $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
|
rm -rf $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
|
||||||
ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
|
ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
|
||||||
(cd $(GCC_BUILD_DIR2); rm -f config.cache; PATH=$(TARGET_PATH) \
|
(cd $(BUILD_DIR2); rm -f config.cache; PATH=$(TARGET_PATH) \
|
||||||
$(GCC_DIR)/configure \
|
$(PKG_BUILD_DIR)/configure \
|
||||||
--prefix=$(STAGING_DIR) \
|
--prefix=$(STAGING_DIR) \
|
||||||
--build=$(GNU_HOST_NAME) \
|
--build=$(GNU_HOST_NAME) \
|
||||||
--host=$(GNU_HOST_NAME) \
|
--host=$(GNU_HOST_NAME) \
|
||||||
@ -136,18 +88,15 @@ $(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/lib/libc.a
|
|||||||
--disable-__cxa_atexit \
|
--disable-__cxa_atexit \
|
||||||
--enable-target-optspace \
|
--enable-target-optspace \
|
||||||
--with-gnu-ld \
|
--with-gnu-ld \
|
||||||
$(DISABLE_NLS) \
|
--disable-nls \
|
||||||
$(MULTILIB) \
|
|
||||||
);
|
);
|
||||||
touch $(GCC_BUILD_DIR2)/.configured
|
endef
|
||||||
|
define Stage2/Compile
|
||||||
$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
|
PATH=$(TARGET_PATH) $(MAKE) -C $(BUILD_DIR2) all
|
||||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
|
endef
|
||||||
touch $(GCC_BUILD_DIR2)/.compiled
|
define Stage2/Install
|
||||||
|
PATH=$(TARGET_PATH) $(MAKE) -C $(BUILD_DIR2) install
|
||||||
gcc-install: $(GCC_BUILD_DIR2)/.compiled FORCE
|
echo $(PKG_VERSION) > $(STAGING_DIR)/gcc_version
|
||||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
|
|
||||||
echo $(GCC_VERSION) > $(STAGING_DIR)/gcc_version
|
|
||||||
# Set up the symlinks to enable lying about target name.
|
# Set up the symlinks to enable lying about target name.
|
||||||
set -e; \
|
set -e; \
|
||||||
(cd $(STAGING_DIR); \
|
(cd $(STAGING_DIR); \
|
||||||
@ -158,14 +107,36 @@ gcc-install: $(GCC_BUILD_DIR2)/.compiled FORCE
|
|||||||
$(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
|
$(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
|
||||||
done; \
|
done; \
|
||||||
);
|
);
|
||||||
|
endef
|
||||||
|
|
||||||
source: $(DL_DIR)/$(GCC_SOURCE)
|
define Build/Prepare
|
||||||
prepare: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc
|
$(call Build/Prepare/Default)
|
||||||
compile: gcc-install
|
$(SCRIPT_DIR)/patch-kernel.sh $(PKG_BUILD_DIR) ./patches/$(PKG_VERSION) \*.patch
|
||||||
install:
|
$(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(PKG_BUILD_DIR)/gcc/version.c
|
||||||
clean: gcc-clean
|
$(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(PKG_BUILD_DIR)/gcc/version.c
|
||||||
rm -rf $(GCC_DIR)
|
endef
|
||||||
rm -rf $(GCC_BUILD_DIR1)
|
|
||||||
rm -rf $(GCC_BUILD_DIR2)
|
define Build/Configure
|
||||||
|
$(call Stage1/Configure)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
$(call Stage1/Compile)
|
||||||
|
$(call Stage1/Install)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Install
|
||||||
|
$(call Stage2/Configure)
|
||||||
|
$(call Stage2/Compile)
|
||||||
|
$(call Stage2/Install)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Clean
|
||||||
|
rm -rf $(PKG_BUILD_DIR)
|
||||||
|
rm -rf $(BUILD_DIR1)
|
||||||
|
rm -rf $(BUILD_DIR2)
|
||||||
rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gc*
|
rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gc*
|
||||||
rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-c*
|
rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-c*
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call HostBuild))
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user