From: Stuart Henderson Subject: lang/gcc adastrap: handle PORTS_PRIVSEP To: ports Cc: Pascal Stumpf Date: Fri, 11 Jul 2025 13:32:41 +0100 This adds ${_PBUILD} and ${_PFETCH} to set the relevant user when doing adastrap operations; they expand to the relevant sudo/doas command if PORTS_PRIVSEP=Yes, or nothing if PORTS_PRIVSEP=No, so it works in both cases. Uses the old 'sudo tee destfile > /dev/null' trick for the bit where it needs to work in a pipeline. ok? Index: 11/Makefile =================================================================== RCS file: /cvs/ports/lang/gcc/11/Makefile,v diff -u -p -r1.40 Makefile --- 11/Makefile 5 Jul 2025 14:32:33 -0000 1.40 +++ 11/Makefile 11 Jul 2025 12:29:05 -0000 @@ -283,16 +283,16 @@ GXX_PACKAGE = ${PACKAGE_REPOSITORY}/${MA .PHONY: adastrap adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE} ${GXX_PACKAGE} - mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs - cd ${WRKDIR}/prepare/bootstrap && tar xzf ${ADA_PACKAGE} - cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GCC_PACKAGE} - cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GXX_PACKAGE} - rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share} - rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-openbsd*/$V/include-fixed + ${_PBUILD} mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs + cd ${WRKDIR}/prepare/bootstrap && ${_PBUILD} tar xzf ${ADA_PACKAGE} + cd ${WRKDIR}/prepare/bootstrap && ${_PBUILD} tar xzf ${GCC_PACKAGE} + cd ${WRKDIR}/prepare/bootstrap && ${_PBUILD} tar xzf ${GXX_PACKAGE} + ${_PBUILD} rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share} + ${_PBUILD} rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-openbsd*/$V/include-fixed for f in \ `ldd ${WRKDIR}/prepare/bootstrap/libexec/gcc/*-openbsd*/$V/cc1 | \ awk '$$3 == "rlib" { print $$7 }'`; do \ - cp $$f ${WRKDIR}/prepare/bootstrap/system-libs/; \ + ${_PBUILD} cp $$f ${WRKDIR}/prepare/bootstrap/system-libs/; \ done cd ${WRKDIR}/prepare && tar cf - bootstrap | \ - xz -T0 > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}} + xz -T0 | ${_PFETCH} tee ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}} > /dev/null Index: 8/Makefile =================================================================== RCS file: /cvs/ports/lang/gcc/8/Makefile,v diff -u -p -r1.87 Makefile --- 8/Makefile 5 Jul 2025 14:32:33 -0000 1.87 +++ 8/Makefile 11 Jul 2025 12:29:05 -0000 @@ -256,16 +256,16 @@ GXX_PACKAGE = ${PACKAGE_REPOSITORY}/${MA .PHONY: adastrap adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE} ${GXX_PACKAGE} - mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs - cd ${WRKDIR}/prepare/bootstrap && tar xzf ${ADA_PACKAGE} - cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GCC_PACKAGE} - cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GXX_PACKAGE} - rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share} - rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-openbsd*/$V/include-fixed + ${_PBUILD} mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs + cd ${WRKDIR}/prepare/bootstrap && ${_PBUILD} tar xzf ${ADA_PACKAGE} + cd ${WRKDIR}/prepare/bootstrap && ${_PBUILD} tar xzf ${GCC_PACKAGE} + cd ${WRKDIR}/prepare/bootstrap && ${_PBUILD} tar xzf ${GXX_PACKAGE} + ${_PBUILD} rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share} + ${_PBUILD} rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-openbsd*/$V/include-fixed for f in \ `ldd ${WRKDIR}/prepare/bootstrap/libexec/gcc/*-openbsd*/$V/cc1 | \ awk '$$3 == "rlib" { print $$7 }'`; do \ - cp $$f ${WRKDIR}/prepare/bootstrap/system-libs/; \ + ${_PBUILD} cp $$f ${WRKDIR}/prepare/bootstrap/system-libs/; \ done cd ${WRKDIR}/prepare && tar cf - bootstrap | \ - xz -T0 > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}} + xz -T0 | ${_PFETCH} tee ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}} > /dev/null