diff options
author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2012-12-30 13:27:17 +0100 |
---|---|---|
committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2012-12-30 13:28:07 +0100 |
commit | e0e62489d251016be564422de37b43df94499b48 (patch) | |
tree | 51e8a767c89e49820454e4cc2bfa326d0daf54f5 | |
parent | 5c67312f3759cdba3c69b944480983fd6b9efe05 (diff) | |
download | embtoolkit-e0e62489d251016be564422de37b43df94499b48.tar.gz embtoolkit-e0e62489d251016be564422de37b43df94499b48.tar.bz2 embtoolkit-e0e62489d251016be564422de37b43df94499b48.tar.xz |
Toolchain: libc++: add needed libcxxrt infrastructure
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
-rw-r--r-- | kconfig/libc++/libcxxrt/libcxxrt.kconfig | 76 | ||||
-rw-r--r-- | mk/libc++/libcxxrt/Makefile | 121 | ||||
-rw-r--r-- | mk/libc++/libcxxrt/libcxxrt.mk | 57 |
3 files changed, 254 insertions, 0 deletions
diff --git a/kconfig/libc++/libcxxrt/libcxxrt.kconfig b/kconfig/libc++/libcxxrt/libcxxrt.kconfig new file mode 100644 index 0000000..218125e --- /dev/null +++ b/kconfig/libc++/libcxxrt/libcxxrt.kconfig @@ -0,0 +1,76 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE <awg@embtoolkit.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, see <http://www.gnu.org/licenses/>. +# +################################################################################ +# +# \file libcxxrt.kconfig +# \brief libcxxrt.kconfig of Embtoolkit +# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org> +# \date December 2012 +################################################################################ + +config EMTK_HAVE_LIBCXXRT + bool + default y + +# +# libcxxrt version +# +choice + prompt "Version of libcxxrt you wish" + help + Version of libcxxrt you wish + + config EMBTK_LIBCXXRT_VERSION_GIT + bool "Use libcxxrt git repository" + help + Answer Y here if you want to build your toolchain based on + libcxxrt sources from its GIT repository. +endchoice + +# +# GIT repository options +# +config EMBTK_LIBCXXRT_GIT_BRANCH + string "Branch to use" + default "master" + depends on EMBTK_LIBCXXRT_VERSION_GIT + help + The branch of the git repository to use, the default is master. + +config EMBTK_LIBCXXRT_GIT_REVISION + string "Checkout a specific revision instead of the latest" + depends on EMBTK_LIBCXXRT_VERSION_GIT + help + Chechout a specific revision instead of the latest. + +config EMBTK_LIBCXXRT_REFSPEC + string + default "toolchain" + +# +# Versions strings for tarball packages. +# +config EMBTK_LIBCXXRT_VERSION_STRING + string + default "git" if EMBTK_LIBCXXRT_VERSION_GIT + + +config EMBTK_LIBCXXRT_NEED_PATCH + bool +config EMBTK_LIBCXXRT_NEED_AUTORECONF + bool diff --git a/mk/libc++/libcxxrt/Makefile b/mk/libc++/libcxxrt/Makefile new file mode 100644 index 0000000..5b68712 --- /dev/null +++ b/mk/libc++/libcxxrt/Makefile @@ -0,0 +1,121 @@ +################################################################################ +# Copyright 2012 Abdoulaye Walsimou GAYE <awg@embtoolkit.org>. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +################################################################################ + +rootsrc ?= $(shell pwd) +LIBDIR ?= lib + +__NO_C_SRCS := $(addprefix $(rootsrc)/src/,cxa_atexit.c cxa_finalize.c) +C_SRCS := $(wildcard $(rootsrc)/src/*.c) +C_SRCS := $(filter-out $(__NO_C_SRCS),$(C_SRCS)) + +CXX_SRCS := $(wildcard $(rootsrc)/src/*.cc) + +__HEADERS := cxxabi.h unwind.h unwind-arm.h unwind-itanium.h +HEADERS := $(addprefix $(rootsrc)/src/,$(__HEADERS)) + +OBJS := $(patsubst %.c,%.o,$(C_SRCS)) +OBJS += $(patsubst %.cc,%.o,$(CXX_SRCS)) +POBJS := $(patsubst %.o,%.po,$(OBJS)) +SOBJS := $(patsubst %.o,%.So,$(OBJS)) + +LIB := cxxrt +SHAREDLIB := $(LIB) +SHAREDLIB_NAME := lib$(SHAREDLIB).so.1 +SHAREDLIB_LINK := lib$(SHAREDLIB).so +SHAREDLIB_SONAME := $(SHAREDLIB_NAME) + +CC ?= gcc +CXX ?= g++ + +override LDFLAGS := $(LDFLAGS) +override LDFLAGS += -Wl,--fatal-warnings -Wl,--warn-shared-textrel +override LDFLAGS += -shared -Wl,-x +LDADD := -ldl + +ARFLAGS := rvs + +override CFLAGS := $(CFLAGS) -I$(rootsrc)/src +override CXXFLAGS := $(CXXFLAGS) $(CFLAGS) + +define __lib_install + $(if $(SYSROOT), + mkdir -p $(SYSROOT)/$(LIBDIR) + mkdir -p $(SYSROOT)/usr + mkdir -p $(SYSROOT)/usr/include + mkdir -p $(SYSROOT)/usr/include/c++ + mkdir -p $(SYSROOT)/usr/include/c++/v1 + cp -d $(SHAREDLIB_NAME) $(SYSROOT)/$(LIBDIR)/ + cp -d $(SHAREDLIB_LINK) $(SYSROOT)/$(LIBDIR)/ + cp lib$(LIB).a $(SYSROOT)/$(LIBDIR)/ + cp lib$(LIB)_pic.a $(SYSROOT)/$(LIBDIR)/ + cp lib$(LIB)_p.a $(SYSROOT)/$(LIBDIR)/ + cp $(HEADERS) $(SYSROOT)/usr/include/c++/v1/) +endef + +all: lib$(LIB).a lib$(LIB)_p.a lib$(LIB)_pic.a $(SHAREDLIB_NAME) + $(Q)true + +install: all + $(Q)$(__lib_install) + $(Q)true + +$(SHAREDLIB_NAME): $(SOBJS) + $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ + -Wl,-soname,$(SHAREDLIB_SONAME) $(SOBJS) $(LDADD) + $(Q)ln -fs $(SHAREDLIB_NAME) $(SHAREDLIB_LINK) + +lib$(LIB).a: $(OBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(OBJS) + +lib$(LIB)_p.a: $(POBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(POBJS) + +lib$(LIB)_pic.a: $(SOBJS) + $(Q)$(AR) $(ARFLAGS) $@ $(SOBJS) + +%.o: %.c + $(Q)$(CC) $(CFLAGS) -c $< -o $@ + +%.o: %.cc + $(Q)$(CXX) $(CXXFLAGS) -c $< -o $@ + +%.po: %.c + $(Q)$(CC) $(CFLAGS) -pg -c $< -o $@ + +%.po: %.cc + $(Q)$(CXX) $(CXXFLAGS) -pg -c $< -o $@ + +%.So: %.c + $(Q)$(CC) -fPIC -DPIC $(CFLAGS) -c $< -o $@ + +%.So: %.cc + $(Q)$(CXX) $(CXXFLAGS) -fPIC -DPIC $(CXXFLAGS) -c $< -o $@ + +clean: + $(Q)rm -rf $(OBJS) $(SOBJS) $(POBJS) + $(Q)rm -rf lib$(LIB).a lib$(LIB)_p.a lib$(LIB)_pic.a + $(Q)rm -rf $(SHAREDLIB_NAME) $(SHAREDLIB_LINK) + diff --git a/mk/libc++/libcxxrt/libcxxrt.mk b/mk/libc++/libcxxrt/libcxxrt.mk new file mode 100644 index 0000000..9e440ce --- /dev/null +++ b/mk/libc++/libcxxrt/libcxxrt.mk @@ -0,0 +1,57 @@ +################################################################################ +# Embtoolkit +# Copyright(C) 2012 Abdoulaye Walsimou GAYE <awg@embtoolkit.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, see <http://www.gnu.org/licenses/>. +# +################################################################################ +# +# \file libcxxrt.mk +# \brief libcxxrt.mk of Embtoolkit +# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org> +# \date December 2012 +################################################################################ + +LIBCXXRT_NAME := libcxxrt +LIBCXXRT_VERSION := $(call embtk_get_pkgversion,libcxxrt) +LIBCXXRT_SITE := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror/$(LIBCXXRT_VERSION) +#LIBCXXRT_GIT_SITE := git://github.com/pathscale/libcxxrt.git +LIBCXXRT_GIT_SITE := git://www.embtoolkit.org/libcxxrt.git +LIBCXXRT_PACKAGE := libcxxrt-$(LIBCXXRT_VERSION).tar.bz2 +LIBCXXRT_SRC_DIR := $(embtk_toolsb)/libcxxrt-$(LIBCXXRT_VERSION) +LIBCXXRT_BUILD_DIR := $(call __embtk_pkg_srcdir,libcxxrt) + +LIBCXXRT_MAKE_OPTS := CC="$(TARGETCC)" CFLAGS="$(TARGET_CFLAGS)" +LIBCXXRT_MAKE_OPTS += CXX="$(TARGETCXX)" LIBDIR=$(LIBDIR) +LIBCXXRT_MAKE_OPTS += AR=$(TARGETAR) RANLIB=$(TARGETRANLIB) +LIBCXXRT_MAKE_OPTS += SYSROOT="$(embtk_sysroot)" + +define embtk_install_libcxxrt + $(call embtk_makeinstall_pkg,libcxxrt) +endef + +define embtk_beforeinstall_libcxxrt + ln -sf $(EMBTK_ROOT)/mk/libc++/libcxxrt/Makefile \ + $(LIBCXXRT_BUILD_DIR)/Makefile + ln -sf $(EMBTK_ROOT)/mk/libc++/libcxxrt/Version.map \ + $(LIBCXXRT_BUILD_DIR)/Version.map +endef + +define embtk_cleanup_libcxxrt + if [ -e $(LIBCXXRT_BUILD_DIR)/Makefile ]; then \ + $(MAKE) -C $(LIBCXXRT_BUILD_DIR) clean; \ + fi + rm -rf $(LIBCXXRT_BUILD_DIR)/Makefile + rm -rf $(LIBCXXRT_BUILD_DIR)/Version.map +endef |