b73e8bdd803f3fa2f2f3ec46c4f88eb34d7b90f3
[15.05/openwrt.git] / package / 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.3
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:=fd71a433ce1de85885d658f47885ab30
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 MAKE_FLAGS:= \
49         TOPDIR="$(PKG_BUILD_DIR)/" \
50         $(TARGET_CONFIGURE_OPTS) \
51         CPU_CFLAGS="$(TARGET_CFLAGS)" \
52         CROSS="$(TARGET_CROSS)" \
53         CP="$(CP)" \
54         GEN_LIBS="-lc $(LIBGCC_S)" \
55         check_as_needed=
56
57 # check_as_needed overrides dependency on libgcc_s
58
59 define Build/Configure
60         if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \
61                 cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \
62         else \
63                 cp ./files/config.default $(PKG_BUILD_DIR)/.config; \
64         fi
65 endef
66
67 define Build/InstallDev
68         $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
69         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(2)/bin/
70         $(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/
71         $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/
72         $(SED) 's|-I/include/|-I$(STAGING_DIR)/usr/include/uClibc++/|g' $(2)/bin/g++-uc
73         $(SED) 's|-L/lib/|-L$(STAGING_DIR)/usr/lib/|g' $(2)/bin/g++-uc
74 # add another wrapper which links against both uClibc++ and libstdc++ 
75         $(INSTALL_BIN) $(2)/bin/g++-uc $(2)/bin/g++-uc+std
76         $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(2)/bin/g++-uc+std
77         $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(2)/bin/g++-uc+std
78         $(SED) 's|-nostdinc++||g' $(2)/bin/g++-uc+std
79 endef
80
81 define Package/uclibcxx/install
82         $(INSTALL_DIR) $(1)/usr/lib
83         $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/
84         $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/
85 endef
86
87 $(eval $(call BuildPackage,uclibcxx))