blob: f436fa24f4dc986d62de62d4405a28804af81af4 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001GCCMULTILIB = "--enable-multilib"
2require gcc-configure-common.inc
3
4EXTRA_OECONF_PATHS = "\
5 --with-sysroot=/ \
6 --with-build-sysroot=${STAGING_DIR_TARGET} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007 --with-gxx-include-dir=${includedir}/c++/${BINV} \
8"
9
10EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
11
12# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
13# set in subdir gcc, so subdir libcc1 can't use it, export it here to
14# fix the problem.
15export gcc_cv_objdump = "${TARGET_PREFIX}objdump"
16
17EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
18
19PACKAGES = "\
20 ${PN} ${PN}-plugins ${PN}-symlinks \
21 g++ g++-symlinks \
22 cpp cpp-symlinks \
23 g77 g77-symlinks \
24 gfortran gfortran-symlinks \
25 gcov gcov-symlinks \
26 ${PN}-doc \
27 ${PN}-dev \
28 ${PN}-dbg \
29"
30
31FILES_${PN} = "\
32 ${bindir}/${TARGET_PREFIX}gcc* \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050033 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc* \
35 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
36 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
37 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
38 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
39 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
40 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
41 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
42 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
43"
44INSANE_SKIP_${PN} += "dev-so"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060045RRECOMMENDS_${PN} += "\
46 libssp \
47 libssp-dev \
48"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050FILES_${PN}-dev = "\
51 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
52 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
53 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
54 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
55 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
56"
57FILES_${PN}-symlinks = "\
58 ${bindir}/cc \
59 ${bindir}/gcc \
60 ${bindir}/gccbug \
61"
62
63FILES_${PN}-plugins = "\
64 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
65"
66ALLOW_EMPTY_${PN}-plugins = "1"
67
68FILES_g77 = "\
69 ${bindir}/${TARGET_PREFIX}g77 \
70 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
71"
72FILES_g77-symlinks = "\
73 ${bindir}/g77 \
74 ${bindir}/f77 \
75"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060076RRECOMMENDS_g77 = "\
77 libg2c \
78 libg2c-dev \
79"
80
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081FILES_gfortran = "\
82 ${bindir}/${TARGET_PREFIX}gfortran \
83 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
84"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060085RRECOMMENDS_gfortran = "\
86 libquadmath \
87 libquadmath-dev \
88"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089FILES_gfortran-symlinks = "\
90 ${bindir}/gfortran \
91 ${bindir}/f95"
92
93FILES_cpp = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -050094 ${bindir}/${TARGET_PREFIX}cpp* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050095 ${base_libdir}/cpp \
96 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
97FILES_cpp-symlinks = "${bindir}/cpp"
98
Patrick Williamsf1e5d692016-03-30 15:21:19 -050099FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov* \
100 ${bindir}/${TARGET_PREFIX}gcov-tool* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500101"
102FILES_gcov-symlinks = "${bindir}/gcov \
103 ${bindir}/gcov-tool \
104"
105
106FILES_g++ = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500107 ${bindir}/${TARGET_PREFIX}g++* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
109"
110FILES_g++-symlinks = "\
111 ${bindir}/c++ \
112 ${bindir}/g++ \
113"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600114RRECOMMENDS_g++ = "\
115 libstdc++ \
116 libstdc++-dev \
117 libatomic \
118 libatomic-dev \
119"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500120
121FILES_${PN}-doc = "\
122 ${infodir} \
123 ${mandir} \
124 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
125"
126
127do_compile () {
128 oe_runmake all-host
129}
130
131do_install () {
132 oe_runmake 'DESTDIR=${D}' install-host
133
134 # Add unwind.h, it comes from libgcc which we don't want to build again
135 install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
136
137 # Info dir listing isn't interesting at this point so remove it if it exists.
138 if [ -e "${D}${infodir}/dir" ]; then
139 rm -f ${D}${infodir}/dir
140 fi
141
142 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
143 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
144 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
145 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
146 rmdir ${D}${includedir}
147 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
148
149 # Hack around specs file assumptions
150 test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
151
152 # Cleanup manpages..
153 rm -rf ${D}${mandir}/man7
154
155 cd ${D}${bindir}
156
157 # We care about g++ not c++
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500158 rm -f *c++*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159
160 # We don't care about the gcc-<version> ones for this
161 rm -f *gcc-?.?*
162
163 # We use libiberty from binutils
164 find ${D}${libdir} -name libiberty.a | xargs rm -f
165 find ${D}${libdir} -name libiberty.h | xargs rm -f
166
167 # Not sure why we end up with these but we don't want them...
168 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
169
170 # Symlinks so we can use these trivially on the target
171 if [ -e ${TARGET_PREFIX}g77 ]; then
172 ln -sf ${TARGET_PREFIX}g77 g77 || true
173 ln -sf g77 f77 || true
174 fi
175 if [ -e ${TARGET_PREFIX}gfortran ]; then
176 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
177 ln -sf gfortran f95 || true
178 fi
179 ln -sf ${TARGET_PREFIX}g++ g++
180 ln -sf ${TARGET_PREFIX}gcc gcc
181 ln -sf ${TARGET_PREFIX}cpp cpp
182 install -d ${D}${base_libdir}
183 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
184 ln -sf g++ c++
185 ln -sf gcc cc
186
187 chown -R root:root ${D}
188}
189
190do_install_append () {
191 #
192 # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header
193 # files and places the modified files into
194 # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the
195 # build not deterministic. The following code prunes all those headers
196 # except those under include-fixed/linux, *limits.h and README, yielding
197 # the same include-fixed folders no matter what sysroot
198
199 include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed"
200 for f in $(find ${include_fixed} -type f); do
201 case $f in
202 */include-fixed/linux/*)
203 continue
204 ;;
205 */include-fixed/*limits.h)
206 continue
207 ;;
208 */include-fixed/README)
209 continue
210 ;;
211 *)
212 # remove file and directory if empty
213 bbdebug 2 "Pruning $f"
214 rm $f
215 find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \;
216 ;;
217 esac
218 done
219}
220
221# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
222# and one from here. These can confuse gcc cross where includes use #include_next
223# and builds track file dependencies (e.g. perl and its makedepends code).
224# For determinism we don't install this ever and rely on the copy from gcc-cross.
225# [YOCTO #7287]
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600226SYSROOT_DIRS_BLACKLIST += "${libdir}/gcc"