diff options
author | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-01 17:24:39 +0200 |
---|---|---|
committer | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-01 17:24:39 +0200 |
commit | 92d96da3407d9c357e8c70ee0676a740a953e7b0 (patch) | |
tree | 99756226f72d98c2a9f1c9d15f7e852328a71183 /arm-linux-gnueabi-glibc | |
download | gcc-arm-PKGBUILDs-92d96da3407d9c357e8c70ee0676a740a953e7b0.tar.gz gcc-arm-PKGBUILDs-92d96da3407d9c357e8c70ee0676a740a953e7b0.zip |
Diffstat (limited to 'arm-linux-gnueabi-glibc')
-rwxr-xr-x | arm-linux-gnueabi-glibc/PKGBUILD | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/arm-linux-gnueabi-glibc/PKGBUILD b/arm-linux-gnueabi-glibc/PKGBUILD new file mode 100755 index 0000000..10f4f07 --- /dev/null +++ b/arm-linux-gnueabi-glibc/PKGBUILD @@ -0,0 +1,163 @@ +# Contributor: Wojtek Kosior <kwojtus@protonmail.com> + +# TODO tools from ${_target}-binutils package could be used instead +# of building temporary binutils. I couldn't get them to work easily, +# however. If You can (and have time), fix it. + +# TODO There should be some switch to disable building of docs. +# It'd speed up the build + enable us to remove doxygen from depends + +_target=arm-linux-gnueabi +pkgname=${_target}-glibc +pkgver=2.25 +pkgrel=1 +pkgdesc="The GNU C Library ARM GNU/Linux EABI target" +arch=(any) +license=('GPL-3' 'LGPL-3') +url="https://gcc.gnu.org" +groups=('cross-devel') +depends=("glibc-source=$pkgver" 'gcc-source' 'binutils-source') +makedepends=('gcc-ada' 'doxygen') +# The following are checkdepends of gcc. They should only get +# uncommented if we decide to check the temporary compiler. +# checkdepends=('dejagnu' 'inetutils') +options=('!strip' 'staticlibs') + +prepare() { + cd "${srcdir}" + prepare-gcc-source . + prepare-glibc-source . + prepare-binutils-source . + + # hack! - some configure tests for header files using "$CPP $CPPFLAGS" + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" \ + gcc-*/{libiberty,gcc}/configure binutils-*/libiberty/configure + + mkdir -p {gcc,glibc,binutils}_build cross_tools +} + +build() { + # Build primitive binutils and gcc for building glibc + cd "${srcdir}/binutils_build" + + ../binutils-*/configure \ + --prefix="${srcdir}/cross_tools" \ + --with-sysroot="${srcdir}/cross_tools" \ + --with-lib-path="${srcdir}/cross_tools/lib" \ + --target=${_target} \ + --disable-gdb \ + --disable-nls \ + --disable-werror \ + --disable-multilib \ + --disable-threads \ + --disable-gold # or could we enable it and use gold for glibc later? + + make configure-host + make + make install + + cd "${srcdir}/gcc_build" + + # using -pipe causes spurious test-suite failures + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565 + # But for now we're not testing this temporary compiler, + # so the next 2 lines stay commented-out :) + # CFLAGS=${CFLAGS/-pipe/} + # CXXFLAGS=${CXXFLAGS/-pipe/} + + ../gcc-*/configure \ + --target=${_target} \ + --prefix="${srcdir}/cross_tools" \ + --with-newlib \ + --without-headers \ + --disable-nls \ + --disable-shared \ + --disable-multilib \ + --disable-decimal-float \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ \ + --with-bugurl=https://issues.hyperbola.info/ \ + --with-system-zlib \ + --with-glibc-version=2.11 + + # Perhaps `make all-gcc target-libgcc` would be the right thing? + make + make install + + cd "${srcdir}/glibc_build" + + # If (for example) we're building glibc for arm and CFLAGS contains + # -march=x86_64, it shall break configure. That's why we remove -march= flag. + # -mtune=generic is also not supported on some arches. + # Warning: extglob option in bash must be enabled for this + # pattern matching to work (can be done using shopt builtin). + CFLAGS=${CFLAGS/-march=+([^[:space:]])/} + CFLAGS=${CFLAGS/-mtune=+([^[:space:]])/} + + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=[[:digit:]]/} + + echo "slibdir=/lib" > configparms + echo "rtlddir=/lib" >> configparms + echo "sbindir=/usr/sbin" >> configparms + echo "rootsbindir=/sbin" >> configparms + echo "vardbdir=/var/lib/misc" >> configparms + + ../glibc-*/configure \ + --prefix=/usr \ + --includedir=/include \ + --libdir=/lib \ + --libexecdir=/libexec \ + --with-bugurl=https://issues.hyperbola.info/ \ + --enable-add-ons \ + --enable-obsolete-rpc \ + --enable-kernel=2.6.32 \ + --enable-bind-now \ + --disable-profile \ + --enable-stackguard-randomization \ + --enable-stack-protector=strong \ + --enable-lock-elision \ + --enable-multi-arch \ + --disable-werror \ + --host=${_target} \ + --with-headers=/usr/${_target}/include \ + --with-binutils="${srcdir}/cross_tools/bin/" \ + CC="${srcdir}/cross_tools/bin/${_target}-gcc" + + echo "build-programs=no" >> configparms + make +} + +package() { + cd "${srcdir}/glibc_build" + + make install_root="${pkgdir}/usr/${_target}" install + + rm -r "${pkgdir}/usr/${_target}/"{etc,var,usr} + + STRIP="${srcdir}/cross_tools/bin/${_target}-strip" + + # Aside from using different strip tool, we do all the stripping the same, as it + # is done for native glibc. Perhaps it is wrong. If You know better, change it. + + if check_option 'debug' n; then + find "${pkgdir}/usr/${_target}/bin" -type f -executable -exec \ + "$STRIP" $STRIP_BINARIES {} + 2> /dev/null || true + find "${pkgdir}/usr/${_target}/lib" -name '*.a' -type f -exec \ + "$STRIP" $STRIP_STATIC {} + 2> /dev/null || true + + # Do not strip these for gdb and valgrind functionality, but strip the rest. + find "$pkgdir"/usr/${_target}/lib \ + -not -name 'ld-*.so' \ + -not -name 'libc-*.so' \ + -not -name 'libpthread-*.so' \ + -not -name 'libthread_db-*.so' \ + -name '*-*.so' -type f -exec "$STRIP" $STRIP_SHARED {} + 2> /dev/null || true + fi +} |