Files
lotherk 719c436f5c pkgsrc: build from the source tree, no archive
The recipe set DISTFILES and built from a tarball that tools/ext-dist.sh
made, and its distinfo had to be regenerated after every commit.  It now
does what pkgsrc itself does for a package that lives in a tree (net/fetch,
pkgtools/pkg_install): DISTFILES= # empty, do-extract fills WRKSRC.

The copy is made by tools/ext-extract.sh (called from do-extract), not by
cp -R: a work directory is extracted once, so a plain copy would keep the
files of the commit it was extracted from.

Verified: bmake -C pkgsrc/misc/splinter package built splinter-0.1.tgz in
build/packages/All with no distinfo present.
2026-11-23 19:50:20 +00:00

80 lines
3.6 KiB
Makefile

# $Makronix$
#
# splinter -- the project's own C99/POSIX agent harness.
#
# The source is not a tarball: it is ext/src/splinter in this repository, the
# tree that git tracks and a person edits. pkgsrc builds it from there the way
# net/fetch and pkgtools/pkg_install build from their files/ directory -- no
# DISTFILES, no distinfo, no archive to regenerate after a commit, and
# `do-extract' puts the tree into WRKSRC. Build output stays in the work
# directory (tools/pkgsrc-cross.mk.conf: WRKOBJDIR), never in the source.
#
# The mirror in pkgsrc/misc/splinter is made by tools/ext-sync.sh: symlinks to
# this file, so this is the only copy of the recipe.
DISTNAME= splinter-0.1
CATEGORIES= misc
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= lotherk@lother.io
COMMENT= C99/POSIX agent harness with a curses interface
LICENSE= modified-bsd
# The tree this recipe belongs to: three levels above the directory pkgsrc
# builds in, which is /home/lotherk/src/makronix here, /mnt inside the build
# chroot and /usr/src on an installed system -- the same relative position in
# all three, so nothing has to be passed in. `pwd -P': pkgsrc refuses a WRKDIR
# path that is not canonical ("must be canonical"), and the mirror in pkgsrc/ is
# reached through a symlink.
_MAKRONIX_TOP!= cd ${.CURDIR}/../../.. && pwd -P
SPLSRC= ${_MAKRONIX_TOP}/ext/src/splinter
# The top Makefile is POSIX make; it runs the vendored NetBSD curses through
# $(MAKE) -f GNUmakefile, which is GNU make. The build host's GNU make is
# what USE_TOOLS brings; the target compiler comes from pkgsrc's wrappers.
USE_TOOLS+= gmake
MAKE_PROGRAM= ${GMAKE}
NO_CONFIGURE= yes
NO_BUILDLINK= yes
BUILD_TARGET= all
INSTALL_TARGET= install
MAKE_FLAGS+= PREFIX=${PREFIX}
MAKE_FLAGS+= DESTDIR=${DESTDIR}
# splinter's Makefile has its own CFLAGS default: the dialect, the include
# paths of the source tree and -fPIC. A CFLAGS on the command line replaces
# that default, so the package's flags are appended here. No -Werror: a
# warning in the distribution is not a reason to stop the build. One line
# and escaped spaces: a continuation ate the space before -fPIC (measured
# 2026-11-17: "make: PIC -Iinclude ... No such file or directory").
SPL_CFLAGS= -std=c99\ -D_POSIX_C_SOURCE=200809L\ -D_XOPEN_SOURCE=700\ -D_NETBSD_SOURCE\ -fPIC\ -Iinclude\ -Isrc/backend\ -Isrc/frontend\ -Ivendor/libmcp\ -Ivendor/netbsd-curses/libcurses
MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}\ ${SPL_CFLAGS}
# libsplinter.so is what the binaries and the plugins link against
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib
MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
MAKE_FLAGS+= LIBS=-lpthread
# NetBSD's own curses, not the vendored copy: the base system has libcurses
# and libterminfo, and linking them keeps the package small and the build
# free of tools that must run while it builds (the vendored tree's nbperf is
# a target binary in a cross build). The project's Linux build keeps the
# vendored default (Konrad, 2026-11-17: "nur auf linux eigenes curses").
MAKE_FLAGS+= CURSES_LIB=-lcurses\ -lterminfo
# Empty: nothing in the source tree has to be built before linking. The
# Makefile defaults it to $(CURSES_LIB) for the vendored tree.
MAKE_FLAGS+= CURSES_DEP=""
# The source tree as it is, without the history: a .git in WRKSRC would be a
# copy of the submodule's repository inside a package build.
# The copy is made by a script, not by ${CP} -R: pkgsrc extracts once, and
# a commit after that never reached the work directory (tools/ext-extract.sh).
do-extract:
${RUN}${SH} ${_MAKRONIX_TOP}/tools/ext-extract.sh ${SPLSRC} ${WRKSRC}
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"