summaryrefslogtreecommitdiff
path: root/toolchain/llvm/libc++
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain/llvm/libc++')
-rw-r--r--toolchain/llvm/libc++/Makefile98
-rw-r--r--toolchain/llvm/libc++/libcxx.kconfig80
-rw-r--r--toolchain/llvm/libc++/libcxx.mk71
3 files changed, 249 insertions, 0 deletions
diff --git a/toolchain/llvm/libc++/Makefile b/toolchain/llvm/libc++/Makefile
new file mode 100644
index 0000000..da95cab
--- /dev/null
+++ b/toolchain/llvm/libc++/Makefile
@@ -0,0 +1,98 @@
+################################################################################
+# 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
+
+CXX_SRCS := $(wildcard $(rootsrc)/src/*.cpp)
+
+OBJS := $(patsubst %.cpp,%.o,$(CXX_SRCS))
+SOBJS := $(patsubst %.o,%.So,$(OBJS))
+
+__HEADERS := $(wildcard $(rootsrc)/include/*)
+HEADERS := $(filter-out $(rootsrc)/include/support,$(__HEADERS))
+
+CC ?= gcc
+CXX ?= g++
+
+LIB := c++
+SHAREDLIB := $(LIB)
+SHAREDLIB_NAME := lib$(SHAREDLIB).so.1
+SHAREDLIB_LINK := lib$(SHAREDLIB).so
+SHAREDLIB_SONAME := $(SHAREDLIB_NAME)
+
+override LDFLAGS := $(LDFLAGS) -shared -Wl,--warn-shared-textrel -Wl,-x
+
+override CXXFLAGS := $(CXXFLAGS) $(CFLAGS) -nostdinc++ -std=c++11
+override CPPFLAGS := $(CPPFLAGS) -I$(rootsrc)/include
+override CPPFLAGS += -DLIBCXXRT -DNO_CATGETS_SUPPORT
+
+LDADD := $(shell $(CC) --print-file-name=libcxxrt_pic.a)
+LDADD += -lpthread -lrt -ldl -lc
+
+ARFLAGS := rvs
+
+define __lib_install
+ $(if $(SYSROOT),
+ mkdir -p $(SYSROOT)/usr
+ mkdir -p $(SYSROOT)/usr/include
+ mkdir -p $(SYSROOT)/usr/include/c++
+ mkdir -p $(SYSROOT)/usr/include/c++/v1
+ cp -R $(HEADERS) $(SYSROOT)/usr/include/c++/v1
+ chmod 755 $(SYSROOT)/usr/include/c++/v1
+ chmod 644 $(SYSROOT)/usr/include/c++/v1/*
+ chmod 755 $(SYSROOT)/usr/include/c++/v1/ext
+ chmod 644 $(SYSROOT)/usr/include/c++/v1/ext/*
+ mkdir -p $(SYSROOT)/$(LIBDIR)
+ tar -cf - *.so* | tar -xf - -C $(SYSROOT)/$(LIBDIR)/
+ cp lib$(LIB)_nonshared.a $(SYSROOT)/usr/$(LIBDIR)/)
+endef
+
+all: lib$(LIB)_nonshared.a $(SHAREDLIB_NAME)
+ $(Q)true
+
+install: all
+ $(Q)$(__lib_install)
+ $(Q)true
+
+$(SHAREDLIB_NAME): $(SOBJS)
+ $(Q)$(CC) $(LDFLAGS) -o $@ \
+ -Wl,-soname,$(SHAREDLIB_SONAME) $(SOBJS) $(LDADD)
+ $(Q)ln -fs $(SHAREDLIB_NAME) $(SHAREDLIB_LINK)
+
+lib$(LIB)_nonshared.a: $(OBJS)
+ $(Q)$(AR) $(ARFLAGS) $@ $(OBJS)
+
+%.o: %.cpp
+ $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+%.So: %.cpp
+ $(Q)$(CXX) -fPIC $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+clean:
+ $(Q)rm -rf $(OBJS) $(SOBJS) lib$(LIB).a
+ $(Q)rm -rf $(SHAREDLIB_NAME) $(SHAREDLIB_LINK)
+
diff --git a/toolchain/llvm/libc++/libcxx.kconfig b/toolchain/llvm/libc++/libcxx.kconfig
new file mode 100644
index 0000000..6264a1f
--- /dev/null
+++ b/toolchain/llvm/libc++/libcxx.kconfig
@@ -0,0 +1,80 @@
+################################################################################
+# 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 libcxx.kconfig
+# \brief libcxx.kconfig of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date December 2012
+################################################################################
+
+config EMBTK_HAVE_LIBCXX
+ bool
+ default y
+ depends on EMBTK_CXXLIB_LLVM_LIBCXX
+ select KEMBTK_UCLIBC_UCLIBC_HAS_LOCALE if EMBTK_CLIB_UCLIBC
+ select KEMBTK_UCLIBC_UCLIBC_HAS_XLOCALE if EMBTK_CLIB_UCLIBC
+
+#
+# libcxx version
+#
+choice
+ prompt "Version of libcxx you wish"
+ depends on EMBTK_HAVE_LIBCXX
+ help
+ Version of libcxx you wish
+
+ config EMBTK_LIBCXX_VERSION_GIT
+ bool "Use libcxx git repository"
+ help
+ Answer Y here if you want to build your toolchain based on
+ libcxx sources from its GIT repository.
+endchoice
+
+#
+# GIT repository options
+#
+config EMBTK_LIBCXX_GIT_BRANCH
+ string "Branch to use"
+ default "master"
+ depends on EMBTK_LIBCXX_VERSION_GIT
+ help
+ The branch of the git repository to use, the default is master.
+
+config EMBTK_LIBCXX_GIT_REVISION
+ string "Checkout a specific revision instead of the latest"
+ depends on EMBTK_LIBCXX_VERSION_GIT
+ help
+ Chechout a specific revision instead of the latest.
+
+config EMBTK_LIBCXX_REFSPEC
+ string
+ default "toolchain"
+
+#
+# Versions strings for tarball packages.
+#
+config EMBTK_LIBCXX_VERSION_STRING
+ string
+ default "git" if EMBTK_LIBCXX_VERSION_GIT
+
+
+config EMBTK_LIBCXX_NEED_PATCH
+ bool
+config EMBTK_LIBCXX_NEED_AUTORECONF
+ bool
diff --git a/toolchain/llvm/libc++/libcxx.mk b/toolchain/llvm/libc++/libcxx.mk
new file mode 100644
index 0000000..c3e14af
--- /dev/null
+++ b/toolchain/llvm/libc++/libcxx.mk
@@ -0,0 +1,71 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2012-2014 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 libcxx.mk
+# \brief libcxx.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date December 2012
+################################################################################
+
+LIBCXX_NAME := libcxx
+LIBCXX_VERSION := $(call embtk_get_pkgversion,libcxx)
+LIBCXX_SITE := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror/$(LIBCXX_VERSION)
+#LIBCXX_GIT_SITE := http://llvm.org/git/libcxx.git
+LIBCXX_GIT_SITE := git://www.embtoolkit.org/libcxx.git
+LIBCXX_PACKAGE := libcxx-$(LIBCXX_VERSION).tar.bz2
+LIBCXX_SRC_DIR := $(embtk_toolsb)/libcxx-$(LIBCXX_VERSION)
+LIBCXX_BUILD_DIR := $(call __embtk_pkg_srcdir,libcxx)
+
+LIBCXX_KEEP_SRC_DIR := y
+
+LIBCXX_DEPS := libcxxrt_install
+
+__embtk_libcxx_cflags := $(TARGET_CFLAGS)
+__embtk_libcxx_cflags += -I$(embtk_sysroot)/usr/include/c++/v1
+
+LIBCXX_MAKE_OPTS := CC="$(TARGETCC)" CFLAGS="$(__embtk_libcxx_cflags)"
+LIBCXX_MAKE_OPTS += CXX="$(TARGETCXX)" LIBDIR=$(LIBDIR)
+LIBCXX_MAKE_OPTS += AR=$(TARGETAR) RANLIB=$(TARGETRANLIB)
+LIBCXX_MAKE_OPTS += SYSROOT="$(embtk_sysroot)"
+
+define embtk_install_libcxx
+ $(call embtk_makeinstall_pkg,libcxx)
+endef
+
+define embtk_beforeinstall_libcxx
+ ln -sf $(EMBTK_ROOT)/mk/libc++/libc++/Makefile \
+ $(LIBCXX_BUILD_DIR)/Makefile
+endef
+
+__embtk_staticlibcxx := $(embtk_sysroot)/usr/$(LIBDIR)/libc++.a
+define __embtk_postinstall_staticlibcxx
+ (echo "GROUP(libc++_nonshared.a libcxxrt.a libpthread.a librt.a libdl.a)" \
+ > $(__embtk_staticlibcxx))
+endef
+
+define embtk_postinstallonce_libcxx
+ $(__embtk_postinstall_staticlibcxx)
+endef
+
+define embtk_cleanup_libcxx
+ if [ -e $(LIBCXXRT_BUILD_DIR)/Makefile ]; then \
+ $(MAKE) -C $(LIBCXXRT_BUILD_DIR) clean; \
+ fi
+ rm -rf $(LIBCXXRT_BUILD_DIR)/Makefile
+endef