Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: print/lilypond: add builddoc pseudo flavor
To:
Matthias Kilian <kili@outback.escape.de>
Cc:
ports@openbsd.org
Date:
Thu, 8 Jan 2026 10:17:55 +0000

Download raw body.

Thread
On 2026/01/07 22:56, Matthias Kilian wrote:
> Hi,
> 
> this adds a pseudo flavor 'builddoc' to lilypond, not meant to be
> used by mere mortals, but to make it easier to build the documentation,
> run tests and check for regressions when adding or updating build
> dependencies.
> 
> For example, I'd like to experiment with extractpdfmark (not yet
> in the ports tree), which is recommended to get smaller PDF output
> in case many little PDF snippets are included.
> 
> The normal (unflavored) build still works without flaws.
> 
> Any objections?

I realise this is a bit of a special case as it's unlikely to package
anyway without PLIST-doc changes, but I'd expect something that changes
the contents of a package to use a flavour rather than pseudo-flavour
(which normally just turns some subpackage on/off).

As I wouldn't expect -main to change, only -doc, I'd use

FULLPKGNAME-main= lilypond-${VERSION}
FULLPKGPATH-main= print/lilypond,-main


> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/print/lilypond/Makefile,v
> diff -u -p -r1.67 Makefile
> --- Makefile	19 Aug 2025 11:42:46 -0000	1.67
> +++ Makefile	7 Jan 2026 21:32:26 -0000
> @@ -9,10 +9,20 @@ PKGNAME-main=		lilypond-${VERSION}
>  PKGNAME-docs=		lilypond-docs-${VERSION}
>  CATEGORIES=		print
>  
> +# For testing purposes only. Expect changes to PLIST-doc, because the
> +# downloaded documentation has been built with a much older version of
> +# texi2html.
> +# Don't try to build with MAKE_JOBS set to something > 1.
> +PSEUDO_FLAVORS=		builddoc
> +FLAVOR?=
> +
>  URW_V=			20200910
>  DISTFILES=		${DISTNAME}.tar.bz2
> +.if !${FLAVOR:Mbuilddoc}
>  DISTFILES.doc=		${DISTNAME-docs}.tar.xz
> -DISTFILES.urw =		urw-base35-fonts-${URW_V}.tar.gz
> +.endif
> +DISTFILES.urw=		urw-base35-fonts-${URW_V}.tar.gz
> +SUPDISTFILES.doc=	${DISTNAME-docs}.tar.xz
>  EXTRACT_ONLY=		${DISTFILES} ${DISTFILES.urw}
>  
>  MULTI_PACKAGES=		-main -docs
> @@ -43,9 +53,11 @@ CONFIGURE_ENV=		AUTOCONF_VERSION=${AUTOC
>  			GUILE_FLAVOR=guile-2.2 \
>  			LDFLAGS=-L${LOCALBASE}/lib
>  CONFIGURE_ARGS+=	--disable-debugging \
> -			--disable-documentation \
>  			--disable-optimising \
>  			--disable-pipe
> +.if !${FLAVOR:Mbuilddoc}
> +CONFIGURE_ARGS+=	--disable-documentation
> +.endif
>  
>  USE_GMAKE=		Yes
>  MAKE_FILE=		GNUmakefile
> @@ -76,39 +88,69 @@ BUILD_DEPENDS=		print/fontforge \
>  			devel/gettext,-tools \
>  			devel/autoconf/${AUTOCONF_VERSION} \
>  			${RUN_DEPENDS}
> +.if ${FLAVOR:Mbuilddoc}
> +# rsync is used by a script for just copying things around locally.
> +# coreutils is used for 'cp --link ...' (see GNUmakefile.in, 154)
> +# (both to be fixed upstream, who is known to ignore standards since
> +# decades).
> +BUILD_DEPENDS+=		graphics/ImageMagick \
> +			net/rsync \
> +			print/texinfo \
> +			sysutils/coreutils \
> +			textproc/texi2html
> +.endif
>  
>  SUBST_VARS+=		VERSION
>  
>  ALL_TARGET=		all bytecode
>  INSTALL_TARGET+=	install install-bytecode
> -
> -# Extract the documentation distfiles.
> +.if ${FLAVOR:Mbuilddoc}
> +ALL_TARGET+=		doc
> +INSTALL_TARGET+=	install-doc
> +.endif
> +
> +# Extract the documentation distfiles or, when building with the
> +# builddoc flavor, ensure some tools from coreutils, findutils and
> +# texinfo packages are used.
>  # Remove files generated by bison to avoid some recompilations
>  # during fake stage.
>  post-extract:
> +.if ${FLAVOR:Mbuilddoc}
> +.  for p in cp find makeinfo pdftexi2dvi texi2dvi texi2pdf texindex
> +	@ln -s ${LOCALBASE}/bin/g$p ${WRKDIR}/bin/$p
> +.  endfor
> +.else
>  	@xz -cd ${FULLDISTDIR}/${DISTNAME-docs}.tar.xz | \
>  		pax -rs '!^\.!${WRKDIR}/docs!'
> +.endif
>  	@rm -rf ${WRKSRC}/lily/out
>  
>  LILYFONTDIR=	${PREFIX}/share/lilypond/${VERSION}/fonts/otf
>  TEXGYREDIR=	${LOCALBASE}/share/texmf-dist/fonts/opentype/public/tex-gyre
>  URWDIR=		${WRKDIR}/urw-base35-fonts-${URW_V}/fonts
> +
>  post-install:
> +.if ${FLAVOR:Mbuilddoc}
> +	cd ${PREFIX}/share/doc/lilypond && \
> +		mv html ${VERSION}
> +	rm -rf ${PREFIX}/info
> +.else
>  	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/lilypond/${VERSION}
>  	umask 022 && cp -R ${WRKDIR}/docs/share/doc/lilypond/html/* \
>  		${PREFIX}/share/doc/lilypond/${VERSION}
>  	for f in ${WRKDIR}/docs/share/man/man1/*; do \
>  		${INSTALL_MAN} $$f ${PREFIX}/man/man1; \
> -	done; \
> +	done
> +.endif
>  	for f in cursor heros schola; do \
>  		for s in regular bold bolditalic italic; do \
>  			${INSTALL_DATA} ${TEXGYREDIR}/texgyre$$f-$$s.otf \
>  				${LILYFONTDIR}; \
>  		done; \
> -	done; \
> +	done
>  	for s in Roman BdIta Bold Italic; do \
>  		${INSTALL_DATA} ${URWDIR}/C059-$$s.otf ${LILYFONTDIR}; \
> -	done; \
> +	done
>  	for f in NimbusMonoPS NimbusSans; do \
>  		for s in Regular Bold BoldItalic Italic; do \
>  			${INSTALL_DATA} ${URWDIR}/$$f-$$s.otf \
> @@ -116,8 +158,9 @@ post-install:
>  		done; \
>  	done
>  
> -
> -# Regression tests disabled, because we don't build the documentation.
> +# Regression tests disabled for normal builds.
> +.if !${FLAVOR:Mbuilddoc}
>  NO_TEST=		Yes
> +.endif
>  
>  .include <bsd.port.mk>
> Index: patches/patch-scripts_build_build-doc-tree_sh
> ===================================================================
> RCS file: patches/patch-scripts_build_build-doc-tree_sh
> diff -N patches/patch-scripts_build_build-doc-tree_sh
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-scripts_build_build-doc-tree_sh	7 Jan 2026 21:32:26 -0000
> @@ -0,0 +1,9 @@
> +Index: scripts/build/build-doc-tree.sh
> +--- scripts/build/build-doc-tree.sh.orig
> ++++ scripts/build/build-doc-tree.sh
> +@@ -1,4 +1,4 @@
> +-#!/bin/bash
> ++#!/bin/sh
> + 
> + DEST="$1"
> + shift
>