allow to disable kernel module autoloading mechanism, useful when a big defconfig...
[openadk.git] / package / glibc / Makefile
blobadeff7f0746a9c36ab0a04e6c62945385fe53652
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(ADK_TOPDIR)/rules.mk
5 include $(ADK_TOPDIR)/mk/kernel-ver.mk
6 include $(ADK_TOPDIR)/mk/kernel-vars.mk
7 include $(ADK_TOPDIR)/toolchain/glibc/Makefile.inc
9 PKG_NAME:= glibc
10 PKG_DESCR:= gnu c library
11 PKG_SECTION:= base/libs
12 PKG_OPTS:= noremove nostaging noscripts
13 PKG_SUBPKGS:= GLIBC GLIBC_DEV GLIBC_GCONV
15 PKGSD_GLIBC_GCONV:= gconv libraries used at runtime
16 PKGSS_GLIBC_GCONV:= glibc
18 NO_DISTFILES:= 1
20 include $(ADK_TOPDIR)/mk/package.mk
22 $(eval $(call PKG_template,GLIBC,glibc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
23 $(eval $(call PKG_template,GLIBC_DEV,glibc-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
24 $(eval $(call PKG_template,GLIBC_GCONV,glibc-gconv,$(PKG_VERSION)-${PKG_RELEASE},${PKGSS_GLIBC_GCONV},${PKGSD_GLIBC_GCONV},${PKG_SECTION},${PKG_OPTS}))
26 XAKE_FLAGS+= GCC_HONOUR_COPTS=s
27 GLIBC_ENV:= PATH='${TARGET_PATH}' \
28 BUILD_CC=${CC_FOR_BUILD} \
29 CFLAGS="$(TARGET_CFLAGS)" \
30 CXXFLAGS="$(TARGET_CXXFLAGS)" \
31 CC="${TARGET_CC}" \
32 CXX="${TARGET_CXX}" \
33 AR="${TARGET_AR}" \
34 RANLIB="${TARGET_RANLIB}" \
35 GCC_HONOUR_COPTS=s \
36 libc_cv_forced_unwind=yes \
37 libc_cv_cc_with_libunwind=yes \
38 libc_cv_c_cleanup=yes \
39 libc_cv_gnu99_inline=yes \
40 libc_cv_initfini_array=yes
42 CONFIG_STYLE:= manual
43 BUILD_STYLE:= manual
44 INSTALL_STYLE:= manual
46 # compile nothing, glibc is already build in toolchain directory
47 do-install:
48 ifneq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
49 ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH)
50 $(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH)
51 for file in libc libpthread librt libcrypt libdl libm libnsl libresolv libutil libnss_dns libnss_files; do \
52 $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
53 $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
54 done
55 else
56 # libnss_* required at runtime even for static builds
57 ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH)
58 for file in libnss_dns libnss_files; do \
59 $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
60 $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
61 done
62 endif
63 ${INSTALL_DIR} $(IDIR_GLIBC)/usr/bin
64 $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_GLIBC)/usr/bin
65 ${INSTALL_DIR} ${IDIR_GLIBC}/etc
66 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
67 ${INSTALL_DATA} ./files/nsswitch.conf ${IDIR_GLIBC}/etc
69 glibc-gconv-install:
70 ${INSTALL_DIR} $(IDIR_GLIBC_GCONV)/usr/lib/gconv
71 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/usr/lib/gconv/gconv-modules \
72 $(IDIR_GLIBC_GCONV)/usr/lib/gconv
73 $(CP) ${STAGING_TARGET_DIR}/usr/lib/gconv/*.so \
74 $(IDIR_GLIBC_GCONV)/usr/lib/gconv
76 glibc-dev-install:
77 ${INSTALL_DIR} $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH) $(IDIR_GLIBC_DEV)/usr/lib
78 # install linker script
79 cp ./files/libc.so.$(ADK_TARGET_CPU_ARCH) $(IDIR_GLIBC_DEV)/usr/lib/libc.so
80 ifeq ($(ADK_TARGET_ABI_O32),y)
81 ifeq ($(ADK_TARGET_BIG_ENDIAN),y)
82 $(SED) "s#@@ELFTARGET@@#elf32-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
83 else
84 $(SED) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
85 endif
86 endif
87 ifeq ($(ADK_TARGET_ABI_N32),y)
88 ifeq ($(ADK_TARGET_BIG_ENDIAN),y)
89 $(SED) "s#@@ELFTARGET@@#elf32-ntradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
90 else
91 $(SED) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
92 endif
93 endif
94 ifeq ($(ADK_TARGET_ABI_N64),y)
95 ifeq ($(ADK_TARGET_BIG_ENDIAN),y)
96 $(SED) "s#@@ELFTARGET@@#elf64-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
97 else
98 $(SED) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
99 endif
100 endif
101 ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
102 ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
103 -for file in libpthread librt libcrypt libdl libm libresolv libutil; do \
104 cd $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH); ln -sf $$file-$(PKG_VERSION).so $$file.so; \
105 done
106 # header package
107 ${KERNEL_MAKE_ENV} \
108 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)/linux-$(KERNEL_FILE_VER) \
109 $(KERNEL_MAKE_OPTS) \
110 INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr \
111 headers_install
112 (cd $(WRKBUILD); \
113 $(GLIBC_ENV) \
114 $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \
115 --prefix=$(IDIR_GLIBC_DEV)/usr \
116 --with-sysroot=$(IDIR_GLIBC_DEV) \
117 ${GLIBC_CONFOPTS} \
119 $(GLIBC_ENV) $(MAKE) -C $(WRKBUILD) GCC_HONOUR_COPTS=s cross-compiling=yes install-headers
120 touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs.h
121 touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs-{32,x32,64}.h
122 touch $(IDIR_GLIBC_DEV)/usr/include/bits/stdio_lim.h
123 # WORKAROUND: bits/syscall.h is only installed via install-others target
124 $(CP) $(STAGING_TARGET_DIR)/usr/include/bits/syscall.h \
125 $(IDIR_GLIBC_DEV)/usr/include/bits
126 @find $(IDIR_GLIBC_DEV) -name .install -exec rm {} \;
128 include ${ADK_TOPDIR}/mk/pkg-bottom.mk