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