| 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 | DEPENDS:=@INSTALL_LIBSTDCPP |
| 30 | TITLE:=C++ library for embedded systems |
| 31 | URL:=http://cxx.uclibc.org/src/ |
| 32 | endef |
| 33 | |
| 34 | UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \ |
| 35 | -e 's/i.86/i386/' \ |
| 36 | -e 's/sparc.*/sparc/' \ |
| 37 | -e 's/m68k.*/m68k/' \ |
| 38 | -e 's/ppc/powerpc/g' \ |
| 39 | -e 's/v850.*/v850/g' \ |
| 40 | -e 's/sh64/sh/' \ |
| 41 | -e 's/sh[234].*/sh/' \ |
| 42 | -e 's/mips.*/mips/' \ |
| 43 | -e 's/mipsel.*/mips/' \ |
| 44 | -e 's/cris.*/cris/' \ |
| 45 | ) |
| 46 | |
| 47 | TARGET_CFLAGS += $(FPIC) |
| 48 | |
| 49 | ifneq ($(CONFIG_CCACHE),) |
| 50 | TARGET_CXX=$(TARGET_CXX_NOCACHE) |
| 51 | endif |
| 52 | |
| 53 | MAKE_FLAGS:= \ |
| 54 | TOPDIR="$(PKG_BUILD_DIR)/" \ |
| 55 | $(TARGET_CONFIGURE_OPTS) \ |
| 56 | CPU_CFLAGS="$(TARGET_CFLAGS)" \ |
| 57 | CROSS="$(TARGET_CROSS)" \ |
| 58 | CP="$(CP)" \ |
| 59 | GEN_LIBS="-lc $(LIBGCC_S)" \ |
| 60 | check_as_needed= |
| 61 | |
| 62 | # check_as_needed overrides dependency on libgcc_s |
| 63 | |
| 64 | define Build/Configure |
| 65 | if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \ |
| 66 | cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \ |
| 67 | else \ |
| 68 | cp ./files/config.default $(PKG_BUILD_DIR)/.config; \ |
| 69 | fi |
| 70 | endef |
| 71 | |
| 72 | define Build/InstallDev |
| 73 | $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib |
| 74 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/ |
| 75 | $(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/ |
| 76 | $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/ |
| 77 | $(SED) 's|-I/include/|-I$(STAGING_DIR)/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc |
| 78 | $(SED) 's|-L/lib/|-L$(STAGING_DIR)/usr/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc |
| 79 | # add another wrapper which links against both uClibc++ and libstdc++ |
| 80 | $(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std |
| 81 | $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std |
| 82 | $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std |
| 83 | $(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std |
| 84 | endef |
| 85 | |
| 86 | define Package/uclibcxx/install |
| 87 | $(INSTALL_DIR) $(1)/usr/lib |
| 88 | $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/ |
| 89 | $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/ |
| 90 | endef |
| 91 | |
| 92 | $(eval $(call BuildPackage,uclibcxx)) |
| 93 | |