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