blob: b6e31f5d9372f44934146ae9abc32e456f66f133 [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
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012# ARMv6+ adds atomic instructions that affect the ABI in libraries built
13# with TUNE_CCARGS in gcc-runtime. Make the compiler default to a
14# compatible architecture. armv6 and armv7a cover the minimum tune
15# features used in OE.
16EXTRA_OECONF_append_armv6 = " --with-arch=armv6"
17EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a"
18EXTRA_OECONF_append_armv7ve = " --with-arch=armv7-a"
19
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
21# set in subdir gcc, so subdir libcc1 can't use it, export it here to
22# fix the problem.
23export gcc_cv_objdump = "${TARGET_PREFIX}objdump"
24
25EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
26
27PACKAGES = "\
28 ${PN} ${PN}-plugins ${PN}-symlinks \
29 g++ g++-symlinks \
30 cpp cpp-symlinks \
31 g77 g77-symlinks \
32 gfortran gfortran-symlinks \
33 gcov gcov-symlinks \
34 ${PN}-doc \
35 ${PN}-dev \
36 ${PN}-dbg \
37"
38
39FILES_${PN} = "\
40 ${bindir}/${TARGET_PREFIX}gcc* \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050041 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050042 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
44 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
45 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
46 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
47 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
48 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
49 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
50 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
51"
52INSANE_SKIP_${PN} += "dev-so"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053RRECOMMENDS_${PN} += "\
54 libssp \
55 libssp-dev \
56"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057RDEPENDS_${PN} += "cpp"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059FILES_${PN}-dev = "\
60 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
61 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
62 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
63 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
64 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
65"
66FILES_${PN}-symlinks = "\
67 ${bindir}/cc \
68 ${bindir}/gcc \
69 ${bindir}/gccbug \
70"
71
72FILES_${PN}-plugins = "\
73 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
74"
75ALLOW_EMPTY_${PN}-plugins = "1"
76
77FILES_g77 = "\
78 ${bindir}/${TARGET_PREFIX}g77 \
79 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
80"
81FILES_g77-symlinks = "\
82 ${bindir}/g77 \
83 ${bindir}/f77 \
84"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060085RRECOMMENDS_g77 = "\
86 libg2c \
87 libg2c-dev \
88"
89
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090FILES_gfortran = "\
91 ${bindir}/${TARGET_PREFIX}gfortran \
92 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
93"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060094RRECOMMENDS_gfortran = "\
95 libquadmath \
96 libquadmath-dev \
97"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098FILES_gfortran-symlinks = "\
99 ${bindir}/gfortran \
100 ${bindir}/f95"
101
102FILES_cpp = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500103 ${bindir}/${TARGET_PREFIX}cpp* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 ${base_libdir}/cpp \
105 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
106FILES_cpp-symlinks = "${bindir}/cpp"
107
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500108FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov* \
109 ${bindir}/${TARGET_PREFIX}gcov-tool* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110"
111FILES_gcov-symlinks = "${bindir}/gcov \
112 ${bindir}/gcov-tool \
113"
114
115FILES_g++ = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500116 ${bindir}/${TARGET_PREFIX}g++* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
118"
119FILES_g++-symlinks = "\
120 ${bindir}/c++ \
121 ${bindir}/g++ \
122"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600123RRECOMMENDS_g++ = "\
124 libstdc++ \
125 libstdc++-dev \
126 libatomic \
127 libatomic-dev \
128"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129
130FILES_${PN}-doc = "\
131 ${infodir} \
132 ${mandir} \
133 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
134"
135
136do_compile () {
137 oe_runmake all-host
138}
139
140do_install () {
141 oe_runmake 'DESTDIR=${D}' install-host
142
143 # Add unwind.h, it comes from libgcc which we don't want to build again
144 install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
145
146 # Info dir listing isn't interesting at this point so remove it if it exists.
147 if [ -e "${D}${infodir}/dir" ]; then
148 rm -f ${D}${infodir}/dir
149 fi
150
151 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
152 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
153 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
154 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
155 rmdir ${D}${includedir}
156 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
157
158 # Hack around specs file assumptions
159 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
160
161 # Cleanup manpages..
162 rm -rf ${D}${mandir}/man7
163
164 cd ${D}${bindir}
165
166 # We care about g++ not c++
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500167 rm -f *c++*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168
169 # We don't care about the gcc-<version> ones for this
170 rm -f *gcc-?.?*
171
172 # We use libiberty from binutils
173 find ${D}${libdir} -name libiberty.a | xargs rm -f
174 find ${D}${libdir} -name libiberty.h | xargs rm -f
175
176 # Not sure why we end up with these but we don't want them...
177 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
178
179 # Symlinks so we can use these trivially on the target
180 if [ -e ${TARGET_PREFIX}g77 ]; then
181 ln -sf ${TARGET_PREFIX}g77 g77 || true
182 ln -sf g77 f77 || true
183 fi
184 if [ -e ${TARGET_PREFIX}gfortran ]; then
185 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
186 ln -sf gfortran f95 || true
187 fi
188 ln -sf ${TARGET_PREFIX}g++ g++
189 ln -sf ${TARGET_PREFIX}gcc gcc
190 ln -sf ${TARGET_PREFIX}cpp cpp
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500191 ln -sf ${TARGET_PREFIX}gcov gcov
192 ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500193 install -d ${D}${base_libdir}
194 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
195 ln -sf g++ c++
196 ln -sf gcc cc
197
198 chown -R root:root ${D}
199}
200
201do_install_append () {
202 #
203 # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header
204 # files and places the modified files into
205 # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the
206 # build not deterministic. The following code prunes all those headers
207 # except those under include-fixed/linux, *limits.h and README, yielding
208 # the same include-fixed folders no matter what sysroot
209
210 include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed"
211 for f in $(find ${include_fixed} -type f); do
212 case $f in
213 */include-fixed/linux/*)
214 continue
215 ;;
216 */include-fixed/*limits.h)
217 continue
218 ;;
219 */include-fixed/README)
220 continue
221 ;;
222 *)
223 # remove file and directory if empty
224 bbdebug 2 "Pruning $f"
225 rm $f
226 find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \;
227 ;;
228 esac
229 done
230}
231
232# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
233# and one from here. These can confuse gcc cross where includes use #include_next
234# and builds track file dependencies (e.g. perl and its makedepends code).
235# For determinism we don't install this ever and rely on the copy from gcc-cross.
236# [YOCTO #7287]
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600237SYSROOT_DIRS_BLACKLIST += "${libdir}/gcc"