Files
makronix/Makefile
T
lotherk 93aa5bacf2 MCDE: make debian / debian-install -- the desktop as one Debian package
Konrad, 2026-11-22: "i want mcde to support 'make debian' and it'll fully
create and download all required build dependencies and shit and make debian
debian-install would make the deb and all and then even install" and
"inkluding our own motif stuff xyz".

tools/mcde-debian.sh does the three steps in one lock:

  build    installs the build dependencies through apt-get (the ones
           configure.ac stops on and each -dev the tree compiles against),
           builds MCDE from a copy of ext/src/mcde with the path step of
           tools/mcde-host.sh, installs into build/mcde-debian-stage, strips,
           and packs build/mcde-debian/mcde_<version>_<arch>.deb
  install  installs that package
  clean    removes both directories

The package carries its own Motif: libXm, libMrm, libUil, the uil compiler
and the headers live in /usr/mdt, so the desktop runs from its own toolkit
and never from the system's libxm4 (--with-private-motif, as Konrad asked).

Four things cost a run each and are written where they bit:

- dpkg-shlibdeps matches a shlibs line on the SONAME version (libXm.so.4 ->
  4), not on the file version (4.0.4).  With 4.0.4 it ignored the line, found
  the system's libxm4 and put it in Depends.
- -L is the override file dpkg-shlibdeps READS; -T is where it writes the
  substvars it produced.  The first version passed -T and got nothing.
