add getconf
[openadk.git] / package / eglibc / Makefile
blob0378d6200873d21f039a815cd98f16332ba3a904
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 $(TOPDIR)/rules.mk
5 include $(TOPDIR)/toolchain/eglibc/Makefile.inc
7 PKG_DESCR:= embedded GNU C library
8 PKG_SECTION:= base
9 PKG_OPTS:= noremove
10 PKG_SUBPKGS:= EGLIBC EGLIBC_DEV EGLIBC_STATIC
12 NO_DISTFILES:= 1
14 include $(TOPDIR)/mk/package.mk
16 $(eval $(call PKG_template,EGLIBC,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
17 $(eval $(call PKG_template,EGLIBC_DEV,$(PKG_NAME)-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
18 $(eval $(call PKG_template,EGLIBC_STATIC,$(PKG_NAME)-static,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
20 CONFIG_STYLE:= manual
21 BUILD_STYLE:= manual
22 INSTALL_STYLE:= manual
24 EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
25 --host=$(REAL_GNU_TARGET_NAME) \
26 --with-headers=$(STAGING_TARGET_DIR)/usr/include \
27 --disable-nls \
28 --without-cvs \
29 --disable-profile \
30 --disable-debug \
31 --enable-kernel=2.6.0 \
32 --without-gd \
33 --with-__thread \
34 --with-tls \
35 --enable-add-ons
37 EGLIBC_ENV:= PATH='${TARGET_PATH}' \
38 GCC_HONOUR_COPTS=s \
39 BUILD_CC=${CC_FOR_BUILD} \
40 CFLAGS="$(TARGET_CFLAGS)" \
41 CC=${REAL_GNU_TARGET_NAME}-gcc \
42 CXX=${REAL_GNU_TARGET_NAME}-g++ \
43 AR=${REAL_GNU_TARGET_NAME}-ar \
44 RANLIB=${REAL_GNU_TARGET_NAME}-ranlib \
45 libc_cv_forced_unwind=yes \
46 libc_cv_c_cleanup=yes \
47 libc_cv_gnu99_inline=yes \
48 libc_cv_slibdir="/lib"
50 # compile nothing, eglibc is already build in toolchain directory
51 do-install:
52 ifeq ($(ADK_LOCALES),y)
53 ${INSTALL_DIR} $(IDIR_EGLIBC)/usr/bin
54 $(CP) $(STAGING_TARGET_DIR)/usr/bin/locale $(IDIR_EGLIBC)/usr/bin
55 endif
56 ${INSTALL_DIR} $(IDIR_EGLIBC)/lib $(IDIR_EGLIBC)/etc \
57 $(IDIR_EGLIBC)/usr/lib $(IDIR_EGLIBC)/usr/bin
58 cd ${STAGING_TARGET_DIR} && for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
59 test -s usr/share/zoneinfo/"$$f" || continue; \
60 echo usr/share/zoneinfo/"$$f" | \
61 ${TOOLS_DIR}/cpio -pdu ${IDIR_EGLIBC}/; \
62 done
63 tz=; cd ${IDIR_EGLIBC}/usr/share/zoneinfo || exit 1; \
64 for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
65 test -s "$$f" || continue; \
66 tz=$$f; \
67 done; if test x"$$tz" = x""; then \
68 echo >&2 Error during timezone installation; \
69 exit 1; \
70 else \
71 ln -sf "../usr/share/zoneinfo/$$tz" \
72 ${IDIR_EGLIBC}/etc/localtime; \
74 ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
75 $(CP) $(STAGING_TARGET_DIR)/lib/libssp.so* $(IDIR_EGLIBC)/lib
76 endif
77 $(CP) $(STAGING_TARGET_DIR)/lib/ld* $(IDIR_EGLIBC)/lib
78 -for file in libc libcrypt libdl libm libresolv librt libutil libnss_dns libnss_files; do \
79 $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_EGLIBC)/lib; \
80 $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_EGLIBC)/lib; \
81 done
82 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_EGLIBC}/etc
83 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_EGLIBC}/etc
84 ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_EGLIBC}/etc
85 $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_EGLIBC)/usr/bin
87 eglibc-static-install:
88 ${INSTALL_DIR} $(IDIR_EGLIBC_STATIC)/usr/lib
89 $(CP) $(STAGING_TARGET_DIR)/usr/lib/libc.a $(IDIR_EGLIBC_STATIC)/usr/lib
91 eglibc-dev-install:
92 ${INSTALL_DIR} $(IDIR_EGLIBC_DEV)/lib $(IDIR_EGLIBC_DEV)/usr/lib
93 # install linker script
94 -cp ./files/libc.so.$(CPU_ARCH) $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
95 ifeq ($(ADK_TARGET_ABI_O32),y)
96 $(SED) "s#@@ELFFORMAT@@#elf32-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
97 endif
98 ifeq ($(ADK_TARGET_ABI_N32),y)
99 $(SED) "s#@@ELFFORMAT@@#elf32-ntradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
100 endif
101 ifeq ($(ADK_TARGET_ABI_N64),y)
102 $(SED) "s#@@ELFFORMAT@@#elf64-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
103 endif
104 ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_EGLIBC_DEV}/usr/lib
105 ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_EGLIBC_DEV}/usr/lib
106 -for file in libcrypt libdl libm libresolv librt libutil; do \
107 cd $(IDIR_EGLIBC_DEV)/lib/; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
108 done
109 # header package
110 $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
111 HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
112 INSTALL_HDR_PATH=$(IDIR_EGLIBC_DEV)/usr \
113 headers_install
114 (cd $(WRKBUILD); \
115 ${EGLIBC_ENV} \
116 $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/libc/configure \
117 --prefix=$(IDIR_EGLIBC_DEV)/usr \
118 --with-headers=$(IDIR_EGLIBC_DEV)/usr/include \
119 ${EGLIBC_CONFOPTS} \
121 PATH='${TARGET_PATH}' $(MAKE) -C $(WRKBUILD) \
122 install-headers install-bootstrap-headers=yes
123 @touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs.h
124 @find $(IDIR_EGLIBC_DEV) -name .install -exec rm {} \;
125 @find $(IDIR_EGLIBC_DEV) -name ..install.cmd -exec rm {} \;
126 # conflicts with libiconv
127 find $(IDIR_EGLIBC_DEV) -name iconv.h -exec rm {} \;
129 include ${TOPDIR}/mk/pkg-bottom.mk