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
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
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)" \
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
46 INSTALL_STYLE
:= manual
48 # compile nothing, glibc is already build in toolchain directory
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
); \
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
); \
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
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
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
82 $(SED
) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_GLIBC_DEV
)/usr
/lib
/libc.so
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
89 $(SED
) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_GLIBC_DEV
)/usr
/lib
/libc.so
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
96 $(SED
) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_GLIBC_DEV
)/usr
/lib
/libc.so
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
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
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
; \
110 ${KERNEL_MAKE} INSTALL_HDR_PATH
=$(IDIR_GLIBC_DEV
)/usr headers_install
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
) \
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