Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/toolchain/eglibc/Makefile.inc
  5. PKG_DESCR:= embedded GNU C library
  6. PKG_SECTION:= base
  7. PKG_OPTS:= noremove
  8. PKG_SUBPKGS:= EGLIBC EGLIBC_DEV EGLIBC_STATIC
  9. NO_DISTFILES:= 1
  10. include $(TOPDIR)/mk/package.mk
  11. $(eval $(call PKG_template,EGLIBC,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  12. $(eval $(call PKG_template,EGLIBC_DEV,$(PKG_NAME)-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  13. $(eval $(call PKG_template,EGLIBC_STATIC,$(PKG_NAME)-static,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  14. CONFIG_STYLE:= manual
  15. BUILD_STYLE:= manual
  16. INSTALL_STYLE:= manual
  17. EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
  18. --host=$(REAL_GNU_TARGET_NAME) \
  19. --with-headers=$(STAGING_TARGET_DIR)/usr/include \
  20. --disable-nls \
  21. --without-cvs \
  22. --disable-profile \
  23. --disable-debug \
  24. --enable-kernel=2.6.0 \
  25. --without-gd \
  26. --with-__thread \
  27. --with-tls \
  28. --enable-add-ons
  29. EGLIBC_ENV:= PATH='${TARGET_PATH}' \
  30. GCC_HONOUR_COPTS=s \
  31. BUILD_CC=${CC_FOR_BUILD} \
  32. CFLAGS="$(TARGET_CFLAGS)" \
  33. CC=${REAL_GNU_TARGET_NAME}-gcc \
  34. CXX=${REAL_GNU_TARGET_NAME}-g++ \
  35. AR=${REAL_GNU_TARGET_NAME}-ar \
  36. RANLIB=${REAL_GNU_TARGET_NAME}-ranlib \
  37. libc_cv_forced_unwind=yes \
  38. libc_cv_c_cleanup=yes \
  39. libc_cv_gnu99_inline=yes \
  40. libc_cv_slibdir="/lib"
  41. # compile nothing, eglibc is already build in toolchain directory
  42. do-install:
  43. ifeq ($(ADK_LOCALES),y)
  44. ${INSTALL_DIR} $(IDIR_EGLIBC)/usr/bin
  45. $(CP) $(STAGING_TARGET_DIR)/usr/bin/locale $(IDIR_EGLIBC)/usr/bin
  46. endif
  47. ${INSTALL_DIR} $(IDIR_EGLIBC)/lib $(IDIR_EGLIBC)/etc \
  48. $(IDIR_EGLIBC)/usr/lib $(IDIR_EGLIBC)/usr/bin
  49. cd ${STAGING_TARGET_DIR} && for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
  50. test -s usr/share/zoneinfo/"$$f" || continue; \
  51. echo usr/share/zoneinfo/"$$f" | \
  52. ${TOOLS_DIR}/cpio -pdu ${IDIR_EGLIBC}/; \
  53. done
  54. tz=; cd ${IDIR_EGLIBC}/usr/share/zoneinfo || exit 1; \
  55. for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
  56. test -s "$$f" || continue; \
  57. tz=$$f; \
  58. done; if test x"$$tz" = x""; then \
  59. echo >&2 Error during timezone installation; \
  60. exit 1; \
  61. else \
  62. ln -sf "../usr/share/zoneinfo/$$tz" \
  63. ${IDIR_EGLIBC}/etc/localtime; \
  64. fi
  65. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  66. $(CP) $(STAGING_TARGET_DIR)/lib/libssp.so* $(IDIR_EGLIBC)/lib
  67. endif
  68. $(CP) $(STAGING_TARGET_DIR)/lib/ld* $(IDIR_EGLIBC)/lib
  69. -for file in libc libcrypt libdl libm libresolv librt libutil libnss_dns libnss_files; do \
  70. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_EGLIBC)/lib; \
  71. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_EGLIBC)/lib; \
  72. done
  73. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_EGLIBC}/etc
  74. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_EGLIBC}/etc
  75. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_EGLIBC}/etc
  76. $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_EGLIBC)/usr/bin
  77. eglibc-static-install:
  78. ${INSTALL_DIR} $(IDIR_EGLIBC_STATIC)/usr/lib
  79. $(CP) $(STAGING_TARGET_DIR)/usr/lib/libc.a $(IDIR_EGLIBC_STATIC)/usr/lib
  80. eglibc-dev-install:
  81. ${INSTALL_DIR} $(IDIR_EGLIBC_DEV)/lib $(IDIR_EGLIBC_DEV)/usr/lib
  82. # install linker script
  83. -cp ./files/libc.so.$(CPU_ARCH) $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  84. ifeq ($(ADK_TARGET_ABI_O32),y)
  85. $(SED) "s#@@ELFFORMAT@@#elf32-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  86. endif
  87. ifeq ($(ADK_TARGET_ABI_N32),y)
  88. $(SED) "s#@@ELFFORMAT@@#elf32-ntradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  89. endif
  90. ifeq ($(ADK_TARGET_ABI_N64),y)
  91. $(SED) "s#@@ELFFORMAT@@#elf64-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  92. endif
  93. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_EGLIBC_DEV}/usr/lib
  94. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_EGLIBC_DEV}/usr/lib
  95. -for file in libcrypt libdl libm libresolv librt libutil; do \
  96. cd $(IDIR_EGLIBC_DEV)/lib/; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  97. done
  98. # header package
  99. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  100. HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
  101. INSTALL_HDR_PATH=$(IDIR_EGLIBC_DEV)/usr \
  102. headers_install
  103. (cd $(WRKBUILD); \
  104. ${EGLIBC_ENV} \
  105. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/libc/configure \
  106. --prefix=$(IDIR_EGLIBC_DEV)/usr \
  107. --with-headers=$(IDIR_EGLIBC_DEV)/usr/include \
  108. ${EGLIBC_CONFOPTS} \
  109. );
  110. PATH='${TARGET_PATH}' $(MAKE) -C $(WRKBUILD) \
  111. install-headers install-bootstrap-headers=yes
  112. @touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs.h
  113. @find $(IDIR_EGLIBC_DEV) -name .install -exec rm {} \;
  114. @find $(IDIR_EGLIBC_DEV) -name ..install.cmd -exec rm {} \;
  115. # conflicts with libiconv
  116. find $(IDIR_EGLIBC_DEV) -name iconv.h -exec rm {} \;
  117. include ${TOPDIR}/mk/pkg-bottom.mk