This document describes how to update a port that uses one of the dependency-tracking port modules:
| Module | Ports | Generated file |
|---|---|---|
devel/cargo |
editors/msedit, sysutils/uutils |
crates.inc |
lang/go |
devel/checkmake, devel/crush, devel/github-cli, devel/shfmt, net/xd-torrent and the Charm CLI/TUI ports (devel/gum, devel/sequin, devel/soft-serve, net/wishlist, textproc/glow, ...) |
modules.inc |
devel/cabal |
devel/fourmolu, net/simplexmq, net/simplex-chat |
cabal.inc |
The generated file lists every dependency the build is allowed to use.
It is derived from upstream metadata, never edited by hand, and always
committed together with distinfo.
Regenerating the file requires network access. The regular build must
stay offline and must reproduce the build from distinfo alone.
-
Copy the port into the ports tree if it is not there yet:
doas ./fetch-ports.ksh --copy-only /usr/ports category/port
-
Bump the version variables in the
Makefile. Do not touch the generated dependency file in this step. -
Regenerate the dependency file with the module target described below. The per-module section shows where
make makesumsits in the sequence. -
Make sure
distinfocovers every new file. The generated file anddistinfomust always change together. -
Refresh the patches under
patches/and, for the cabal ports, the dependency patches underfiles/. Keep the repository convention: one target file per patch and anIndex:header. -
Run the full validation workflow:
make clean=all make extract make patch make configure make build make fake make update-plist make port-lib-depends-check make package
-
Run the test suite where the port provides one (
make do-test) and smoke-test the installed binaries. -
Keep this repository in sync with what was tested: it is the source that
fetch-ports.kshinstalls, andMakefile,distinfo, the generated file, patches andpkg/PLISTmust match the ports tree.
A make clean between regeneration and build avoids stale work
directories.
Example: editors/msedit.
crates.inc records every crate in MODCARGO_CRATES. Bump
GH_TAGNAME, PKGNAME and any version variables derived from them in
the Makefile first.
Regenerate the crate list:
cd /usr/ports/editors/msedit
make clean=all
make extract
make patch
make makesum
make modcargo-gen-crates
make modcargo-gen-crates > /tmp/crates.inc
cp /tmp/crates.inc crates.inc
make clean=all
make extract
make patch
make makesum
make modcargo-gen-crates-licenses
make modcargo-gen-crates-licenses > /tmp/crates.inc
mv /tmp/crates.inc crates.incNotes:
make modcargo-gen-cratesreads upstreamCargo.lockand prints oneMODCARGO_CRATESline per registry crate, without license comments. It needs the new upstream distfile, hence the firstmake makesum.make modcargo-gen-crates-licensesprints the same list annotated with the license found in each vendoredCargo.toml. It depends on the crates being downloaded, hence the secondmake makesum. Fix anyXXX missing licenseentry by checking the crate tarball.- Write to a temporary file first: redirecting into
crates.inctruncates a file thatmakeis reading. make modcargo-metadataregenerates the vendored crate metadata after manual crate changes; the wrapper target runs it as the build user.sysutils/uutilsis a group of subports, each building one uutils project from a singleCargo.lock, so themake modcargo-gen-cratessequence above applies inside each subport directory. Also refresh the pinned revision in the subportMakefile:GH_TAGNAMEfor the released projects, andAWK_COMMIT/INDEXMAP_COMMITorTAR_COMMIT/UUCORE_COMMITplus the matchingDIST_TUPLEentries for the unreleased ones.- If a dependency must stay at a version newer than what upstream
pins, list it in
MODCARGO_CRATES_UPDATE; the module runscargo update --packagefor each entry during configure.
Before building, check:
WANTLIB: cargo ports start from${MODCARGO_WANTLIB}and add the native libraries the crate build links against (for msedit, ICU).LIB_DEPENDS: native libraries discovered through pkg-config.MODCARGO_FEATURESandMODCARGO_NO_DEFAULT_FEATURESif upstream changed its default features.- Custom targets: msedit sets
MODCARGO_INSTALL = Noand installs${MODCARGO_TARGET_DIR}/release/edititself, and defines its owndo-testtarget.
Example: net/xd-torrent.
modules.inc records MODGO_MODULES and MODGO_MODFILES. Bump
MODGO_VERSION in the Makefile first. Some ports also carry the
version in DISTNAME, PKGNAME or MODGO_LDFLAGS.
Several Charm ports publish under the charm.land namespace with a
major-version suffix. Set MODGO_MODNAME to the full module path
(charm.land/gum/v2, charm.land/glow/v3) and keep DISTNAME on the
upstream project name; lang/go derives the proxy URL and the extracted
directory from MODGO_MODNAME.
Regenerate the module list:
cd /usr/ports/net/xd-torrent
make clean=all
make extract
make patch
make modgo-gen-modules
make modgo-gen-modules > /tmp/modules.inc
mv /tmp/modules.inc modules.inc
make makesumNotes:
-
To find the newest upstream version, run
make MODGO_VERSION=latest modgo-gen-modules > modules.incThe helper resolves the latest version through
proxy.golang.organd printsMODGO_VERSION = ... # add this to Makefile, not modules.incon stderr. Put that value in theMakefileand rerun the target. -
make makesumdownloads the module.zipand.modfiles listed inmodules.incintoDISTDIR/go_modulesand updatesdistinfo. -
MODGO_MODFILESlists older.modfiles that are needed to compute the build list but are not part of the final module graph. The helper fills both lists; do not merge them by hand. -
Update
MODGO_LDFLAGSwhen the path of the upstream version variable changes.devel/github-cli,devel/crushanddevel/checkmakeinject version and build metadata this way. -
For ports with
DIST_TUPLEreplacements (devel/github-clireplacessurveywith a patched fork), refresh the pinned commit and check whether thepre-buildreplace is still needed. -
Recheck
WANTLIB(c pthreadis typical),RUN_DEPENDS(for examplenet/i2pdfor xd-torrent) andpost-installhooks such as symlinks and generated manual pages.
Examples: devel/fourmolu, net/simplexmq and net/simplex-chat.
cabal.inc records MODCABAL_MANIFEST, the Hackage dependency set.
It is produced by a port-specific cabal-inc target that calls
cabal-bundler --openbsd and merges the result through
files/cabal-deps-merge.pl.
Bump the following before regenerating:
GH_TAGNAME,VandDISTNAMEfor the upstream release.MODCABAL_STEMandMODCABAL_VERSIONfor the package version on Hackage. It can differ from the upstream release version.MODCABAL_EXECUTABLESif the executable set changed.- The pinned dependency versions used by the project options and the
patches:
NETWORK_V,HTTP2_V,TLS_V,UNIX_TIME_V,CRYPTOSTORE_V,ENTROPY_V, andWITHERABLE_Vfornet/simplex-chat. - The
DIST_TUPLEcommit hashes for the vendored GitHub dependencies.
Regenerate the manifest:
cd /usr/ports/net/simplexmq
make clean=all
make extract
make patch
make makesum
make cabal-inc
make clean=all
make extract
make patch
make makesumNotes:
- The first
make makesumrecords checksums for the new upstream andDIST_TUPLEsnapshots;cabal-incdepends onpatch, which needs them. The second one adds the Hackage tarballs listed in the newcabal.incand drops stale entries. make cabal-incrunscabal update, computes the executable and test build plans, and writescabal.incin the port directory. It requires network access,devel/cabal-install,lang/ghcandcabal-bundler.CABAL_INC_HOMEkeeps the temporary cabal home insideWRKDIR.CABAL_INC_SKIPandCABAL_INC_EXTRAcontrol which packages are replaced by patched sources or forced to a fixed version.- Dependency patches may be skipped during
cabal-incwhen their tarballs are not fetched yet; they are applied by the next cleanmake patch, which is part of the validation workflow. - When a patched dependency moves to a new version, update the
matching
*_Vvariable and refresh the patch files that reference its path (TLS_PATCHES,HTTP2_PATCHES, the cryptostore, aeson, network, unix-time and entropy patches). Thefind ... -name '*.hs'loop inpost-patchnormalizes line endings before the dependency patches are applied. - Keep the
cabal.project.localstanzas,allow-newer: *and the*_CABAL_*option variables consistent; they are assembled inpost-patch,cabal-incanddo-test.
These ports have deep dependency trees, so a clean build takes a long
time (net/simplexmq builds two servers and a library and is around
two hours on amd64 with four jobs). Run the test suite with:
make do-testThe test plan must have been produced by the last cabal-inc run; the
first run needs network access for test-only dependencies.
- Version variables bumped in the
Makefile. - Generated file regenerated with the module target.
-
make makesumrun in the order the module section describes. -
make patchapplies cleanly, stale patches dropped. - Patches follow the repository format (one target file,
Index:header, SPDX identifier). -
make update-plistrun if the installed file set changed. -
make port-lib-depends-checkpasses. -
make packagesucceeds. -
make do-testpasses where available. - Package installs and the main binaries start.