Makefile 4.1 KB

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