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