- -x$PKG, or the package depends on itself (every binary links /usr/mdt/lib).
- The version carries the commit, so a rebuild leaves a second .deb beside
  the first and `dpkg -i *.deb' installs both -- the older wins.  One package,
  one file: the old one goes.

debian-mcde/ holds what the package manager cannot do for the desktop: the
control paragraph, a postinst that indexes the fonts MCDE carries under
/usr/mdt/fonts for the X server, and the session entry (Type=XSession,
/usr/share/xsessions/mcde.desktop) -- without it a display manager lists the
host's desktops and not MCDE.

Verified on this host (2026-11-22):
  bmake debian from an empty build/mcde-debian exit=0,
    build/mcde-debian/mcde_0.1.0+git420f66c19e_amd64.deb (42M, 180280 KiB
    installed, 4583 files)
  Depends is free of libxm4/libuil4/libmrm4 and free of mcde itself
  the package carries usr/mdt/lib/libXm.so.4.0.4, libMrm, libUil and the
    uil compiler; /etc/pam.d/dtlogin and dtsession are conffiles
  dpkg -i installs it, postinst runs
  ldd /usr/mdt/bin/dtwm -> /usr/mdt/lib/libXm.so.4 (its own)
  on a private Xvfb: dtsession, dtwm, dtlaunch, dtpad, dtfile and the
    front panel (Applications/Files/Desktop/System/Network) run, no errors
  bmake debian-install exit=0, "mcde 0.1.0+git420f66c19e install ok
    installed", 0 upgraded / 0 newly installed

AGENTS.md and docs/BUILD-CONTRACT.md list mcde-debian.sh among the tools that
need the build lock, next to mcde-host.sh.

t0768
2026-11-22 17:35:17 +00:00

212 lines
10 KiB
Makefile

# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
# Makronix -- the tree, and the three ways in.
#
# NetBSD's own mechanisms, nothing invented:
# make build the distribution (no medium, no release)
# make release ARCH=... the whole release: sets, source set, ISO, USB image
# make install install over a running Makronix (installworld)
#
# ARCH is the name a person types (amd64, sparc64, evbarm); MACHINE is
# NetBSD's internal name for the same thing. When the host is NetBSD and ARCH
# is not given, the host decides; otherwise amd64.
TOP := $(CURDIR)
SRC := $(TOP)/src
# X for the base, as NetBSD builds it (build.sh -x -X, src/BUILDING): imported
# like src/, its upstream commit in xsrc/BASE (Konrad, 2026-11-13).
XSRC := $(TOP)/xsrc
OBJ := $(TOP)/build/obj
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)
ARCH ?= $(shell uname -m 2>/dev/null | sed -e 's/x86_64/amd64/' -e 's/aarch64/evbarm/' || echo amd64)
# build.sh wants NetBSD's machine name. For the architectures where the two
# names differ, this is the mapping; everything else is passed through.
MACHINE := $(ARCH)
ifeq ($(ARCH),amd64)
MACHINE := amd64
endif
ifeq ($(ARCH),i386)
MACHINE := i386
endif
BUILD_SH := cd $(SRC) && ./build.sh \
-U -u -j $(JOBS) -m $(MACHINE) \
-M $(OBJ) -O $(OBJ) -x -X $(XSRC)
# The recursive make for cdtest. Not spelled $(MAKE): GNU make runs a recipe
# that contains $(MAKE) even with -n, and the rest of the cdtest line would
# start a VM; MAKE_CMD is only printed.
MAKE_CMD := $(MAKE)
.PHONY: all build release install tools kernel clean-sanity stamp test compress \
iso sourcesets isosrc cdtest userland usb mcde-linux mcde-host \
debian debian-install
# Where tools/srctree-stage.sh assembles the source tree (one set, /usr/src).
SRCSTAGE := $(TOP)/build/srctree
# The default: everything the system consists of, no medium. This must be the
# first target; `make' otherwise runs the first target in this file only (it did
# run just `stamp', 2026-11-16).
all: build
# Explicit only: drop the derived artefacts whose content depends on the
# sources without building. build and release run tools/build-stamp.sh inside
# their own lock. Without it, an incremental run keeps an old INSTALL ramdisk
# and the test measures the previous code (measured 2026-11-03). See
# tools/build-stamp.sh.
stamp:
@tools/build-lock.sh 'tools/build-stamp.sh'
build:
@tools/build-lock.sh 'tools/build-stamp.sh && $(BUILD_SH) distribution'
# A release is everything: the sets and kernels (build.sh release), the signed
# source set, the installation CD/DVD images and the USB image, in this order
# and in one lock (the lock is re-entrant; iso and usb check the build stamp
# with -c and package what this run built). Konrad, 2026-11-18: "make release
# heisst ein RELEASE, ein RELEASE enthaelt natuerlich ALLES".
# Each step announces itself with the time, and the last line says which step
# failed or that the release is complete.
release:
@tools/build-lock.sh 'step() { echo; echo "==> make release [$$(date +%T)] $$*"; }; \
step "1/5 build stamp (tools/build-stamp.sh)" && tools/build-stamp.sh && \
step "2/5 sets and kernels (build.sh release)" && ( $(BUILD_SH) release ) && \
step "3/5 source set (make sourcesets)" && $(MAKE_CMD) -C $(TOP) sourcesets ARCH=$(ARCH) && \
step "4/5 CD/DVD images (make iso)" && $(MAKE_CMD) -C $(TOP) iso ARCH=$(ARCH) && \
step "5/5 USB image (make usb)" && $(MAKE_CMD) -C $(TOP) usb ARCH=$(ARCH) && \
step "done: the release is in $(OBJ)/releasedir" || \
{ rc=$$?; step "FAILED (exit $$rc) -- the step above did not finish"; exit $$rc; }'
# The installation CD that carries the sets. `release' is not it: for a
# medium with CDRELEASE=true (distrib/common/Makefile.bootcd:341-352) the
# release target is empty by design and the image target is iso_image, which
# writes RELEASEDIR/images/Makronix-<ver>-<arch>.iso (src/BUILDING:410-412,
# "iso-image Create a NetBSD installation CD-ROM image in the RELEASEDIR/
# images directory"). One build.sh operation, not a chain.
# It only packages what `make release' built, so it checks that nothing has
# changed since (tools/build-stamp.sh -c) instead of discarding the release.
iso:
@tools/build-lock.sh '$(TOP)/tools/build-stamp.sh -c && $(TOP)/tools/sign-release.sh auto $(TOP)/build/packages/amd64/All/pkg_summary.gz && $(TOP)/tools/cd3.sh stage && $(BUILD_SH) iso-image && $(TOP)/tools/cd2.sh && $(TOP)/tools/cd3.sh'
# the bootable installation image for a USB stick (GPT and EFI, also bootable
# on BIOS through gptmbr), built from what `make release' made:
# images/Makronix-*-amd64-install.img. It is installed raw and the second,
# MBR-only BIOS image is not built: a gzip round trip and another 10 GiB copy
# only cost time on the way to a stick. `make compress' packs a download.
# The stick must carry the source sets under /source (sysinst installs them);
# build them with `make sourcesets` after `make release`.
# install-image runs no `make obj': without its object directory nbmake builds
# in src/distrib/<arch>/installimage, and those untracked files changed the
# build stamp ("sources changed", 2026-11-18). The directory is made here.
# The work files of the image (work/, work.rootfs, imgroot.fs, work.img and the
# image itself, about 34 GB) are removed with NetBSD's own `clean' target of
# distrib/common/bootimage/Makefile.bootimage (CLEANFILES, WORKDIR) before the
# build, so a killed run leaves nothing behind, and after it, once install(1)
# has copied the image to RELEASEDIR/images. The temporary files install(1)
# leaves there when it is killed (`*.img.inst.XXXXXX', 6.3 GB on 2026-11-18)
# go too. Konrad, 2026-11-18: "verhinder das so ne scheisse uebrig bleibt".
INSTIMG_CLEAN = (cd $(SRC)/distrib/$(MACHINE)/installimage && \
$(OBJ)/tooldir.*/bin/nbmake-$(MACHINE) clean >/dev/null)
usb:
@tools/build-lock.sh 'if ! tools/build-stamp.sh -c; then exit 1; fi; \
if [ ! -d $(OBJ)/releasedir/source/sets ]; then \
echo "make usb: missing $(OBJ)/releasedir/source/sets (source sets)." >&2; \
echo "make usb: run make sourcesets after make release so the stick carries /source." >&2; \
exit 1; \
fi; \
rm -f $(OBJ)/releasedir/images/*.img.inst.*; \
mkdir -p $(OBJ)/distrib/$(MACHINE)/installimage; \
$(INSTIMG_CLEAN) && \
$(BUILD_SH) -V INSTIMG_RAW=yes -V INSTIMG_BIOS=no install-image && \
$(INSTIMG_CLEAN)'
# pack the install images for a download (tools/images.sh): nothing is
# compressed by the other steps
compress:
@tools/build-lock.sh 'tools/images.sh pack'
# the tests of a release (tools/test.sh): the media hold the DVD's files, one
# full installation (the DVD), smoke tests for the other media. The build
# tools (tools/test-tools.sh) are tested first, without the network or a build.
# The unit tests of MCDE (tools/mcde-tests.sh) run from a native build of this
# host, before the release tests.
test:
@tools/build-lock.sh 'tools/test-tools.sh && tools/mcde-tests.sh && tools/test.sh'
# The source set, RELEASEDIR/source/sets/src.tgz: the whole repository as one
# tree that unpacks to /usr/src -- src/, xsrc/, ext/, pkgsrc/, mobile/, tools/,
# docs/, the pins and the archives of the Makronix packages only
# (tools/srctree-stage.sh, makesrctars -m). It replaces NetBSD's split source
# sets; there is no /usr/xsrc and no /usr/msrc any more. Needs the distfiles
# (tools/makronix-distfiles.sh fetch).
sourcesets:
@tools/build-lock.sh '$(TOP)/tools/makronix-pins.sh check && $(TOP)/tools/makronix-distfiles.sh verify && $(TOP)/tools/makronix-distfiles.sh check && $(TOP)/tools/srctree-stage.sh $(SRCSTAGE) && $(BUILD_SH) -V MAKROSRCDIR=$(SRCSTAGE) sourcesets && $(TOP)/tools/sign-release.sh auto $(OBJ)/releasedir/source/sets/SHA512'
# The source DVD on its own: source/sets/src.tgz, MD5, SHA512 and a README
# (tools/cd-source.sh). The install DVD and the CDs carry no sources; the
# installer asks for this disc when the full profile wants them.
# Run `make sourcesets' first.
isosrc:
@tools/build-lock.sh 'tools/cd-source.sh'
# The pkgsrc userland (packages.list): the makronix set and the media's
# repository, cross or native as the host is (tools/userland.sh).
userland:
@tools/build-lock.sh 'tools/userland.sh'
# The short way to a tested installer: the release, the three CDs, and the
# installation from them in the simple mode (about 15 minutes on 16 cores,
# measured 2026-11-07: release 8, iso 2, test 5). Not the DVD, not encryption,
# not UEFI: tools/install-cgd.sh and `make isosrc' for those.
cdtest:
@tools/build-lock.sh '$(MAKE_CMD) release ARCH=$(ARCH) && tools/install-simple.sh'
# installworld over a running system. Refused anywhere but Makronix/NetBSD:
# a cross host has no business writing its own /usr from another system's
# distribution, and refusing is cheaper than explaining afterwards.
# build.sh's operation is install=DIR (src/BUILDING:573, "Install the contents
# of DESTDIR to idir, using make installworld"; the etc and xetc sets are left
# out, as etcupdate's job); "installworld" is no build.sh operation
# (src/build.sh:1569, "Unknown OPERATION"). build.sh itself refuses / for a
# cross build (src/build.sh:3059-3066).
install:
@uname -s | grep -qx NetBSD || { \
echo "make install: this installs over the running system,"; \
echo "make install: which only makes sense on Makronix/NetBSD."; \
echo "make install: on $(shell uname -s), build with 'make' instead."; \
exit 1; }
@tools/build-lock.sh '$(BUILD_SH) install=/'
tools:
@tools/build-lock.sh '$(BUILD_SH) tools'
KERNEL ?= GENERIC
kernel:
@tools/build-lock.sh '$(BUILD_SH) kernel=$(KERNEL)'
clean-sanity:
@tools/build-lock.sh 'rm -rf $(OBJ)'
# MCDE built natively on this host, for development (tools/mcde-linux.sh); not
# how Makronix gets it (that is pkgsrc). MCDE_DIRS: only these subdirectories.
mcde-linux:
@tools/build-lock.sh 'tools/mcde-linux.sh $(MCDE_DIRS)'
# MCDE for this host's own desktop, in /usr/mdt, with the path step of the
# pkgsrc recipe (tools/mcde-host.sh); MCDE_DIRS=install copies it over /.
mcde-host:
@tools/build-lock.sh 'tools/mcde-host.sh $(MCDE_DIRS)'
# MCDE as a Debian package for this host, with its own Motif in it
# (tools/mcde-debian.sh): the build dependencies first, then the build, then
# build/mcde-debian/mcde_<version>_<arch>.deb. debian-install installs that
# package.
debian:
@tools/build-lock.sh 'tools/mcde-debian.sh build'
debian-install:
@tools/build-lock.sh 'tools/mcde-debian.sh install'