summaryrefslogtreecommitdiff
path: root/package/glibc/Makefile
blob: 9655288a680586f356d96e6ce2124781db7ed7a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

include $(TOPDIR)/rules.mk

TARGET_CFLAGS:=	$(filter-out -fstack-protector,$(TARGET_CFLAGS))
TARGET_CFLAGS:=	$(filter-out -flto,$(TARGET_CFLAGS))

include $(TOPDIR)/toolchain/glibc/Makefile.inc

PKG_DESCR:=		GNU C library
PKG_VER:=		2.16
PKG_SECTION:=		base
PKG_OPTS:=		noremove
PKG_SUBPKGS:=		GLIBC GLIBC_DEV

NO_DISTFILES:=		1

include $(TOPDIR)/mk/package.mk

$(eval $(call PKG_template,GLIBC,glibc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
$(eval $(call PKG_template,GLIBC_DEV,glibc-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))

TARGET_CFLAGS:=	$(filter-out -fstack-protector,$(TARGET_CFLAGS))
TARGET_CFLAGS:=	$(filter-out -flto,$(TARGET_CFLAGS))
XAKE_FLAGS+=		GCC_HONOUR_COPTS=s

CONFIG_STYLE:=		manual
BUILD_STYLE:=		manual
INSTALL_STYLE:=		manual

# compile nothing, glibc is already build in toolchain directory
do-install:
	${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH) ${IDIR_GLIBC}/etc
	${CP} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
	${CP} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_GLIBC}/etc
	${CP} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_GLIBC}/etc
ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
	$(CP) $(STAGING_TARGET_DIR)/lib/libssp.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH)
endif
	$(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH)
	for file in libc libcrypt libdl libm libnsl libresolv libutil libnss_compat libnss_dns libnss_files; do \
		$(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
		$(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VER).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
	done

glibc-dev-install:
	echo $(TARGET_CFLAGS)
	${INSTALL_DIR} $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH) $(IDIR_GLIBC_DEV)/usr/lib
	# install linker script
	-cp ./files/libc.so.$(CPU_ARCH) $(IDIR_GLIBC_DEV)/usr/lib/libc.so
	${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
	${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
	-for file in libcrypt libdl libm libresolv libutil; do \
		cd $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH); ln -sf $$file-$(PKG_VER).so $$file.so; \
	done
	# header package
	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
		HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
		INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr \
		headers_install
	(cd $(WRKBUILD); \
		$(GLIBC_ENV) \
		GCC_HONOUR_COPTS=s \
		$(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \
			--prefix=$(IDIR_GLIBC_DEV)/usr \
			--with-sysroot=$(IDIR_GLIBC_DEV) \
			${GLIBC_CONFOPTS} \
	);
	$(GLIBC_ENV) $(MAKE) -C $(WRKBUILD) cross-compiling=yes install-headers
	touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs.h
	touch $(IDIR_GLIBC_DEV)/usr/include/bits/stdio_lim.h
	# WORKAROUND: bits/syscall.h is only installed via install-others target
	$(CP) $(STAGING_TARGET_DIR)/usr/include/bits/syscall.h \
		$(IDIR_GLIBC_DEV)/usr/include/bits
	@find $(IDIR_GLIBC_DEV) -name .install -exec rm {} \;

include ${TOPDIR}/mk/pkg-bottom.mk