Adopt BSD make ports framework

This commit is contained in:
Michal S.
2026-07-30 22:39:06 +01:00
parent 6dfbfa1938
commit 89399dc6b4
13 changed files with 433 additions and 36 deletions
+16 -25
View File
@@ -2,32 +2,23 @@
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
found=0
for directory in "$root"/ports/*; do
[ -d "$directory" ] || continue
[ "${directory##*/}" != README.md ] || continue
found=1
name=${directory##*/}
case "$name" in
""|[!a-z]*|*[!a-z0-9-]*)
printf '%s\n' "invalid port directory name: $name" >&2
[ -f "$root/ports/Mk/mouse.port.mk" ]
[ -x "$root/ports/Mk/Scripts/check-plist.sh" ]
[ -x "$root/ports/Mk/Scripts/checksum.sh" ]
[ -x "$root/ports/Mk/Scripts/fetch.sh" ]
[ -x "$root/ports/Mk/Scripts/install-depends.sh" ]
[ -x "$root/ports/Mk/Scripts/package.sh" ]
find "$root/ports" -mindepth 2 -maxdepth 2 -type d \
! -path "$root/ports/Mk/*" -print |
while IFS= read -r port; do
for file in Makefile distinfo pkg-plist; do
[ -f "$port/$file" ] || {
printf '%s\n' "missing $file: $port" >&2
exit 1
;;
esac
[ -f "$directory/port.conf" ] || {
printf '%s\n' "missing recipe: ports/$name/port.conf" >&2
exit 1
}
[ -x "$directory/build.sh" ] || {
printf '%s\n' "missing executable build script: ports/$name/build.sh" >&2
exit 1
}
sh -n "$directory/build.sh"
}
done
done
if [ "$found" -eq 0 ]; then
printf '%s\n' "ports collection is empty"
else
printf '%s\n' "ports layout check passed"
fi
printf '%s\n' "ports layout checks passed"
+13
View File
@@ -0,0 +1,13 @@
PORTNAME= framework-test
PORTVERSION= 1.0.0
CATEGORIES= tests
MASTER_SITES= http://example.invalid/
DISTFILES= framework-test.c
NO_EXTRACT= yes
.include "${.PARSEDIR}/../ports/Mk/mouse.port.mk"
check:
@test "${PORTNAME}" = framework-test
@test "${PORTSDIR}" = "${.CURDIR}/ports"
@test "${PORTORIGIN}" = tests/framework-test