Files
marfrit-packages/arch/distcc-avahi/PKGBUILD
T
test0r ef7911dd27
build and publish packages / distcc-avahi-aarch64 (push) Successful in 34s
build and publish packages / lmcp-any (push) Successful in 7s
build and publish packages / lmcp-debian (push) Successful in 5s
build and publish packages / claude-his-any (push) Successful in 8s
build and publish packages / claude-his-debian (push) Successful in 4s
distcc-avahi: fix FORTIFY buffer overflow in dcc_gcc_rewrite_fqn
pkgrel 16 builds ship an upstream distcc 3.4 bug: src/compile.c sizes
the rewritten-compiler-name buffer with strlen(argv[0] + 1) — pointer
arithmetic applied before strlen — under-allocating by 2 bytes. glibc
FORTIFY_SOURCE=2 catches the resulting overflow in strcat and aborts,
so every "distcc gcc ..." invocation dies on a modern Arch.

Patch moves the +1 outside the strlen, as intended.
Closes marfrit/marfrit-packages#3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:02:38 +02:00

80 lines
2.8 KiB
Bash

# Maintainer: Markus Fritsche <mfritsche@reauktion.de>
# Based on Arch Linux ARM's distcc PKGBUILD, rebuilt with --with-avahi
# so Zeroconf-announced compile servers are discoverable on the LAN.
#
# Why this exists: the ALARM aarch64 distcc binary package is built
# without --with-avahi, so the distccd --zeroconf flag is a no-op.
# The Arch x86_64 package is fine. This package replaces distcc on
# ALARM hosts with an avahi-aware build.
pkgname=distcc-avahi
_pkgname=distcc
pkgver=3.4
pkgrel=17
pkgdesc="Distributed compilation service for C, C++ and Objective-C (with Avahi/Zeroconf support)"
arch=('x86_64' 'aarch64')
url="https://github.com/distcc/distcc"
license=('GPL-2.0-only')
depends=('popt' 'python' 'avahi')
makedepends=('autoconf' 'automake' 'libtool' 'pkgconf' 'python-setuptools')
optdepends=('gtk3: for distccmon')
provides=("distcc=${pkgver}")
conflicts=('distcc')
replaces=('distcc')
backup=('etc/conf.d/distccd')
source=(
"${_pkgname}-${pkgver}.tar.gz::https://github.com/distcc/distcc/archive/refs/tags/v${pkgver}.tar.gz"
"distccd.conf"
"distccd.service"
"distcc.tmpfiles"
"fix-gcc-rewrite-fqn-overflow.patch"
)
sha256sums=(
'37a34c9555498a1168fea026b292ab07e7bb394715d87d8403e0c33b16d2d008'
'38cb1912bfa15efd762dd868e049bdbcd58f1a46065255bc4648f821ba516d65'
'a4f1d1bb21d61d41f22e918b448cfb852a6d95b0d3b922bd82805090cb2ce41a'
'd8aee2eb895c02a39e0f2b76fd4a5c9dce91405f1c443286ca324628eadbf3f1'
'7ff56af2ea505bfbf65ceeb0c8f752295f73ffb1173c26a6e978840fad04f651'
)
prepare() {
cd "${_pkgname}-${pkgver}"
patch -p1 -i "${srcdir}/fix-gcc-rewrite-fqn-overflow.patch"
autoreconf -fiv
}
build() {
cd "${_pkgname}-${pkgver}"
# distcc 3.4 has a const-qualifier discard that gcc 15+ flags as error
# under its own -Werror. Downgrade to a warning.
export CFLAGS="${CFLAGS} -Wno-error"
export CXXFLAGS="${CXXFLAGS} -Wno-error"
./configure \
--prefix=/usr \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--with-auth \
--with-avahi \
--without-libiberty \
--enable-rfc2553 \
--with-docdir="/usr/share/doc/${pkgname}"
make
# Archive tarball has no doc/ Makefile; skip man/html build.
[ -f doc/Makefile ] && make -C doc || true
}
check() {
cd "${_pkgname}-${pkgver}"
# Upstream test suite is flaky under makepkg; skip unless CHECK=1.
[ "${CHECK:-0}" = "1" ] && make check || true
}
package() {
cd "${_pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" prefix=/usr install
install -Dm644 ../distccd.conf "${pkgdir}/etc/conf.d/distccd"
install -Dm644 ../distccd.service "${pkgdir}/usr/lib/systemd/system/distccd.service"
install -Dm644 ../distcc.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/distcc.conf"
}