binutils: update to 2.43.1
[openadk.git] / package / glibc / Makefile
bloba36c30903bbbbe9cff5d36a55944bb89ff187284
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/$(ADK_TARGET_OS)-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 GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
27 --host=$(GNU_TARGET_NAME)
29 GLIBC_ENV:= PATH='${TARGET_PATH}' \
30 BUILD_CC='${CC_FOR_BUILD}' \
31 CFLAGS="$(TARGET_CFLAGS)" \
32 CXXFLAGS="$(TARGET_CXXFLAGS)" \
33 CC="${TARGET_CC}" \
34 CXX="${TARGET_CXX}" \
35 AR="${TARGET_AR}" \
36 RANLIB="${TARGET_RANLIB}" \
37 ARCH="${ADK_TARGET_KARCH}" \
38 libc_cv_forced_unwind=yes \
39 libc_cv_cc_with_libunwind=yes \
40 libc_cv_c_cleanup=yes \
41 libc_cv_gnu99_inline=yes \
42 libc_cv_initfini_array=yes
44 CONFIG_STYLE:= manual
45 BUILD_STYLE:= manual
46 INSTALL_STYLE:= manual
48 # compile nothing, glibc is already build in toolchain directory
49 do-install:
50 ifneq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
51 ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH)
52 $(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH)
53 for file in libc libpthread librt libdl libm libanl libnsl libresolv libutil libnss_dns libnss_files; do \
54 $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
55 done
56 else
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 done
61 endif
62 ${INSTALL_DIR} $(IDIR_GLIBC)/usr/bin
63 $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_GLIBC)/usr/bin
64 ${INSTALL_DIR} ${IDIR_GLIBC}/etc
65 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
66 ${INSTALL_DATA} ./files/nsswitch.conf ${IDIR_GLIBC}/etc
68 glibc-gconv-install:
69 ${INSTALL_DIR} $(IDIR_GLIBC_GCONV)/usr/lib/gconv
70 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/usr/lib/gconv/gconv-modules \
71 $(IDIR_GLIBC_GCONV)/usr/lib/gconv
72 $(CP) ${STAGING_TARGET_DIR}/usr/lib/gconv/*.so \
73 $(IDIR_GLIBC_GCONV)/usr/lib/gconv
75 glibc-dev-install:
76 ${INSTALL_DIR} $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH) $(IDIR_GLIBC_DEV)/usr/lib
77 ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc.so ${IDIR_GLIBC_DEV}/usr/lib
78 ifeq ($(ADK_TARGET_ABI_O32),y)
79 ifeq ($(ADK_TARGET_BIG_ENDIAN),y)
80 $(SED) "s#@@ELFTARGET@@#elf32-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
81 else
82 $(SED) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
83 endif
84 endif
85 ifeq ($(ADK_TARGET_ABI_N32),y)
86 ifeq ($(ADK_TARGET_BIG_ENDIAN),y)
87 $(SED) "s#@@ELFTARGET@@#elf32-ntradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
88 else
89 $(SED) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
90 endif
91 endif
92 ifeq ($(ADK_TARGET_ABI_N64),y)
93 ifeq ($(ADK_TARGET_BIG_ENDIAN),y)
94 $(SED) "s#@@ELFTARGET@@#elf64-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
95 else
96 $(SED) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
97 endif
98 endif
99 ifeq ($(ADK_TARGET_ARCH_RISCV64),y)
100 ${CP} ${STAGING_TARGET_DIR}/usr/lib/*/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
101 ${CP} ${STAGING_TARGET_DIR}/usr/lib/*/crt* ${IDIR_GLIBC_DEV}/usr/lib
102 else
103 ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
104 ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
105 endif
106 -for file in libpthread librt libcrypt libdl libm libresolv libutil; do \
107 cd $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH); ln -sf $$file-$(PKG_GLIBCVER).so $$file.so; \
108 done
109 # header package
110 ${KERNEL_MAKE} INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr headers_install
111 (cd $(WRKBUILD); \
112 $(GLIBC_ENV) \
113 $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \
114 --prefix=$(IDIR_GLIBC_DEV)/usr \
115 --with-sysroot=$(IDIR_GLIBC_DEV) \
116 ${GLIBC_CONFOPTS} \
118 $(GLIBC_ENV) $(MAKE) -C $(WRKBUILD) cross-compiling=yes install-headers
119 touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs.h
120 touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs-{32,x32,64}.h
121 touch $(IDIR_GLIBC_DEV)/usr/include/bits/stdio_lim.h
122 # WORKAROUND: bits/syscall.h is only installed via install-others target
123 $(CP) $(STAGING_TARGET_DIR)/usr/include/bits/syscall.h \
124 $(IDIR_GLIBC_DEV)/usr/include/bits
125 @find $(IDIR_GLIBC_DEV) -name .install -exec rm {} \;
127 include ${ADK_TOPDIR}/mk/pkg-bottom.mk