Swapspace: update to 1.18.1
[void-pkg.git] / common / build-style / void-cross.sh
blobd94e90cbb133c4a957916dd8feab9255b991b825
2 # This helper is for void system crosstoolchain templates.
4 # Optional variables:
6 # - cross_gcc_skip_go - do not build gccgo support
7 # - cross_binutils_configure_args
8 # - cross_gcc_bootstrap_configure_args
9 # - cross_gcc_configure_args
10 # - cross_glibc_cflags
11 # - cross_glibc_ldflags
12 # - cross_glibc_configure_args
13 # - cross_musl_cflags
14 # - cross_musl_ldflags
15 # - cross_musl_configure_args
17 # configure_args is passed to both bootstrap gcc and final gcc
18 # if you need to pass some to one and not the other, use the
19 # respective cross_ variables for final gcc and bootstrap gcc
22 _void_cross_apply_patch() {
23 local pname="$(basename $1)"
24 if [ ! -f ".${pname}_done" ]; then
25 patch -Np1 $args -i $1
26 touch .${pname}_done
30 _void_cross_build_binutils() {
31 [ -f ${wrksrc}/.binutils_done ] && return 0
33 local tgt=$1
34 local ver=$2
36 msg_normal "Patching binutils for ${tgt}\n"
38 cd ${wrksrc}/binutils-${ver}
39 if [ -d "${XBPS_SRCPKGDIR}/binutils/patches" ]; then
40 for f in ${XBPS_SRCPKGDIR}/binutils/patches/*.patch; do
41 _void_cross_apply_patch "$f"
42 done
44 cd ..
46 msg_normal "Building binutils for ${tgt}\n"
48 mkdir -p ${wrksrc}/binutils_build
49 cd ${wrksrc}/binutils_build
51 ../binutils-${ver}/configure \
52 --prefix=/usr \
53 --sbindir=/usr/bin \
54 --libdir=/usr/lib \
55 --libexecdir=/usr/lib \
56 --sysconfdir=/etc \
57 --target=${tgt} \
58 --with-sysroot=/usr/${tgt} \
59 --disable-nls \
60 --disable-shared \
61 --disable-multilib \
62 --disable-werror \
63 --disable-gold \
64 --disable-gprofng \
65 --enable-relro \
66 --enable-new-dtags \
67 --enable-plugins \
68 --enable-64-bit-bfd \
69 --enable-deterministic-archives \
70 --enable-default-hash-style=gnu \
71 --with-system-zlib \
72 --with-mmap \
73 --with-pic \
74 ${cross_binutils_configure_args}
76 make configure-host
77 make ${makejobs}
79 make install DESTDIR=${wrksrc}/build_root
81 touch ${wrksrc}/.binutils_done
84 _void_cross_build_bootstrap_gcc() {
85 [ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
87 local tgt=$1
88 local ver=$2
90 msg_normal "Patching GCC for ${tgt}\n"
92 cd ${wrksrc}/gcc-${ver}
94 # Do not run fixincludes
95 sed -i 's@./fixinc.sh@-c true@' Makefile.in
97 for f in ${XBPS_SRCPKGDIR}/gcc/patches/*.patch; do
98 _void_cross_apply_patch "$f"
99 done
100 if [ -f ${wrksrc}/.musl_version ]; then
101 for f in ${XBPS_SRCPKGDIR}/gcc/files/*-musl.patch; do
102 _void_cross_apply_patch "$f"
103 done
105 cd ..
107 msg_normal "Building bootstrap GCC for ${tgt}\n"
109 mkdir -p gcc_bootstrap
110 cd gcc_bootstrap
112 local extra_args
113 if [ -f ${wrksrc}/.musl_version ]; then
114 extra_args+=" --with-newlib"
115 extra_args+=" --disable-symvers"
116 extra_args+=" libat_cv_have_ifunc=no"
117 else
118 extra_args+=" --without-headers"
121 ../gcc-${ver}/configure \
122 --prefix=/usr \
123 --sbindir=/usr/bin \
124 --libdir=/usr/lib \
125 --libexecdir=/usr/lib \
126 --target=${tgt} \
127 --disable-nls \
128 --disable-multilib \
129 --disable-shared \
130 --disable-libquadmath \
131 --disable-decimal-float \
132 --disable-libgomp \
133 --disable-libmpx \
134 --disable-libmudflap \
135 --disable-libssp \
136 --disable-libitm \
137 --disable-libatomic --disable-autolink-libatomic \
138 --disable-gcov \
139 --disable-threads \
140 --disable-sjlj-exceptions \
141 --enable-languages=c \
142 --with-gnu-ld \
143 --with-gnu-as \
144 ${extra_args} \
145 ${configure_args} \
146 ${cross_gcc_bootstrap_configure_args}
148 make ${makejobs}
149 make install DESTDIR=${wrksrc}/build_root
151 local ptrs=$(${tgt}-gcc -dM -E - < /dev/null | \
152 grep __SIZEOF_POINTER__)
153 local ws=${ptrs##* }
155 case ${ws} in
156 8) echo 64 > ${wrksrc}/.gcc_wordsize ;;
157 4) echo 32 > ${wrksrc}/.gcc_wordsize ;;
158 *) msg_error "Unknown word size: ${ws}\n" ;;
159 esac
161 touch ${wrksrc}/.gcc_bootstrap_done
164 _void_cross_build_kernel_headers() {
165 [ -f ${wrksrc}/.linux_headers_done ] && return 0
167 local tgt=$1
168 local ver=$2
169 local arch
171 msg_normal "Patching Linux headers for ${tgt}\n"
173 cd ${wrksrc}/linux-${ver}
174 if [ -d "${XBPS_SRCPKGDIR}/kernel-libc-headers/patches" ]; then
175 for f in ${XBPS_SRCPKGDIR}/kernel-libc-headers/patches/*.patch; do
176 _void_cross_apply_patch "$f"
177 done
179 cd ..
181 msg_normal "Building Linux headers for ${tgt}\n"
183 cd linux-${ver}
185 case "$tgt" in
186 x86_64*|i686*) arch=x86 ;;
187 powerpc*) arch=powerpc ;;
188 mips*) arch=mips ;;
189 aarch64*) arch=arm64 ;;
190 arm*) arch=arm ;;
191 riscv*) arch=riscv ;;
192 s390*) arch=s390 ;;
193 *) msg_error "Unknown Linux arch for ${tgt}\n" ;;
194 esac
196 make ARCH=${arch} headers
197 find usr/include -name '.*' -delete
198 rm usr/include/Makefile
199 rm -r usr/include/drm
200 cp -a usr/include ${wrksrc}/build_root/usr/${tgt}/usr
202 touch ${wrksrc}/.linux_headers_done
205 _void_cross_build_glibc_headers() {
206 [ -f ${wrksrc}/.glibc_headers_done ] && return 0
208 local tgt=$1
209 local ver=$2
211 msg_normal "Patching glibc for ${tgt}\n"
213 cd ${wrksrc}/glibc-${ver}
214 if [ -d "${XBPS_SRCPKGDIR}/glibc/patches" ]; then
215 for f in ${XBPS_SRCPKGDIR}/glibc/patches/*.patch; do
216 _void_cross_apply_patch "$f"
217 done
219 cd ..
221 msg_normal "Building glibc headers for ${tgt}\n"
223 mkdir -p glibc_headers
224 cd glibc_headers
226 echo "libc_cv_forced_unwind=yes" > config.cache
227 echo "libc_cv_c_cleanup=yes" >> config.cache
229 # we don't need any custom args here, it's just headers
230 CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
231 AS="${tgt}-as" NM="${tgt}-nm" CFLAGS="-pipe" CXXFLAGS="" CPPFLAGS="" \
232 LDFLAGS="" \
233 ../glibc-${ver}/configure \
234 --prefix=/usr \
235 --host=${tgt} \
236 --with-headers=${wrksrc}/build_root/usr/${tgt}/usr/include \
237 --config-cache \
238 --enable-kernel=2.6.27 \
239 ${cross_glibc_configure_args}
241 make -k install-headers cross_compiling=yes \
242 install_root=${wrksrc}/build_root/usr/${tgt}
244 touch ${wrksrc}/.glibc_headers_done
247 _void_cross_build_glibc() {
248 [ -f ${wrksrc}/.glibc_build_done ] && return 0
250 local tgt=$1
251 local ver=$2
253 msg_normal "Building glibc for ${tgt}\n"
255 mkdir -p ${wrksrc}/glibc_build
256 cd ${wrksrc}/glibc_build
258 local ws=$(cat ${wrksrc}/.gcc_wordsize)
260 echo "slibdir=/usr/lib${ws}" > configparms
262 echo "libc_cv_forced_unwind=yes" > config.cache
263 echo "libc_cv_c_cleanup=yes" >> config.cache
265 CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
266 AR="${tgt}-ar" AS="${tgt}-as" NM="${tgt}-nm" \
267 OBJDUMP="${tgt}-objdump" OBJCOPY="${tgt}-objcopy" \
268 CFLAGS="-pipe ${cross_glibc_cflags}" \
269 CXXFLAGS="-pipe ${cross_glibc_cflags}" \
270 CPPFLAGS="" \
271 LDFLAGS="${cross_glibc_ldflags}" \
272 ../glibc-${ver}/configure \
273 --prefix=/usr \
274 --libdir=/usr/lib${ws} \
275 --libexecdir=/usr/libexec \
276 --host=${tgt} \
277 --with-headers=${wrksrc}/build_root/usr/${tgt}/usr/include \
278 --config-cache \
279 --disable-profile \
280 --disable-werror \
281 --enable-kernel=2.6.27 \
282 ${cross_glibc_configure_args}
284 make ${makejobs}
285 make install_root=${wrksrc}/build_root/usr/${tgt} install
287 touch ${wrksrc}/.glibc_build_done
290 _void_cross_build_musl() {
291 [ -f ${wrksrc}/.musl_build_done ] && return 0
293 local tgt=$1
294 local ver=$2
296 msg_normal "Patching musl for ${tgt}\n"
298 cd ${wrksrc}/musl-${ver}
299 if [ -d "${XBPS_SRCPKGDIR}/musl/patches" ]; then
300 for f in ${XBPS_SRCPKGDIR}/musl/patches/*.patch; do
301 _void_cross_apply_patch "$f"
302 done
304 cd ..
306 msg_normal "Building musl for ${tgt}\n"
308 mkdir -p musl_build
309 cd musl_build
311 CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
312 AR="${tgt}-ar" AS="${tgt}-as" NM="${tgt}-nm" \
313 CFLAGS="-pipe -fPIC ${cross_musl_cflags}" \
314 CPPFLAGS="${cross_musl_cflags}" LDFLAGS="${cross_musl_ldflags}" \
315 ../musl-${ver}/configure \
316 --prefix=/usr \
317 --host=${tgt} \
318 ${cross_musl_configure_args}
320 make ${makejobs}
321 make DESTDIR=${wrksrc}/build_root/usr/${tgt} install
323 CFLAGS="-pipe -fPIC ${cross_musl_cflags}" \
324 CPPFLAGS="${cross_musl_cflags}" LDFLAGS="${cross_musl_ldflags}" \
325 ${tgt}-gcc -pipe -fPIC ${cross_musl_cflags} ${cross_musl_ldflags} -fpie \
326 -c ${XBPS_SRCPKGDIR}/musl/files/__stack_chk_fail_local.c \
327 -o __stack_chk_fail_local.o
328 ${tgt}-ar r libssp_nonshared.a __stack_chk_fail_local.o
329 cp libssp_nonshared.a ${wrksrc}/build_root/usr/${tgt}/usr/lib
331 touch ${wrksrc}/.musl_build_done
334 _void_cross_build_libucontext() {
335 [ -n "$cross_gcc_skip_go" ] && return 0
336 [ -f ${wrksrc}/.libucontext_build_done ] && return 0
338 local tgt=$1
339 local ver=$2
340 local arch incpath
342 msg_normal "Building libucontext for ${tgt}\n"
344 case "$tgt" in
345 x86_64*) arch=x86_64 ;;
346 i686*) arch=x86 ;;
347 powerpc64*) arch=ppc64 ;;
348 powerpc*) arch=ppc ;;
349 mips*64*) arch=mips64 ;;
350 mips*) arch=mips ;;
351 aarch64*) arch=aarch64 ;;
352 arm*) arch=arm ;;
353 riscv64*) arch=riscv64 ;;
354 s390x*) arch=s390x ;;
355 *) msg_error "Unknown libucontext arch for ${tgt}\n" ;;
356 esac
358 cd ${wrksrc}/libucontext-${ver}
359 # a terrible hack but seems to work for now
360 # we build a static-only library to prevent linking to a runtime
361 # since it's tiny it can be linked into libgo and we don't have
362 # to keep it around (which would possibly conflict with crossdeps)
363 incpath="${wrksrc}/build_root/usr/${tgt}/usr/include"
364 CC="${tgt}-gcc" AS="${tgt}-as" AR="${tgt}-ar" \
365 make ARCH=$arch libucontext.a \
366 CFLAGS="${cross_musl_cflags} -g0 -nostdinc -isystem ${incpath}"
368 cp libucontext.a ${wrksrc}/build_root/usr/${tgt}/usr/lib
370 touch ${wrksrc}/.libucontext_build_done
373 _void_cross_build_gcc() {
374 [ -f ${wrksrc}/.gcc_build_done ] && return 0
376 local tgt=$1
377 local ver=$2
379 msg_normal "Building gcc for ${tgt}\n"
381 # GIANT HACK: create an empty libatomic.a so gcc cross-compile
382 # below works.
383 ar r ${wrksrc}/build_root/usr/${tgt}/usr/lib/libatomic.a
385 mkdir -p ${wrksrc}/gcc_build
386 cd ${wrksrc}/gcc_build
388 local langs="c,c++,fortran,objc,obj-c++,ada,lto"
389 if [ -z "$cross_gcc_skip_go" ]; then
390 langs+=",go"
393 local extra_args
394 if [ -f ${wrksrc}/.musl_version ]; then
395 # otherwise glibc hosts get confused and use the gnu impl
396 extra_args+=" --enable-clocale=generic"
397 extra_args+=" --disable-symvers"
398 extra_args+=" --disable-gnu-unique-object"
399 extra_args+=" libat_cv_have_ifunc=no"
400 else
401 extra_args+=" --enable-clocale=gnu"
402 extra_args+=" --enable-gnu-unique-object"
405 # note on --disable-libquadmath:
406 # on some platforms the library is actually necessary for the
407 # fortran frontend to build, platforms where this is a problem
408 # should explicitly force libquadmath to be on via cross_gcc_configure_args
410 ../gcc-${ver}/configure \
411 --prefix=/usr \
412 --sbindir=/usr/bin \
413 --libdir=/usr/lib \
414 --libexecdir=/usr/lib \
415 --target=${tgt} \
416 --with-sysroot=/usr/${tgt} \
417 --with-build-sysroot=${wrksrc}/build_root/usr/${tgt} \
418 --enable-languages=${langs} \
419 --disable-nls \
420 --disable-multilib \
421 --disable-sjlj-exceptions \
422 --disable-libquadmath \
423 --disable-libmudflap \
424 --disable-libitm \
425 --disable-libvtv \
426 --disable-libsanitizer \
427 --disable-libstdcxx-pch \
428 --disable-libssp \
429 --enable-shared \
430 --enable-threads=posix \
431 --enable-__cxa_atexit \
432 --enable-linker-build-id \
433 --enable-libada \
434 --enable-lto \
435 --enable-default-pie \
436 --enable-default-ssp \
437 --with-gnu-ld \
438 --with-gnu-as \
439 --with-linker-hash-style=gnu \
440 ${extra_args} \
441 ${configure_args} \
442 ${cross_gcc_configure_args}
444 make ${makejobs}
446 touch ${wrksrc}/.gcc_build_done
449 _void_cross_test_ver() {
450 local proj=$1
451 local noerr=$2
452 local ver cver
453 for p in ${proj}-*; do
454 cver=${p#${proj}-}
455 if [ -z "$noerr" -a -n "$ver" ]; then
456 msg_error "multiple versions of ${proj} found: ${ver}, ${cver}"
458 ver=${cver}
459 done
460 if [ -d "${proj}-${ver}" ]; then
461 echo ${ver} > ${wrksrc}/.${proj}_version
462 return
464 if [ -z "$noerr" ]; then
465 msg_error "project ${proj} not available for build\n"
469 do_build() {
470 # Verify toolchain versions
471 cd ${wrksrc}
473 local binutils_ver linux_ver gcc_ver libc_ver libucontext_ver
474 local tgt=${sourcepkg/cross-}
476 export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
477 export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
479 # Disable explicit -fno-PIE, gcc/binutils/libc will figure this out itself.
480 export CFLAGS="${CFLAGS//-fno-PIE/}"
481 export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
482 export LDFLAGS="${LDFLAGS//-no-pie/}"
484 _void_cross_test_ver binutils
485 _void_cross_test_ver linux
486 _void_cross_test_ver gcc
488 binutils_ver=$(cat .binutils_version)
489 linux_ver=$(cat .linux_version)
490 gcc_ver=$(cat .gcc_version)
492 _void_cross_test_ver musl noerr
493 if [ ! -f .musl_version ]; then
494 _void_cross_test_ver glibc
495 libc_ver=$(cat .glibc_version)
496 else
497 libc_ver=$(cat .musl_version)
498 if [ -z "$cross_gcc_skip_go" ]; then
499 _void_cross_test_ver libucontext
500 libucontext_ver=$(cat .libucontext_version)
504 local sysroot="/usr/${tgt}"
506 # Prepare environment
507 cd ${wrksrc}
509 # Core directories for the build root
510 mkdir -p build_root/usr/{bin,lib,include,share}
511 mkdir -p build_root/usr/${tgt}/usr/{bin,lib,include,share}
513 # Host root uses host wordsize
514 ln -sf usr/lib build_root/lib
515 ln -sf usr/lib build_root/lib${XBPS_TARGET_WORDSIZE}
516 ln -sf lib build_root/usr/lib${XBPS_TARGET_WORDSIZE}
518 # Prepare target sysroot
519 ln -sf usr/lib build_root/${sysroot}/lib
520 ln -sf lib build_root/${sysroot}/usr/libexec
522 _void_cross_build_binutils ${tgt} ${binutils_ver}
524 # Prepare environment so we can use temporary prefix
525 local oldpath="$PATH"
526 local oldldlib="$LD_LIBRARY_PATH"
528 export PATH="${wrksrc}/build_root/usr/bin:$PATH"
529 export LD_LIBRARY_PATH="${wrksrc}/build_root/usr/lib:$PATH"
531 _void_cross_build_bootstrap_gcc ${tgt} ${gcc_ver}
532 _void_cross_build_kernel_headers ${tgt} ${linux_ver}
534 local ws=$(cat ${wrksrc}/.gcc_wordsize)
536 # Now that we know the target wordsize, prepare symlinks
537 ln -sf usr/lib ${wrksrc}/build_root/${sysroot}/lib${ws}
538 ln -sf lib ${wrksrc}/build_root/${sysroot}/usr/lib${ws}
540 if [ -f ${wrksrc}/.musl_version ]; then
541 _void_cross_build_musl ${tgt} ${libc_ver}
542 _void_cross_build_libucontext ${tgt} ${libucontext_ver}
543 else
544 _void_cross_build_glibc_headers ${tgt} ${libc_ver}
545 _void_cross_build_glibc ${tgt} ${libc_ver}
548 _void_cross_build_gcc ${tgt} ${gcc_ver}
550 # restore this stuff in case later hooks depend on it
551 export PATH="$oldpath"
552 export LD_LIBRARY_PATH="$oldldlib"
555 do_install() {
556 # We need to be able to access binutils in the root
557 local oldpath="$PATH"
558 local oldldlib="$LD_LIBRARY_PATH"
559 export PATH="${wrksrc}/build_root/usr/bin:$PATH"
560 export LD_LIBRARY_PATH="${wrksrc}/build_root/usr/lib:$PATH"
562 local tgt=${sourcepkg/cross-}
563 local sysroot="/usr/${tgt}"
564 local ws=$(cat ${wrksrc}/.gcc_wordsize)
566 # Core directories for the sysroot
568 # libexec is created for sysroot but not for dest, since in sysroot
569 # we configure glibc with separate libexec, elsewhere it's just lib
570 # and we want to delete the libexec from glibc afterwards to save space
571 mkdir -p ${DESTDIR}/${sysroot}/usr/{bin,lib,libexec,include,share}
572 # Sysroot base symlinks
573 ln -sf usr/bin ${DESTDIR}/${sysroot}/bin
574 ln -sf usr/lib ${DESTDIR}/${sysroot}/lib
575 ln -sf usr/lib ${DESTDIR}/${sysroot}/lib${ws}
576 ln -sf lib ${DESTDIR}/${sysroot}/usr/lib${ws}
577 ln -sf usr/include ${DESTDIR}/${sysroot}/include
579 # Install Linux headers
580 cd ${wrksrc}/linux-$(cat ${wrksrc}/.linux_version)
581 cp -a usr/include ${DESTDIR}/${sysroot}/usr
583 # Install binutils
584 cd ${wrksrc}/binutils_build
585 make install DESTDIR=${DESTDIR}
587 # Install final gcc
588 cd ${wrksrc}/gcc_build
589 make install DESTDIR=${DESTDIR}
591 # Move libcc1.so* to the sysroot
592 mv ${DESTDIR}/usr/lib/libcc1.so* ${DESTDIR}/${sysroot}/usr/lib
594 local gcc_ver=$(cat ${wrksrc}/.gcc_version)
595 local gcc_patch=${gcc_ver/_*}
596 local gcc_minor=${gcc_patch%.*}
597 local gcc_major=${gcc_minor%.*}
599 if [ -f ${wrksrc}/.musl_version ]; then
600 # Install musl
601 cd ${wrksrc}/musl_build
602 make DESTDIR=${DESTDIR}/${sysroot} install
604 # Remove useless headers
605 rm -rf ${DESTDIR}/usr/lib/gcc/${tgt}/*/include-fixed
607 # Make ld-musl.so symlinks relative
608 for f in ${DESTDIR}/${sysroot}/usr/lib/ld-musl-*.so.*; do
609 ln -sf libc.so ${f}
610 done
612 cp libssp_nonshared.a ${DESTDIR}/${sysroot}/usr/lib/
613 else
614 # Install glibc
615 cd ${wrksrc}/glibc_build
616 make install_root=${DESTDIR}/${sysroot} install install-headers
618 # Remove bad header
619 rm -f ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch}/include-fixed/bits/statx.h
622 # minor-versioned symlinks
623 mv ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch} \
624 ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_minor}
625 ln -sfr ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_minor} \
626 ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch}
628 # ditto for c++ headers
629 mv ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_patch} \
630 ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_minor}
631 ln -sfr ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_minor} \
632 ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_patch}
634 # Symlinks for gnarl and gnat shared libraries
635 local adalib=usr/lib/gcc/${tgt}/${gcc_patch}/adalib
636 mv ${DESTDIR}/${adalib}/libgnarl-${gcc_major}.so \
637 ${DESTDIR}/${sysroot}/usr/lib
638 mv ${DESTDIR}/${adalib}/libgnat-${gcc_major}.so \
639 ${DESTDIR}/${sysroot}/usr/lib
640 ln -sf libgnarl-${gcc_major}.so ${DESTDIR}/${sysroot}/usr/lib/libgnarl.so
641 ln -sf libgnat-${gcc_major}.so ${DESTDIR}/${sysroot}/usr/lib/libgnat.so
642 rm -vf ${DESTDIR}/${adalib}/libgna{rl,t}.so
644 # Remove libgomp library because it conflicts with libgomp and
645 # libgomp-devel packages
646 rm -f ${DESTDIR}/${sysroot}/usr/lib/libgomp*
648 # Remove libdep linker plugin because it conflicts with system binutils
649 rm -f ${DESTDIR}/usr/lib/bfd-plugins/libdep*
651 # Remove leftover symlinks
652 rm -f ${DESTDIR}/usr/lib${XBPS_TARGET_WORDSIZE}
653 rm -f ${DESTDIR}/lib*
654 rm -f ${DESTDIR}/*bin
655 # Remove unnecessary stuff
656 rm -rf ${DESTDIR}/${sysroot}/{sbin,etc,var,libexec}
657 rm -rf ${DESTDIR}/${sysroot}/usr/{sbin,share,libexec}
658 rm -rf ${DESTDIR}/usr/share
659 rm -f ${DESTDIR}/usr/lib*/libiberty.a
661 export PATH="$oldpath"
662 export LD_LIBRARY_PATH="$oldldlib"