Makefile 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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
  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. eglibc-static-install:
  77. ${INSTALL_DIR} $(IDIR_EGLIBC_STATIC)/usr/lib
  78. $(CP) $(STAGING_TARGET_DIR)/usr/lib/libc.a $(IDIR_EGLIBC_STATIC)/usr/lib
  79. eglibc-dev-install:
  80. ${INSTALL_DIR} $(IDIR_EGLIBC_DEV)/lib $(IDIR_EGLIBC_DEV)/usr/lib
  81. # install linker script
  82. -cp ./files/libc.so.$(ARCH) $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  83. ifeq ($(ADK_TARGET_ABI_O32),y)
  84. $(SED) "s#@@ELFFORMAT@@#elf32-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  85. endif
  86. ifeq ($(ADK_TARGET_ABI_N32),y)
  87. $(SED) "s#@@ELFFORMAT@@#elf32-ntradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  88. endif
  89. ifeq ($(ADK_TARGET_ABI_N64),y)
  90. $(SED) "s#@@ELFFORMAT@@#elf64-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  91. endif
  92. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_EGLIBC_DEV}/usr/lib
  93. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_EGLIBC_DEV}/usr/lib
  94. -for file in libc libcrypt libdl libm libresolv librt libutil; do \
  95. cd $(IDIR_EGLIBC_DEV)/lib/; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  96. done
  97. # header package
  98. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  99. HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
  100. INSTALL_HDR_PATH=$(IDIR_EGLIBC_DEV)/usr \
  101. headers_install
  102. (cd $(WRKBUILD); \
  103. ${EGLIBC_ENV} \
  104. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/libc/configure \
  105. --prefix=$(IDIR_EGLIBC_DEV)/usr \
  106. --with-headers=$(IDIR_EGLIBC_DEV)/usr/include \
  107. ${EGLIBC_CONFOPTS} \
  108. );
  109. PATH='${TARGET_PATH}' $(MAKE) -C $(WRKBUILD) \
  110. install-headers install-bootstrap-headers=yes
  111. @touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs.h
  112. @find $(IDIR_EGLIBC_DEV) -name .install -exec rm {} \;
  113. @find $(IDIR_EGLIBC_DEV) -name ..install.cmd -exec rm {} \;
  114. # conflicts with libiconv
  115. find $(IDIR_EGLIBC_DEV) -name iconv.h -exec rm {} \;
  116. include ${TOPDIR}/mk/pkg-bottom.mk