Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 $(ADK_TOPDIR)/rules.mk
  4. include $(ADK_TOPDIR)/mk/kernel-ver.mk
  5. include $(ADK_TOPDIR)/mk/kernel-vars.mk
  6. include $(ADK_TOPDIR)/toolchain/glibc/Makefile.inc
  7. PKG_NAME:= glibc
  8. PKG_DESCR:= gnu c library
  9. PKG_SECTION:= base/libs
  10. PKG_OPTS:= noremove nostaging noscripts
  11. PKG_SUBPKGS:= GLIBC GLIBC_DEV GLIBC_GCONV
  12. PKGSD_GLIBC_GCONV:= gconv libraries used at runtime
  13. PKGSS_GLIBC_GCONV:= glibc
  14. NO_DISTFILES:= 1
  15. include $(ADK_TOPDIR)/mk/package.mk
  16. $(eval $(call PKG_template,GLIBC,glibc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  17. $(eval $(call PKG_template,GLIBC_DEV,glibc-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  18. $(eval $(call PKG_template,GLIBC_GCONV,glibc-gconv,$(PKG_VERSION)-${PKG_RELEASE},${PKGSS_GLIBC_GCONV},${PKGSD_GLIBC_GCONV},${PKG_SECTION},${PKG_OPTS}))
  19. XAKE_FLAGS+= GCC_HONOUR_COPTS=s
  20. CONFIG_STYLE:= manual
  21. BUILD_STYLE:= manual
  22. INSTALL_STYLE:= manual
  23. # compile nothing, glibc is already build in toolchain directory
  24. do-install:
  25. ifneq ($(ADK_TARGET_USE_STATIC_LIBS),y)
  26. ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH)
  27. $(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH)
  28. for file in libc libcrypt libdl libm libnsl libresolv libutil libnss_dns libnss_files; do \
  29. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
  30. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
  31. done
  32. else
  33. # libnss_* required at runtime even for static builds
  34. ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH)
  35. for file in libnss_dns libnss_files; do \
  36. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
  37. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
  38. done
  39. endif
  40. ${INSTALL_DIR} $(IDIR_GLIBC)/usr/bin
  41. $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_GLIBC)/usr/bin
  42. ${INSTALL_DIR} ${IDIR_GLIBC}/etc
  43. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
  44. ${INSTALL_DATA} ./files/nsswitch.conf ${IDIR_GLIBC}/etc
  45. glibc-gconv-install:
  46. ${INSTALL_DIR} $(IDIR_GLIBC_GCONV)/usr/lib/gconv
  47. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/usr/lib/gconv/gconv-modules \
  48. $(IDIR_GLIBC_GCONV)/usr/lib/gconv
  49. $(CP) ${STAGING_TARGET_DIR}/usr/lib/gconv/*.so \
  50. $(IDIR_GLIBC_GCONV)/usr/lib/gconv
  51. glibc-dev-install:
  52. ${INSTALL_DIR} $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH) $(IDIR_GLIBC_DEV)/usr/lib
  53. # install linker script
  54. cp ./files/libc.so.$(ADK_TARGET_CPU_ARCH) $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  55. ifeq ($(ADK_TARGET_ABI_O32),y)
  56. ifeq ($(ADK_big),y)
  57. $(SED) "s#@@ELFTARGET@@#elf32-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  58. else
  59. $(SED) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  60. endif
  61. endif
  62. ifeq ($(ADK_TARGET_ABI_N32),y)
  63. ifeq ($(ADK_big),y)
  64. $(SED) "s#@@ELFTARGET@@#elf32-ntradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  65. else
  66. $(SED) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  67. endif
  68. endif
  69. ifeq ($(ADK_TARGET_ABI_N64),y)
  70. ifeq ($(ADK_big),y)
  71. $(SED) "s#@@ELFTARGET@@#elf64-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  72. else
  73. $(SED) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  74. endif
  75. endif
  76. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
  77. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
  78. -for file in libcrypt libdl libm libresolv libutil; do \
  79. cd $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH); ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  80. done
  81. # header package
  82. ${KERNEL_MAKE_ENV} \
  83. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  84. $(KERNEL_MAKE_OPTS) \
  85. INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr \
  86. headers_install
  87. (cd $(WRKBUILD); \
  88. $(GLIBC_ENV) \
  89. GCC_HONOUR_COPTS=s \
  90. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \
  91. --prefix=$(IDIR_GLIBC_DEV)/usr \
  92. --with-sysroot=$(IDIR_GLIBC_DEV) \
  93. ${GLIBC_CONFOPTS} \
  94. );
  95. $(GLIBC_ENV) $(MAKE) -C $(WRKBUILD) cross-compiling=yes install-headers
  96. touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs.h
  97. touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs-{32,x32,64}.h
  98. touch $(IDIR_GLIBC_DEV)/usr/include/bits/stdio_lim.h
  99. # WORKAROUND: bits/syscall.h is only installed via install-others target
  100. $(CP) $(STAGING_TARGET_DIR)/usr/include/bits/syscall.h \
  101. $(IDIR_GLIBC_DEV)/usr/include/bits
  102. @find $(IDIR_GLIBC_DEV) -name .install -exec rm {} \;
  103. include ${ADK_TOPDIR}/mk/pkg-bottom.mk