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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# 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
include ../rules.mk
# glibc does not compile with Os
TARGET_CFLAGS:= $(subst Os,O2,$(TARGET_CFLAGS))
ifneq ($(ADK_DEBUG),)
TARGET_CFLAGS+= -O2
endif
# ssp partially supported
TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS))
#TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS))
include Makefile.inc
include Makefile.multilib
include ${TOPDIR}/mk/buildhlp.mk
ifeq ($(ADK_TARGET_NO_FPU),y)
GLIBC_CONFOPTS+= --without-fp
endif
GLIBC_MAKEOPTS+= cross-compiling=yes
ifeq (${ADK_MAKE_PARALLEL},y)
GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j1"
endif
GLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
$(WRKBUILD)/.headers_configure:
for abi in $(TABI); do \
mkdir -p $(GLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \
(cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
ln -sf ../../w-glibc-ports-$(PKG_VERSION)-1/glibc-ports-$(PKG_VERSION)/ ports); \
(cd $(GLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \
${GLIBC_ENV} \
CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \
$(WRKBUILD)/libc/configure \
--prefix=$(STAGING_TARGET_DIR)-$${abi/*:/}/usr \
--with-sysroot=$(STAGING_TARGET_DIR)-$${abi/*:/} \
--host=$${abi/:*/} \
${GLIBC_CONFOPTS} \
); \
done
touch $@
$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
for abi in $(TABI); do \
(cd $(GLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \
${GLIBC_ENV} \
CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \
$(MAKE) ${GLIBC_MAKEOPTS} install-headers \
); \
done
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h
touch $@
else
$(WRKBUILD)/.headers_configure:
mkdir -p $(GLIBC_BUILD_DIR_INITIAL)
(cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
ln -sf ../../w-glibc-ports-$(PKG_VERSION)-1/glibc-ports-$(PKG_VERSION)/ ports);
(cd $(GLIBC_BUILD_DIR_INITIAL); \
${GLIBC_ENV} \
$(WRKBUILD)/configure \
--prefix=$(STAGING_TARGET_DIR)/usr \
--with-sysroot=$(STAGING_TARGET_DIR) \
${GLIBC_CONFOPTS} \
);
touch $@
$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
(cd $(GLIBC_BUILD_DIR_INITIAL); \
${GLIBC_ENV} \
$(MAKE) ${GLIBC_MAKEOPTS} install-headers \
);
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h
touch $@
endif
ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
$(WRKBUILD)/.configured:
for abi in $(TABI); do \
mkdir -p $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/} ;\
(cd $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/}; \
${GLIBC_ENV} \
CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \
$(WRKBUILD)/libc/configure \
--prefix=/usr \
--enable-shared \
--enable-stackguard-randomization \
--host=$${abi/:*/} \
${GLIBC_CONFOPTS} \
); \
done
touch $@
$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
for abi in $(TABI); do \
${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/} all ;\
done
touch $@
$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
for abi in $(TABI); do \
${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/} install_root=$(STAGING_TARGET_DIR)-$${abi/*:/} install ;\
done
# default libgcc searching for 64 bit libraries
${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL)-64 install_root=$(STAGING_TARGET_DIR) install
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h
for abi in $(TABI); do \
mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/} ; \
$(CP) $(STAGING_TARGET_DIR)-$${abi/*:/}/lib/* $(STAGING_TARGET_DIR)-$${abi/*:/}/usr/lib/* \
$(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/} ; \
rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/}/libc.so ; \
done
mkdir -p ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
touch $@
else
$(WRKBUILD)/.configured:
mkdir -p $(GLIBC_BUILD_DIR_FINAL)
(cd $(GLIBC_BUILD_DIR_FINAL); \
${GLIBC_ENV} \
$(WRKBUILD)/configure \
--prefix=/usr \
--enable-shared \
--enable-stackguard-randomization \
${GLIBC_CONFOPTS} \
);
touch $@
$(WRKBUILD)/.compiled:
${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
touch $@
$(WRKBUILD)/.installed:
${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
mkdir -p ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
touch $@
endif
ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
$(WRKBUILD)/.fixup:
ifeq ($(ADK_TARGET_ABI_64),y)
${CP} $(STAGING_TARGET_DIR)-64/lib/* $(STAGING_TARGET_DIR)/lib
${CP} $(STAGING_TARGET_DIR)-64/usr/lib/* $(STAGING_TARGET_DIR)/usr/lib
endif
ifeq ($(ADK_TARGET_ABI_32),y)
${CP} $(STAGING_TARGET_DIR)-32/lib/* $(STAGING_TARGET_DIR)/lib
${CP} $(STAGING_TARGET_DIR)-32/usr/lib/* $(STAGING_TARGET_DIR)/usr/lib
endif
ifeq ($(ADK_TARGET_ABI_X32),y)
${CP} $(STAGING_TARGET_DIR)-x32/lib/* $(STAGING_TARGET_DIR)/lib
${CP} $(STAGING_TARGET_DIR)-x32/usr/lib/* $(STAGING_TARGET_DIR)/usr/lib
endif
touch $@
endif
include ${TOPDIR}/mk/toolchain.mk
|