toolchain: eliminate the INSTALL_LIBSTDCPP config symbol and make c++ support mandato...
[openwrt/svn-archive/archive.git] / package / libs / uclibc++ / Makefile
1 #
2 # Copyright (C) 2006-2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=uclibc++
11 PKG_VERSION:=0.2.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://cxx.uclibc.org/src/
16 PKG_MD5SUM:=394c119363dd8b469fb898442a6764b8
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
19 PKG_BUILD_PARALLEL:=1
20
21 PKG_INSTALL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/uclibcxx
26 NAME:=uclibc++
27 SECTION:=libs
28 CATEGORY:=Libraries
29 TITLE:=C++ library for embedded systems
30 URL:=http://cxx.uclibc.org/src/
31 endef
32
33 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
34 -e 's/i.86/i386/' \
35 -e 's/sparc.*/sparc/' \
36 -e 's/m68k.*/m68k/' \
37 -e 's/ppc/powerpc/g' \
38 -e 's/v850.*/v850/g' \
39 -e 's/sh64/sh/' \
40 -e 's/sh[234].*/sh/' \
41 -e 's/mips.*/mips/' \
42 -e 's/mipsel.*/mips/' \
43 -e 's/cris.*/cris/' \
44 )
45
46 TARGET_CFLAGS += $(FPIC)
47
48 ifneq ($(CONFIG_CCACHE),)
49 TARGET_CXX=$(TARGET_CXX_NOCACHE)
50 endif
51
52 MAKE_FLAGS:= \
53 TOPDIR="$(PKG_BUILD_DIR)/" \
54 $(TARGET_CONFIGURE_OPTS) \
55 CPU_CFLAGS="$(TARGET_CFLAGS)" \
56 CROSS="$(TARGET_CROSS)" \
57 CP="$(CP)" \
58 GEN_LIBS="-lc $(LIBGCC_S)" \
59 check_as_needed=
60
61 # check_as_needed overrides dependency on libgcc_s
62
63 define Build/Configure
64 if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \
65 cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \
66 else \
67 cp ./files/config.default $(PKG_BUILD_DIR)/.config; \
68 fi
69 endef
70
71 define Build/InstallDev
72 $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
73 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/
74 $(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/
75 $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/
76 $(SED) 's|-I/include/|-I$(STAGING_DIR)/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
77 $(SED) 's|-L/lib/|-L$(STAGING_DIR)/usr/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
78 # add another wrapper which links against both uClibc++ and libstdc++
79 $(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std
80 $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
81 $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
82 $(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
83 endef
84
85 define Package/uclibcxx/install
86 $(INSTALL_DIR) $(1)/usr/lib
87 $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/
88 $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/
89 endef
90
91 $(eval $(call BuildPackage,uclibcxx))