blob: d62c15afd81e161b4aebf819a823d5e9a0ec5f67 [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} \
7 --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
8 --with-gxx-include-dir=${includedir}/c++/${BINV} \
9"
10
11EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
12
13# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
14# set in subdir gcc, so subdir libcc1 can't use it, export it here to
15# fix the problem.
16export gcc_cv_objdump = "${TARGET_PREFIX}objdump"
17
18EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
19
20PACKAGES = "\
21 ${PN} ${PN}-plugins ${PN}-symlinks \
22 g++ g++-symlinks \
23 cpp cpp-symlinks \
24 g77 g77-symlinks \
25 gfortran gfortran-symlinks \
26 gcov gcov-symlinks \
27 ${PN}-doc \
28 ${PN}-dev \
29 ${PN}-dbg \
30"
31
32FILES_${PN} = "\
33 ${bindir}/${TARGET_PREFIX}gcc* \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050034 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc* \
36 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
37 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
38 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
39 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
40 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
41 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
42 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
43 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
44"
45INSANE_SKIP_${PN} += "dev-so"
46
47FILES_${PN}-dbg += "\
48 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/.debug/ \
49 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/.debug/ \
50"
51FILES_${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"
77FILES_gfortran = "\
78 ${bindir}/${TARGET_PREFIX}gfortran \
79 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
80"
81FILES_gfortran-symlinks = "\
82 ${bindir}/gfortran \
83 ${bindir}/f95"
84
85FILES_cpp = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -050086 ${bindir}/${TARGET_PREFIX}cpp* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087 ${base_libdir}/cpp \
88 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
89FILES_cpp-symlinks = "${bindir}/cpp"
90
Patrick Williamsf1e5d692016-03-30 15:21:19 -050091FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov* \
92 ${bindir}/${TARGET_PREFIX}gcov-tool* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093"
94FILES_gcov-symlinks = "${bindir}/gcov \
95 ${bindir}/gcov-tool \
96"
97
98FILES_g++ = "\
Patrick Williamsf1e5d692016-03-30 15:21:19 -050099 ${bindir}/${TARGET_PREFIX}g++* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
101"
102FILES_g++-symlinks = "\
103 ${bindir}/c++ \
104 ${bindir}/g++ \
105"
106
107FILES_${PN}-doc = "\
108 ${infodir} \
109 ${mandir} \
110 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
111"
112
113do_compile () {
114 oe_runmake all-host
115}
116
117do_install () {
118 oe_runmake 'DESTDIR=${D}' install-host
119
120 # Add unwind.h, it comes from libgcc which we don't want to build again
121 install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
122
123 # Info dir listing isn't interesting at this point so remove it if it exists.
124 if [ -e "${D}${infodir}/dir" ]; then
125 rm -f ${D}${infodir}/dir
126 fi
127
128 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
129 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
130 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
131 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
132 rmdir ${D}${includedir}
133 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
134
135 # Hack around specs file assumptions
136 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
137
138 # Cleanup manpages..
139 rm -rf ${D}${mandir}/man7
140
141 cd ${D}${bindir}
142
143 # We care about g++ not c++
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500144 rm -f *c++*
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500145
146 # We don't care about the gcc-<version> ones for this
147 rm -f *gcc-?.?*
148
149 # We use libiberty from binutils
150 find ${D}${libdir} -name libiberty.a | xargs rm -f
151 find ${D}${libdir} -name libiberty.h | xargs rm -f
152
153 # Not sure why we end up with these but we don't want them...
154 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
155
156 # Symlinks so we can use these trivially on the target
157 if [ -e ${TARGET_PREFIX}g77 ]; then
158 ln -sf ${TARGET_PREFIX}g77 g77 || true
159 ln -sf g77 f77 || true
160 fi
161 if [ -e ${TARGET_PREFIX}gfortran ]; then
162 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
163 ln -sf gfortran f95 || true
164 fi
165 ln -sf ${TARGET_PREFIX}g++ g++
166 ln -sf ${TARGET_PREFIX}gcc gcc
167 ln -sf ${TARGET_PREFIX}cpp cpp
168 install -d ${D}${base_libdir}
169 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
170 ln -sf g++ c++
171 ln -sf gcc cc
172
173 chown -R root:root ${D}
174}
175
176do_install_append () {
177 #
178 # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header
179 # files and places the modified files into
180 # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the
181 # build not deterministic. The following code prunes all those headers
182 # except those under include-fixed/linux, *limits.h and README, yielding
183 # the same include-fixed folders no matter what sysroot
184
185 include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed"
186 for f in $(find ${include_fixed} -type f); do
187 case $f in
188 */include-fixed/linux/*)
189 continue
190 ;;
191 */include-fixed/*limits.h)
192 continue
193 ;;
194 */include-fixed/README)
195 continue
196 ;;
197 *)
198 # remove file and directory if empty
199 bbdebug 2 "Pruning $f"
200 rm $f
201 find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \;
202 ;;
203 esac
204 done
205}
206
207# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
208# and one from here. These can confuse gcc cross where includes use #include_next
209# and builds track file dependencies (e.g. perl and its makedepends code).
210# For determinism we don't install this ever and rely on the copy from gcc-cross.
211# [YOCTO #7287]
212sysroot_stage_dirs_append () {
213 rm -rf $to${libdir}/gcc
214}