Close PortMaster_CFW.md guide gaps: sudo, vmstat, libjpeg.so.62, perf

Verification of the running R36S against docs/PortMaster_CFW.md flagged
a few required/recommended/nice-to-have items missing. Closes four:

sudo (REQUIRED, section 2): ArchR runs everything as root so PortMaster
sets ESUDO="" and "$ESUDO" ports work, but the guide lists sudo/doas as
required and the live port log printed "No sudo present." Ships a
/usr/bin/sudo shim (archr package, ROCKNIX/dArkOS pattern) that strips
sudo's own options and execs the command as the already-root user.

libjpeg.so.62 (commonly expected, section 4): the base libjpeg-turbo is
built WITH_JPEG8=ON (SONAME libjpeg.so.8); ports compiled against
standard libjpeg-turbo expect libjpeg.so.62. New compat-libjpeg62
package builds the same 3.0.1 source WITH_JPEG8=OFF into /usr/lib/compat
and is pulled in via portmaster-compat-libs; archr-compat-symlinks then
exposes it in the default path.

vmstat (nice-to-have, section 10): procps-ng shipped only free/top/ps;
add src/vmstat to the build + install so memory-pressure monitoring is
available.

perf_event_paranoid (nice-to-have, section 10): ship
sysctl.d/90-archr-perf.conf setting kernel.perf_event_paranoid=1 so perf
can sample userspace CPU events (default 2 blocks non-root profiling).

