Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=uclibc++
  10. PKG_VERSION:=0.2.4
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2
  13. PKG_SOURCE_URL:=http://cxx.uclibc.org/src/
  14. PKG_MD5SUM:=394c119363dd8b469fb898442a6764b8
  15. PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
  16. PKG_BUILD_PARALLEL:=1
  17. PKG_USE_MIPS16:=0
  18. PKG_LICENSE:=LGPL-2.1+
  19. PKG_INSTALL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/uclibcxx
  22. NAME:=uclibc++
  23. SECTION:=libs
  24. CATEGORY:=Libraries
  25. TITLE:=C++ library for embedded systems
  26. URL:=http://cxx.uclibc.org/src/
  27. endef
  28. UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
  29. -e 's/i.86/i386/' \
  30. -e 's/sparc.*/sparc/' \
  31. -e 's/m68k.*/m68k/' \
  32. -e 's/ppc/powerpc/g' \
  33. -e 's/v850.*/v850/g' \
  34. -e 's/sh64/sh/' \
  35. -e 's/sh[234].*/sh/' \
  36. -e 's/mips.*/mips/' \
  37. -e 's/mipsel.*/mips/' \
  38. )
  39. TARGET_CFLAGS += $(FPIC)
  40. ifneq ($(CONFIG_CCACHE),)
  41. TARGET_CXX=$(TARGET_CXX_NOCACHE)
  42. endif
  43. ifeq ($(CONFIG_USE_MUSL),y)
  44. SSP_LIB=-lssp_nonshared
  45. endif
  46. MAKE_FLAGS:= \
  47. TOPDIR="$(PKG_BUILD_DIR)/" \
  48. $(TARGET_CONFIGURE_OPTS) \
  49. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  50. CROSS="$(TARGET_CROSS)" \
  51. LDFLAGS="-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,defs $(TARGET_LDFLAGS)" \
  52. CP="$(CP)" \
  53. GEN_LIBS="-lc $(LIBGCC_S) $(SSP_LIB)" \
  54. GEN_CFLAGS="-std=gnu++98 -nostdinc++" \
  55. check_as_needed=
  56. # check_as_needed overrides dependency on libgcc_s
  57. define Build/Prepare
  58. $(PKG_UNPACK)
  59. $(SED) 's/\r$$$$//' $(PKG_BUILD_DIR)/include/unwind-cxx.h
  60. $(Build/Patch)
  61. endef
  62. define Build/Configure
  63. if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \
  64. cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \
  65. else \
  66. cp ./files/config.default $(PKG_BUILD_DIR)/.config; \
  67. fi
  68. endef
  69. define Build/InstallDev
  70. $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
  71. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/
  72. $(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/
  73. $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/
  74. $(SED) 's!\(^\|[[:space:]]\)-[IL]$(TOOLCHAIN_DIR)/[^[:space:]]*!!g' $(TOOLCHAIN_DIR)/bin/g++-uc
  75. $(SED) 's|-I/include/|-I$$$${STAGING_DIR:-$(STAGING_DIR)}/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
  76. $(SED) 's|-L/lib/|-L$$$${STAGING_DIR:-$(STAGING_DIR)}/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
  77. # add another wrapper which links against both uClibc++ and libstdc++
  78. $(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std
  79. $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
  80. $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
  81. $(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
  82. endef
  83. define Package/uclibcxx/install
  84. $(INSTALL_DIR) $(1)/usr/lib
  85. $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/
  86. $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/
  87. endef
  88. $(eval $(call BuildPackage,uclibcxx))