1
0

Makefile 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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/glibc/Makefile.inc
  5. PKG_DESCR:= GNU C library
  6. PKG_SECTION:= base
  7. PKG_OPTS:= noremove
  8. PKG_SUBPKGS:= GLIBC GLIBC_DEV
  9. NO_DISTFILES:= 1
  10. include $(TOPDIR)/mk/package.mk
  11. $(eval $(call PKG_template,GLIBC,glibc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  12. $(eval $(call PKG_template,GLIBC_DEV,glibc-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. # compile nothing, glibc is already build in toolchain directory
  17. do-install:
  18. ${INSTALL_DIR} $(IDIR_GLIBC)/lib $(IDIR_GLIBC)/etc
  19. cd ${STAGING_TARGET_DIR} && for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
  20. test -s usr/share/zoneinfo/"$$f" || continue; \
  21. echo usr/share/zoneinfo/"$$f" | \
  22. ${TOOLS_DIR}/cpio -pdu ${IDIR_GLIBC}/; \
  23. done
  24. tz=; cd ${IDIR_GLIBC}/usr/share/zoneinfo || exit 1; \
  25. for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
  26. test -s "$$f" || continue; \
  27. tz=$$f; \
  28. done; if test x"$$tz" = x""; then \
  29. echo >&2 Error during timezone installation; \
  30. exit 1; \
  31. else \
  32. ln -sf "../usr/share/zoneinfo/$$tz" \
  33. ${IDIR_GLIBC}/etc/localtime; \
  34. fi
  35. ${CP} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
  36. ${CP} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_GLIBC}/etc
  37. ${CP} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_GLIBC}/etc
  38. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  39. $(CP) $(STAGING_TARGET_DIR)/lib/libssp.so* $(IDIR_GLIBC)/lib
  40. endif
  41. $(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/lib
  42. -for file in libc libcrypt libdl libm libresolv librt libutil libnss_compat libnss_dns libnss_files; do \
  43. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/lib; \
  44. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/lib; \
  45. done
  46. glibc-dev-install:
  47. ${INSTALL_DIR} $(IDIR_GLIBC_DEV)/lib $(IDIR_GLIBC_DEV)/usr/lib
  48. # install linker script
  49. -cp ./files/libc.so.$(ARCH) $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  50. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
  51. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
  52. -for file in libc libcrypt libdl libm libresolv librt libutil; do \
  53. cd $(IDIR_GLIBC_DEV)/lib; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  54. done
  55. # header package
  56. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  57. HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
  58. INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr \
  59. headers_install
  60. (cd $(WRKBUILD); \
  61. $(GLIBC_ENV) \
  62. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \
  63. --prefix=$(IDIR_GLIBC_DEV)/usr \
  64. --with-sysroot=$(IDIR_GLIBC_DEV) \
  65. ${GLIBC_CONFOPTS} \
  66. );
  67. $(GLIBC_ENV) $(MAKE) -C $(WRKBUILD) cross-compiling=yes install-headers
  68. touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs.h
  69. touch $(IDIR_GLIBC_DEV)/usr/include/bits/stdio_lim.h
  70. # WORKAROUND: bits/syscall.h is only installed via install-others target
  71. $(CP) $(STAGING_TARGET_DIR)/usr/include/bits/syscall.h \
  72. $(IDIR_GLIBC_DEV)/usr/include/bits
  73. @find $(IDIR_GLIBC_DEV) -name .install -exec rm {} \;
  74. include ${TOPDIR}/mk/pkg-bottom.mk