Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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
  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. CONFIG_STYLE:= manual
  14. BUILD_STYLE:= manual
  15. INSTALL_STYLE:= manual
  16. EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
  17. --host=$(REAL_GNU_TARGET_NAME) \
  18. --with-headers=$(STAGING_TARGET_DIR)/usr/include \
  19. --disable-nls \
  20. --without-cvs \
  21. --disable-profile \
  22. --disable-debug \
  23. --enable-kernel=2.6.0 \
  24. --without-gd \
  25. --with-__thread \
  26. --with-tls \
  27. --enable-add-ons
  28. EGLIBC_ENV:= PATH='${TARGET_PATH}' \
  29. GCC_HONOUR_COPTS=s \
  30. BUILD_CC=${CC_FOR_BUILD} \
  31. CFLAGS="$(TARGET_CFLAGS)" \
  32. CC=${REAL_GNU_TARGET_NAME}-gcc \
  33. CXX=${REAL_GNU_TARGET_NAME}-g++ \
  34. AR=${REAL_GNU_TARGET_NAME}-ar \
  35. RANLIB=${REAL_GNU_TARGET_NAME}-ranlib \
  36. libc_cv_forced_unwind=yes \
  37. libc_cv_c_cleanup=yes \
  38. libc_cv_gnu99_inline=yes \
  39. libc_cv_slibdir="/lib"
  40. # compile nothing, eglibc is already build in toolchain directory
  41. do-install:
  42. ifeq ($(ADK_LOCALES),y)
  43. ${INSTALL_DIR} $(IDIR_EGLIBC)/usr/bin
  44. $(CP) $(STAGING_TARGET_DIR)/usr/bin/locale $(IDIR_EGLIBC)/usr/bin
  45. endif
  46. ${INSTALL_DIR} $(IDIR_EGLIBC)/lib $(IDIR_EGLIBC)/etc \
  47. $(IDIR_EGLIBC)/usr/lib
  48. cd ${STAGING_TARGET_DIR} && for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
  49. test -s usr/share/zoneinfo/"$$f" || continue; \
  50. echo usr/share/zoneinfo/"$$f" | \
  51. ${TOOLS_DIR}/cpio -pdu ${IDIR_EGLIBC}/; \
  52. done
  53. tz=; cd ${IDIR_EGLIBC}/usr/share/zoneinfo || exit 1; \
  54. for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
  55. test -s "$$f" || continue; \
  56. tz=$$f; \
  57. done; if test x"$$tz" = x""; then \
  58. echo >&2 Error during timezone installation; \
  59. exit 1; \
  60. else \
  61. ln -sf "../usr/share/zoneinfo/$$tz" \
  62. ${IDIR_EGLIBC}/etc/localtime; \
  63. fi
  64. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  65. $(CP) $(STAGING_TARGET_DIR)/lib/libssp.so* $(IDIR_EGLIBC)/lib
  66. endif
  67. $(CP) $(STAGING_TARGET_DIR)/lib/ld* $(IDIR_EGLIBC)/lib
  68. -for file in libc libcrypt libdl libm libresolv librt libutil libnss_dns libnss_files; do \
  69. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_EGLIBC)/lib; \
  70. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_EGLIBC)/lib; \
  71. done
  72. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_EGLIBC}/etc
  73. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_EGLIBC}/etc
  74. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_EGLIBC}/etc
  75. eglibc-dev-install:
  76. ${INSTALL_DIR} $(IDIR_EGLIBC_DEV)/lib $(IDIR_EGLIBC_DEV)/usr/lib
  77. # install linker script
  78. -cp ./files/libc.so.$(ARCH) $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  79. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_EGLIBC_DEV}/usr/lib
  80. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_EGLIBC_DEV}/usr/lib
  81. -for file in libc libcrypt libdl libm libresolv librt libutil; do \
  82. cd $(IDIR_EGLIBC_DEV)/lib/; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  83. done
  84. # header package
  85. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  86. HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
  87. INSTALL_HDR_PATH=$(IDIR_EGLIBC_DEV)/usr \
  88. headers_install
  89. (cd $(WRKBUILD); \
  90. ${EGLIBC_ENV} \
  91. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/libc/configure \
  92. --prefix=$(IDIR_EGLIBC_DEV)/usr \
  93. --with-headers=$(IDIR_EGLIBC_DEV)/usr/include \
  94. ${EGLIBC_CONFOPTS} \
  95. );
  96. PATH='${TARGET_PATH}' $(MAKE) -C $(WRKBUILD) \
  97. install-headers install-bootstrap-headers=yes
  98. @touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs.h
  99. @find $(IDIR_EGLIBC_DEV) -name .install -exec rm {} \;
  100. @find $(IDIR_EGLIBC_DEV) -name ..install.cmd -exec rm {} \;
  101. # conflicts with libiconv
  102. find $(IDIR_EGLIBC_DEV) -name iconv.h -exec rm {} \;
  103. include ${TOPDIR}/mk/pkg-bottom.mk