diff --git a/cross/arch-bin-masquerade/APKBUILD b/cross/arch-bin-masquerade/APKBUILD new file mode 100644 index 000000000..3655ed8c9 --- /dev/null +++ b/cross/arch-bin-masquerade/APKBUILD @@ -0,0 +1,43 @@ +# This package gets installed in the native and foreign arch chroots. +# It creates files like /usr/lib/arch-bin-masquerade/armhf/gcc, which +# point in the native chroot to the armhf-cross-compiler, and in the +# armhf chroot to /usr/bin/gcc. That way compilation works fine, even +# when distcc gets the absolute path to the compiler passed (ccache does +# that). + +pkgname=arch-bin-masquerade +pkgver=1 +pkgrel=0 +pkgdesc="Wrappers for ccache + distcc (native and foreign chroots)" +url="https://postmarketOS.org" +arch="all" +license="MIT" +options="!check !tracedeps" + +package() { + # Architectures and binaries + _archs="x86_64 armhf aarch64" + _bins="c++ cc cpp g++ gcc" + + # Iterate over architectures + for _arch in $_archs; do + # Create the arch-specific bin folder + _hostspec="$(arch_to_hostspec $_arch)" + _bindir="$pkgdir/usr/lib/arch-bin-masquerade/$_arch" + mkdir -p "$_bindir" + cd "$_bindir" + + # Iterate over binaries and create wrappers + for _bin in $_bins; do + { + echo "#!/bin/sh" + if [ "$_arch" == "$CARCH" ]; then + echo "exec /usr/bin/${_bin} \"\$@\"" + else + echo "exec /usr/bin/${_hostspec}-${_bin} \"\$@\"" + fi + } > "$_bin" + chmod +x "$_bin" + done + done +} diff --git a/cross/ccache-cross-symlinks/APKBUILD b/cross/ccache-cross-symlinks/APKBUILD index af7107fbf..cc2e8c2ac 100644 --- a/cross/ccache-cross-symlinks/APKBUILD +++ b/cross/ccache-cross-symlinks/APKBUILD @@ -1,16 +1,16 @@ -# Maintainer: Oliver Smith -# NOTE: This could probably be upstreamed to the official ccache aport. +# This package gets installed in the native chroot only. When cross- +# compiling packages in the native chroot (e.g. kernel packages), the +# cross-compiler does not get called directly, but wrapped through +# ccache, which can then cache the results. pkgname=ccache-cross-symlinks pkgver=1 -pkgrel=3 +pkgrel=4 pkgdesc="Enable ccache for cross-compilers with symlinks" url="https://ccache.samba.org/" arch="noarch" license="MIT" depends="ccache" -makedepends="" -source="" options="!check" package() { diff --git a/cross/gcc-cross-wrappers/APKBUILD b/cross/gcc-cross-wrappers/APKBUILD deleted file mode 100644 index 52c37dc7f..000000000 --- a/cross/gcc-cross-wrappers/APKBUILD +++ /dev/null @@ -1,28 +0,0 @@ -pkgname=gcc-cross-wrappers -pkgver=1 -pkgrel=1 -pkgdesc="GCC wrappers pointing to cross-compilers (for distcc + ccache)" -url="https://github.com/postmarketOS" -arch="noarch" -license="MIT" -depends="" -makedepends="" -source="" -options="!check" - -package() { - local _archs="armhf aarch64" - local _bins="c++ cc cpp g++ gcc" - for _arch in $_archs; do - _bindir="$pkgdir/usr/lib/gcc-cross-wrappers/$_arch/bin" - _hostspec="$(arch_to_hostspec $_arch)" - mkdir -p "$_bindir" - for _bin in $_bins; do - { - echo "#!/bin/sh" - echo "${_hostspec}-${_bin} \"\$@\"" - } > $_bindir/$_bin - chmod +x $_bindir/$_bin - done - done -}