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
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 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)" \
34 RANLIB
="${TARGET_RANLIB}" \
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
44 INSTALL_STYLE
:= manual
46 # compile nothing, glibc is already build in toolchain directory
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
); \
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
); \
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
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
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
84 $(SED
) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_GLIBC_DEV
)/usr
/lib
/libc.so
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
91 $(SED
) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_GLIBC_DEV
)/usr
/lib
/libc.so
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
98 $(SED
) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_GLIBC_DEV
)/usr
/lib
/libc.so
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
; \
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 \
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
) \
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