blob: 00850a1627cadc61e1a9e83255888e13ccaefb40 (
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
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
|
#!/usr/bin/make -f
BASE_VERSION = $$(printf '%s\n' '$(OPK_SOURCE)' | sed 's/^gcc-//')
COMMON_OPTS = \
--with-pkgversion='GCC for ProteanOS' \
--program-suffix="-$(BASE_VERSION)" \
--enable-linker-build-id \
--with-system-zlib \
--disable-multilib \
--without-included-gettext \
--with-nls \
--with-sysroot="$${OPK_SYSROOT:-/}" \
--enable-clocale=gnu
FULL_OPTS = \
$(COMMON_OPTS) \
--enable-shared \
--enable-threads=posix \
--enable-languages=c,c++
BOOTSTRAP1_OPTS = \
$(COMMON_OPTS) \
--without-headers \
--with-newlib \
--disable-shared \
--disable-threads \
--enable-languages=c,c++ \
--disable-libgomp \
--disable-libmudflap \
--disable-libssp
nop:
@:
configure:
if [ 'x$(OPK_HOST_PLAT)' = 'xbootstrap1' ]; then \
oh-autoconfigure -B gcc-build -- \
$(BOOTSTRAP1_OPTS); \
else \
oh-autoconfigure -B gcc-build -- \
$(FULL_OPTS); \
fi
touch $@
build: configure
oh-autobuild -B gcc-build -T bootstrap-lean -- -j $${JOBS:-1} \
libsubdir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION) \
libexecsubdir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION) \
libsubincludedir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION) \
fincludedir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/finclude \
toolexeclibdir=/usr/lib/$(OPK_HOST_ARCH) MULTIOSDIR=
touch $@
install: build
# The -T option is necessary because otherwise:
# * oh-autoinstall checks for an "install" target by running make with
# the -n option,
# * Many commands in GCC makefiles contain the "$(MAKE)" macro
# expansion, and
# * GNU Make executes any commands that contain "$(MAKE)", even if -n
# is specified.
# See also: <http://gcc.gnu.org/ml/gcc/2013-04/msg00171.html>.
# TODO: Replace $(OPK_HOST_ARCH) with the target arch.
oh-autoinstall -B gcc-build -T install -- \
gxx_include_dir=/usr/include/c++-4.7 \
host_installdir=/usr/include/$(OPK_HOST_ARCH)/c++-4.7/bits \
libsubdir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION) \
libexecsubdir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION) \
libsubincludedir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION) \
fincludedir=/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/finclude \
toolexeclibdir=/usr/lib/$(OPK_HOST_ARCH) MULTIOSDIR=
# Change the target architecture prefix of files in /usr/bin.
rm -f dest/usr/bin/*-gcc-$(BASE_VERSION).*
for f in c++ g++ gcc gcc-ar gcc-nm gcc-ranlib; do \
rm -f dest/usr/bin/$${f}-$(BASE_VERSION); \
mv dest/usr/bin/*-$${f}-$(BASE_VERSION) \
dest/usr/bin/$(OPK_HOST_ARCH)-$$(printf '%s' \
dest/usr/bin/*-$${f}-$(BASE_VERSION) | \
sed "s/^.*-\($${f}\)/\1/"); \
ln -sf $(OPK_HOST_ARCH)-$$(printf '%s' \
dest/usr/bin/*-$${f}-$(BASE_VERSION) | \
sed "s/^.*-\($${f}\)/\1/") \
dest/usr/bin/$$(printf '%s' \
dest/usr/bin/*-$${f}-$(BASE_VERSION) | \
sed "s/^.*-\($${f}\)/\1/"); \
done
# Remove the internal libiberty.a.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libiberty.a
# Move libstdc++.so link.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libstdc++.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libstdc++.so.6 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libstdc++.so
# Move libstdc++.a and libsupc++.a.
mv dest/usr/lib/$(OPK_HOST_ARCH)/libstdc++.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
mv dest/usr/lib/$(OPK_HOST_ARCH)/libsupc++.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
# Move libmudflap.so and libmudflapth.so links.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libmudflap.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libmudflap.so.0 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libmudflap.so
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libmudflapth.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libmudflapth.so.0 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libmudflapth.so
# Move libmudflap.a and libmudflapth.a.
mv dest/usr/lib/$(OPK_HOST_ARCH)/libmudflap.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
mv dest/usr/lib/$(OPK_HOST_ARCH)/libmudflapth.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
# Move libssp.so link.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libssp.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libssp.so.0 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libssp.so
# Move libssp.a and libssp_nonshared.a.
mv dest/usr/lib/$(OPK_HOST_ARCH)/libssp.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
mv dest/usr/lib/$(OPK_HOST_ARCH)/libssp_nonshared.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
# Move libgcc_s.so.1 under /lib.
mkdir -p dest/lib/$(OPK_HOST_ARCH)
mv dest/usr/lib/$(OPK_HOST_ARCH)/libgcc_s.so.1 dest/lib/$(OPK_HOST_ARCH)
# Move libgcc_s.so link.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libgcc_s.so
ln -sf /lib/$(OPK_HOST_ARCH)/libgcc_s.so.1 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libgcc_s.so
# Move libquadmath.so link.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libquadmath.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libquadmath.so.0 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libquadmath.so
# Move libquadmath.a.
mv dest/usr/lib/$(OPK_HOST_ARCH)/libquadmath.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
# Move libgomp.so link.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libgomp.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libgomp.so.1 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libgomp.so
# Move libgomp.a.
mv dest/usr/lib/$(OPK_HOST_ARCH)/libgomp.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
# Move libitm.so link.
rm -f dest/usr/lib/$(OPK_HOST_ARCH)/libitm.so
ln -sf /usr/lib/$(OPK_HOST_ARCH)/libitm.so.1 \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/libitm.so
# Move libitm.a.
mv dest/usr/lib/$(OPK_HOST_ARCH)/libitm.a \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/
# Remove libtool archives.
rm -f \
dest/usr/lib/$(OPK_HOST_ARCH)/libmudflap.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libmudflapth.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libssp.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libssp_nonshared.la \
dest/usr/lib/$(OPK_HOST_ARCH)/gcc-$(BASE_VERSION)/liblto_plugin.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libquadmath.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libgomp.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libitm.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libstdc++.la \
dest/usr/lib/$(OPK_HOST_ARCH)/libsupc++.la
# Remove the info directory node.
rm -f dest/usr/share/info/dir
# Remove empty documentation files.
find dest/usr/share/man -type f -a -size 0c -a -exec rm -f '{}' ';'
find dest/usr/share/info -type f -a -size 0c -a -exec rm -f '{}' ';'
# POSIX.1-2008:
# If the pathname does not begin with a '/' it shall be treated as relative to
# the current working directory of the process, not relative to the directory
# containing the makefile.
include ../source.mk
|