(ltrace, the remaining nice-to-have, is being build-tested separately;
virtual/debug already documents why upstream 0.7.3 was excluded.)
This commit is contained in:
Douglas Teles
2026-06-24 20:45:28 -03:00
parent 1175e2b5a9
commit b92d67b9dd
5 changed files with 100 additions and 3 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# sudo shim. ArchR is a single-user handheld where everything already
# runs as root, so there is no privilege boundary to cross. PortMaster's
# control.txt sets ESUDO="" when no real sudo is found and ports that use
# "$ESUDO" work fine, but docs/PortMaster_CFW.md lists sudo/doas as
# REQUIRED and a handful of ports (and third-party scripts) call `sudo`
# directly. This shim satisfies them: it strips sudo's own options and
# execs the requested command unchanged.
#
# Pattern follows ROCKNIX/dArkOS, which ship the same root-context shim.
# No arguments -> behave like `sudo` with nothing to do.
[ $# -eq 0 ] && exit 0
while [ $# -gt 0 ]; do
case "$1" in
# Options that take a separate argument.
-u|-g|-p|-C|-r|-t|-U|-h|--user|--group|--prompt|--close-from|--role|--type|--other-user|--host)
shift 2
;;
# `--` ends option processing; the command follows.
--)
shift
break
;;
# --opt=value forms and any other long/short flag: drop and continue.
--*=*|--*|-*)
shift
;;
# First non-option token is the command to run.
*)
break
;;
esac
done
[ $# -eq 0 ] && exit 0
exec "$@"
@@ -0,0 +1,8 @@
# perf profiling for the PortMaster/port-dev community.
#
# docs/PortMaster_CFW.md (section 10) recommends perf_event_paranoid <= 1
# so `perf` can sample CPU events without full root context; the default
# of 2 blocks non-root CPU profiling. 1 keeps kernel-address profiling
# restricted while allowing userspace CPU sampling, which is what
# flame-graphing a port needs.
kernel.perf_event_paranoid = 1
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024-present ArchR (https://github.com/archr-linux/Arch-R)
PKG_NAME="compat-libjpeg62"
PKG_VERSION="3.0.1"
PKG_SHA256="5b9bbca2b2a87c6632c821799438d358e27004ab528abf798533c15d50b39f82"
PKG_LICENSE="BSD"
PKG_SITE="https://libjpeg-turbo.org/"
PKG_URL="https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="libjpeg-turbo 3.0.1 built with the classic IJG v6b ABI (libjpeg.so.62) for the PortMaster compat layer. ArchR's base libjpeg-turbo ships the jpeg8 ABI (libjpeg.so.8); ports compiled against standard libjpeg-turbo expect libjpeg.so.62 (PortMaster_CFW.md section 4, 'commonly expected'). Installed to /usr/lib/compat and exposed in the default path by archr-compat-symlinks."
PKG_TOOLCHAIN="cmake"
PKG_BUILD_FLAGS="+pic"
# Default WITH_JPEG8=OFF yields the SONAME libjpeg.so.62 (vs the base
# package's WITH_JPEG8=ON which yields libjpeg.so.8). TurboJPEG and the
# CLI tools are not needed for the compat shim.
PKG_CMAKE_OPTS_TARGET="-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DENABLE_STATIC=OFF \
-DENABLE_SHARED=ON \
-DWITH_JPEG8=OFF \
-DWITH_TURBOJPEG=OFF"
if target_has_feature "(neon|sse)"; then
PKG_CMAKE_OPTS_TARGET+=" -DWITH_SIMD=ON"
else
PKG_CMAKE_OPTS_TARGET+=" -DWITH_SIMD=OFF"
fi
post_makeinstall_target() {
# Keep only the versioned libjpeg.so.62 in the compat layer; the base
# libjpeg-turbo owns /usr/lib/libjpeg.so.8, so we must not leave any
# libjpeg in /usr/lib that would collide at image-merge time.
mkdir -p ${INSTALL}/usr/lib/compat
if compgen -G "${INSTALL}/usr/lib/libjpeg.so.62*" > /dev/null; then
cp -a ${INSTALL}/usr/lib/libjpeg.so.62* ${INSTALL}/usr/lib/compat/
fi
rm -rf ${INSTALL}/usr/include
rm -rf ${INSTALL}/usr/bin
rm -rf ${INSTALL}/usr/share
rm -rf ${INSTALL}/usr/lib/pkgconfig
rm -rf ${INSTALL}/usr/lib/cmake
rm -f ${INSTALL}/usr/lib/libjpeg.so*
rm -f ${INSTALL}/usr/lib/libturbojpeg.so*
}
@@ -7,8 +7,8 @@ PKG_ARCH="aarch64"
PKG_LICENSE="GPL-2.0"
PKG_SITE="https://github.com/archr-linux/Arch-R"
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain compat-codec2 compat-x264 compat-x265"
PKG_LONGDESC="Meta-pacote: agrega libcodec2.so.0.9 + libx264.so.160 + libx265.so.192 (SONAMEs Debian 11/darkOS exigidos pelo PortMaster_CFW.md) compilados do upstream para /usr/lib/compat."
PKG_DEPENDS_TARGET="toolchain compat-codec2 compat-x264 compat-x265 compat-libjpeg62"
PKG_LONGDESC="Meta-pacote: agrega libcodec2.so.0.9 + libx264.so.160 + libx265.so.192 + libjpeg.so.62 (SONAMEs Debian 11/darkOS exigidos pelo PortMaster_CFW.md) compilados do upstream para /usr/lib/compat."
PKG_TOOLCHAIN="manual"
PKG_SECTION="virtual"
@@ -3,11 +3,14 @@
. ${ROOT}/packages/tools/procps-ng/package.mk
PKG_MAKE_OPTS_TARGET="src/free src/top/top src/ps/pscommand library/libproc2.la library/libproc2.pc"
PKG_MAKE_OPTS_TARGET="src/free src/vmstat src/top/top src/ps/pscommand library/libproc2.la library/libproc2.pc"
makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp -P ${PKG_BUILD}/.${TARGET_NAME}/src/free ${INSTALL}/usr/bin
# vmstat: memory-pressure monitoring, a PortMaster_CFW.md nice-to-have
# dev tool. procps-ng ships the source; just build+install the binary.
cp -P ${PKG_BUILD}/.${TARGET_NAME}/src/vmstat ${INSTALL}/usr/bin
cp -P ${PKG_BUILD}/.${TARGET_NAME}/src/top/top ${INSTALL}/usr/bin
cp -P ${PKG_BUILD}/.${TARGET_NAME}/src/ps/pscommand ${INSTALL}/usr/bin/ps