blob: eef4434dbb3bfccdf9ce0bf39c72dd76b4202712 [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* \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 ${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"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049RDEPENDS_${PN} += "cpp"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051FILES_${PN}-dev = "\
52 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
53 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
54 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
55 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
56 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
57"
58FILES_${PN}-symlinks = "\
59 ${bindir}/cc \
60 ${bindir}/gcc \
61 ${bindir}/gccbug \
62"
63
64FILES_${PN}-plugins = "\
65 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
66"
67ALLOW_EMPTY_${PN}-plugins = "1"
68
69FILES_g77 = "\
70 ${bindir}/${TARGET_PREFIX}g77 \
71 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
72"
73FILES_g77-symlinks = "\
74 ${bindir}/g77 \
75 ${bindir}/f77 \
76"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060077RRECOMMENDS_g77 = "\
78 libg2c \
79 libg2c-dev \
80"
81
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082FILES_gfortran = "\
83 ${bindir}/${TARGET_PREFIX}gfortran \
84 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
85"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060086RRECOMMENDS_gfortran = "\
87 libquadmath \
88 libquadmath-dev \
89"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090FILES_gfortran-symlinks = "\
91 ${bindir}/gfortran \
92 ${bindir}/f95"
93
94FILES_cpp = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -050095 ${bindir}/${TARGET_PREFIX}cpp* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096 ${base_libdir}/cpp \
97 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
98FILES_cpp-symlinks = "${bindir}/cpp"
99
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500100FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov* \
101 ${bindir}/${TARGET_PREFIX}gcov-tool* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102"
103FILES_gcov-symlinks = "${bindir}/gcov \
104 ${bindir}/gcov-tool \
105"
106
107FILES_g++ = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500108 ${bindir}/${TARGET_PREFIX}g++* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
110"
111FILES_g++-symlinks = "\
112 ${bindir}/c++ \
113 ${bindir}/g++ \
114"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600115RRECOMMENDS_g++ = "\
116 libstdc++ \
117 libstdc++-dev \
118 libatomic \
119 libatomic-dev \
120"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121
122FILES_${PN}-doc = "\
123 ${infodir} \
124 ${mandir} \
125 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
126"
127
128do_compile () {
129 oe_runmake all-host
130}
131
132do_install () {
133 oe_runmake 'DESTDIR=${D}' install-host
134
135 # Add unwind.h, it comes from libgcc which we don't want to build again
136 install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
137
138 # Info dir listing isn't interesting at this point so remove it if it exists.
139 if [ -e "${D}${infodir}/dir" ]; then
140 rm -f ${D}${infodir}/dir
141 fi
142
143 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
144 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
145 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
146 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
147 rmdir ${D}${includedir}
148 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
149
150 # Hack around specs file assumptions
151 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
152
153 # Cleanup manpages..
154 rm -rf ${D}${mandir}/man7
155
156 cd ${D}${bindir}
157
158 # We care about g++ not c++
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500159 rm -f *c++*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500160
161 # We don't care about the gcc-<version> ones for this
162 rm -f *gcc-?.?*
163
164 # We use libiberty from binutils
165 find ${D}${libdir} -name libiberty.a | xargs rm -f
166 find ${D}${libdir} -name libiberty.h | xargs rm -f
167
168 # Not sure why we end up with these but we don't want them...
169 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
170
171 # Symlinks so we can use these trivially on the target
172 if [ -e ${TARGET_PREFIX}g77 ]; then
173 ln -sf ${TARGET_PREFIX}g77 g77 || true
174 ln -sf g77 f77 || true
175 fi
176 if [ -e ${TARGET_PREFIX}gfortran ]; then
177 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
178 ln -sf gfortran f95 || true
179 fi
180 ln -sf ${TARGET_PREFIX}g++ g++
181 ln -sf ${TARGET_PREFIX}gcc gcc
182 ln -sf ${TARGET_PREFIX}cpp cpp
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500183 ln -sf ${TARGET_PREFIX}gcov gcov
184 ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185 install -d ${D}${base_libdir}
186 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
187 ln -sf g++ c++
188 ln -sf gcc cc
189
190 chown -R root:root ${D}
191}
192
193do_install_append () {
194 #
195 # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header
196 # files and places the modified files into
197 # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the
198 # build not deterministic. The following code prunes all those headers
199 # except those under include-fixed/linux, *limits.h and README, yielding
200 # the same include-fixed folders no matter what sysroot
201
202 include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed"
203 for f in $(find ${include_fixed} -type f); do
204 case $f in
205 */include-fixed/linux/*)
206 continue
207 ;;
208 */include-fixed/*limits.h)
209 continue
210 ;;
211 */include-fixed/README)
212 continue
213 ;;
214 *)
215 # remove file and directory if empty
216 bbdebug 2 "Pruning $f"
217 rm $f
218 find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \;
219 ;;
220 esac
221 done
222}
223
224# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
225# and one from here. These can confuse gcc cross where includes use #include_next
226# and builds track file dependencies (e.g. perl and its makedepends code).
227# For determinism we don't install this ever and rely on the copy from gcc-cross.
228# [YOCTO #7287]
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600229SYSROOT_DIRS_BLACKLIST += "${libdir}/gcc"