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
This commit is contained in:
1 parent
420f66c19e
commit
93aa5bacf2
7 files changed
+382
-11
No files matched your search
@@ -108,11 +108,11 @@ Rules for a build:
|
||||
VM test; `make mcde-linux` and `make mcde-host` take it too. Tools that
|
||||
write `build/obj` or `releasedir` (`build-stamp.sh`, `cd2.sh`, `cd3.sh`,
|
||||
`cd-source.sh`, `images.sh`, `srctree-stage.sh`, `userland.sh`,
|
||||
`mcde-linux.sh`, `mcde-host.sh`) refuse to run outside it; start them
|
||||
through make or `tools/build-lock.sh '...'`. The tests (`test.sh`,
|
||||
`mediacheck.sh`, `install-simple.sh`, `install-cgd.sh`, `mcde-tests.sh`)
|
||||
call `build-lock.sh --check` and refuse to start beside a build; `make test`
|
||||
and `make cdtest` hold the lock while they run.
|
||||
`mcde-linux.sh`, `mcde-host.sh`, `mcde-debian.sh`) refuse to run outside it;
|
||||
start them through make or `tools/build-lock.sh '...'`. The tests
|
||||
(`test.sh`, `mediacheck.sh`, `install-simple.sh`, `install-cgd.sh`,
|
||||
`mcde-tests.sh`) call `build-lock.sh --check` and refuse to start beside a
|
||||
build; `make test` and `make cdtest` hold the lock while they run.
|
||||
- The gate on a build is `checkflist`, run the way NetBSD runs it (`cd
|
||||
src/distrib/sets && DESTDIR=build/obj/destdir.amd64 MACHINE=amd64
|
||||
MACHINE_ARCH=x86_64 build/obj/tooldir.*/bin/nbmake-amd64 checkflist`). Extra
|
||||
|
||||
@@ -40,7 +40,8 @@ BUILD_SH := cd $(SRC) && ./build.sh \
|
||||
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
|
||||
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
|
||||
@@ -198,3 +199,13 @@ mcde-linux:
|
||||
# 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'
|
||||
@@ -33,11 +33,11 @@ makronix-Set und die Pakete kommen mit t0056 (Binaerpakete) dazu.
|
||||
Ein Baum, ein Build: der Root-Makefile nimmt `tools/build-lock.sh`; ein
|
||||
zweiter Build wird mit der PID des Halters abgelehnt. Der Lock ist
|
||||
re-entrant, damit `make cdtest` ihn ueber Release, ISO und den VM-Test haelt,
|
||||
und gilt auch fuer `make mcde-linux`/`make mcde-host`. Werkzeuge, die
|
||||
`build/obj` oder `releasedir` schreiben (`build-stamp.sh`, `cd2.sh`, `cd3.sh`,
|
||||
`cd-source.sh`, `images.sh`, `srctree-stage.sh`, `userland.sh`,
|
||||
`mcde-linux.sh`, `mcde-host.sh`), verweigern den Direktaufruf; sie laufen
|
||||
ueber make oder `tools/build-lock.sh '...'`. Tests (`test.sh`,
|
||||
und gilt auch fuer `make mcde-linux`/`make mcde-host`/`make debian`. Werkzeuge,
|
||||
die `build/obj` oder `releasedir` schreiben (`build-stamp.sh`, `cd2.sh`,
|
||||
`cd3.sh`, `cd-source.sh`, `images.sh`, `srctree-stage.sh`, `userland.sh`,
|
||||
`mcde-linux.sh`, `mcde-host.sh`, `mcde-debian.sh`), verweigern den
|
||||
Direktaufruf; sie laufen ueber make oder `tools/build-lock.sh '...'`. Tests (`test.sh`,
|
||||
`mediacheck.sh`, `install-simple.sh`, `install-cgd.sh`, `mcde-tests.sh`)
|
||||
pruefen mit `build-lock.sh --check` und starten nicht neben einem Build;
|
||||
`make test`/`make cdtest` halten den Lock waehrend des Laufs.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
Package: @PACKAGE@
|
||||
Version: @VERSION@
|
||||
Section: x11
|
||||
Priority: optional
|
||||
Architecture: @ARCH@
|
||||
Maintainer: Konrad Lother <konrad.lother@gmail.com>
|
||||
Depends: @DEPENDS@
|
||||
Installed-Size: @INSIZE@
|
||||
Description: Makronix Common Desktop Environment, with its own Motif
|
||||
MCDE is the Makronix fork of CDE 2.5.3. It installs under @PREFIX@ with
|
||||
its configuration in /etc/mdt, and carries the Motif it is built from --
|
||||
libXm, libMrm and libUil, the uil compiler and the headers -- so the
|
||||
desktop runs from its own toolkit and never from the system's libxm4.
|
||||
.
|
||||
It is the Linux side of the Makronix build host: Makronix itself gets MCDE
|
||||
through pkgsrc. A session starts with @PREFIX@/bin/Xsession.
|
||||
.
|
||||
Built from @VERSION@ on @DATE@.
|
||||
@@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=XSession
|
||||
Exec=/usr/mdt/bin/dtsession
|
||||
TryExec=/usr/mdt/bin/dtsession
|
||||
DesktopNames=MCDE
|
||||
Name=MCDE
|
||||
Comment=Makronix Common Desktop Environment (a CDE 2.5.3 fork)
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
||||
#
|
||||
# postinst of the MCDE package: what a package manager cannot do for the
|
||||
# desktop. $1 is configure (install or upgrade), abort-*, or triggered.
|
||||
#
|
||||
# The font index. MCDE installs its own fonts below /usr/mdt/fonts and a
|
||||
# fonts.dir for the directory it knows; a font in a subdirectory is invisible
|
||||
# to the X server without an index of its own. Debian's xfonts-utils brings
|
||||
# mkfontdir, which is in the dependency list of the package for this reason.
|
||||
# A host without it is not an error: the fonts of the session are also in the
|
||||
# X server's own path.
|
||||
|
||||
set -e
|
||||
|
||||
case ${1:-} in
|
||||
configure) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
PREFIX=/usr/mdt
|
||||
|
||||
if command -v mkfontdir >/dev/null 2>&1; then
|
||||
find "$PREFIX/fonts" -type d 2>/dev/null | while IFS= read -r d; do
|
||||
case $d in */hack) continue ;; esac
|
||||
mkfontdir "$d" >/dev/null 2>&1 || true
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+305
@@ -0,0 +1,305 @@
|
||||
#!/bin/sh
|
||||
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
||||
#
|
||||
# mcde-debian.sh -- MCDE as a Debian package, with its own Motif in it
|
||||
#
|
||||
# usage: tools/mcde-debian.sh [build|install|clean]
|
||||
# (make debian, make debian-install)
|
||||
#
|
||||
# Konrad asked for this (2026-11-22): "i want mcde to support 'make debian' and
|
||||
# it'll fully create and download all required build dependencies ... and make
|
||||
# debian-install would make the deb and all and then even install", and then
|
||||
# "inkluding our own motif stuff xyz".
|
||||
#
|
||||
# It does not use debian/ of the imported CDE tree: that one calls
|
||||
# admin/IntegTools/dbTools/installCDE with sudo inside the build, and the fork
|
||||
# does not have that helper any more. This builds the desktop the way
|
||||
# tools/mcde-host.sh builds it (/usr/mdt, configuration /etc/mdt), installs it
|
||||
# into a stage with DESTDIR, and packs what is in the stage:
|
||||
#
|
||||
# build the build dependencies (BUILD_DEPS) are installed with apt-get(8)
|
||||
# through sudo(8); the working tree of ext/src/mcde (without pkgsrc/)
|
||||
# is copied to build/mcde-debian, autogen.sh and configure run when
|
||||
# configure.ac or a Makefile.am changed, then make, make install
|
||||
# DESTDIR=build/mcde-debian-stage, and the stage becomes
|
||||
# build/mcde-debian/mcde_<version>_<arch>.deb. The package carries
|
||||
# Motif's libXm, libMrm and libUil with the uil compiler and the
|
||||
# headers -- built from this tree (motif/, --with-private-motif), not
|
||||
# the system's libxm4: on Makronix Motif is ours too (x11/motif).
|
||||
# install build, then apt-get install ./<the deb>: apt resolves the
|
||||
# dependencies; dpkg -i would leave them to the caller.
|
||||
# clean remove build/mcde-debian*.
|
||||
#
|
||||
# The prefix is /usr/mdt with /etc/mdt -- the paths tools/mcde-host.sh uses, so
|
||||
# a package installation and a `make mcde-host MCDE_DIRS=install` end up in the
|
||||
# same place and a session finds its icons and data types in either. The
|
||||
# programs carry RUNPATH=/usr/mdt/lib (libtool -rpath), so the system's Motif is
|
||||
# never picked up beside ours and no /etc/ld.so.conf.d file is needed.
|
||||
#
|
||||
# Nothing here goes into a Makronix set or into pkgsrc
|
||||
# (ext/src/mcde/pkgsrc). This is the Linux side of the build host.
|
||||
#
|
||||
# The last line of the output is "mcde-debian exit=N".
|
||||
|
||||
set -u
|
||||
|
||||
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
||||
# This tool writes below build/: only inside the build lock, like the others.
|
||||
if [ -z "${BUILD_LOCK_HELD:-}" ] || [ ! -d "$BUILD_LOCK_HELD" ]; then
|
||||
echo "${0##*/}: run this through make or tools/build-lock.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRC=$TOP/ext/src/mcde
|
||||
B=$TOP/build/mcde-debian
|
||||
STAGE=$TOP/build/mcde-debian-stage
|
||||
META=$SRC/debian-mcde
|
||||
PREFIX=/usr/mdt
|
||||
SYSCONF=/etc/mdt
|
||||
PKG=mcde
|
||||
JOBS=${JOBS:-16}
|
||||
|
||||
finish() { echo "mcde-debian exit=$1"; exit "$1"; }
|
||||
|
||||
case ${1:-build} in
|
||||
build|install|clean) ;;
|
||||
*) echo "usage: ${0##*/} [build|install|clean]" >&2; finish 2 ;;
|
||||
esac
|
||||
|
||||
if [ "$1" = clean ]; then
|
||||
rm -rf "$B" "$STAGE"
|
||||
finish 0
|
||||
fi
|
||||
|
||||
# apt-get(8) through sudo(8), -n: never ask for a password, so a run that
|
||||
# cannot get root stops instead of waiting for input that never comes.
|
||||
apt() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
apt-get "$@"
|
||||
elif sudo -n true 2>/dev/null; then
|
||||
sudo -n apt-get "$@"
|
||||
else
|
||||
echo "${0##*/}: need root for apt-get $* (no passwordless sudo)" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# What the build of MCDE and of its own Motif reads, as Debian names it. Each
|
||||
# one is a package configure would stop on (AC_MSG_ERROR in configure.ac) or a
|
||||
# program MISSING_PROGS reports, or a header a library is built against:
|
||||
# autoconf automake libtool pkg-config -- autogen.sh, --with-private-motif
|
||||
# bison flex -- motif's parser and lexer (YACC, AM_PROG_LEX)
|
||||
# m4 cpp gzip perl -- configure, tradcpp, the catalogues
|
||||
# ksh93u+m -- programs/Xsession runs /usr/bin/ksh (KSH)
|
||||
# mksh -- the fallback AC_PATH_PROG(KSH, mksh) finds
|
||||
# rpcsvc-proto -- rpcgen; libc-dev-bin -- gencat
|
||||
# opensp -- onsgmls, the help books
|
||||
# x11-xserver-utils -- xrdb, sessreg (dtlogin reads and registers)
|
||||
# xfonts-utils -- bdftopcf, mkfontdir (the fonts of the session)
|
||||
# xbitmaps xfonts-* -- the bitmaps and fonts dtlogin and dtwm name
|
||||
# lib*-dev -- X11, Xft, Xinerama, Xrandr, Xfixes, Xpm, Xmu, Xt,
|
||||
# Xext, Xrender, Xau, ICE, SM, Xss, ICE, jpeg, png,
|
||||
# lmdb, ssl (libcrypto), opus, tls (libretls is
|
||||
# libtls-dev on Debian), tcl (tcl8.6-dev has tcl.h),
|
||||
# pam, utempter, tirpc, cups (dtprintinfo links it)
|
||||
BUILD_DEPS="autoconf automake libtool pkg-config bison flex m4 cpp gzip perl
|
||||
ksh93u+m mksh rpcsvc-proto libc-dev-bin opensp
|
||||
x11-xserver-utils xfonts-utils xbitmaps xfonts-base xfonts-100dpi
|
||||
xfonts-75dpi libx11-dev libxext-dev libxrender-dev libxau-dev
|
||||
libxpm-dev libxt-dev libxmu-dev libxinerama-dev libxrandr-dev
|
||||
libxfixes-dev libxft-dev libxss-dev libice-dev libsm-dev
|
||||
libjpeg-dev libpng-dev libfontconfig1-dev libfreetype-dev
|
||||
liblmdb-dev libssl-dev libopus-dev libtls-dev tcl8.6-dev
|
||||
libpam0g-dev libutempter-dev libtirpc-dev libcups2-dev"
|
||||
|
||||
# The programs and data dpkg-shlibdeps(1) cannot see, because nothing links
|
||||
# them: the ksh the session scripts run, tcl for dtinfo, the X tools dtlogin
|
||||
# calls, and the fonts and bitmaps its configuration names.
|
||||
RUNTIME_DEPS="ksh93u+m tcl x11-xserver-utils xfonts-base xfonts-100dpi
|
||||
xfonts-75dpi xbitmaps"
|
||||
|
||||
MISSING=
|
||||
for p in $BUILD_DEPS; do
|
||||
dpkg -s "$p" >/dev/null 2>&1 || MISSING="$MISSING $p"
|
||||
done
|
||||
if [ -n "$MISSING" ]; then
|
||||
echo "${0##*/}: installing build dependencies:$MISSING"
|
||||
apt install -y $MISSING || finish 1
|
||||
else
|
||||
echo "${0##*/}: build dependencies are there"
|
||||
fi
|
||||
|
||||
# --- the source tree, as tools/mcde-host.sh copies it ------------------------
|
||||
# Without the artefacts of a build: an in-tree run (someone typed make in
|
||||
# ext/src/mcde) leaves object files, .libs/ and -- the one that stops an
|
||||
# install -- .la files that name their own libdir. Copied along, make keeps
|
||||
# them for up to date and the install stops at "cannot install
|
||||
# 'libMcdeSound.la' to a directory not ending in /usr/local/lib" (measured
|
||||
# 2026-11-22). The build tree below build/ keeps its own; these excludes only
|
||||
# keep the source tree's out of it.
|
||||
mkdir -p "$B" || finish 1
|
||||
rsync -a --exclude=/pkgsrc --exclude=/pkgsrc-* \
|
||||
--exclude='*.o' --exclude='*.lo' --exclude='*.la' --exclude='*.so' \
|
||||
--exclude='*.so.*' --exclude='*.a' --exclude=.libs/ --exclude=.deps/ \
|
||||
--exclude=/libtool --exclude=config.status --exclude=config.log \
|
||||
--exclude=config.cache --exclude='stamp-h*' \
|
||||
"$SRC/" "$B/" || finish 1
|
||||
|
||||
# motif/'s Makefile.in, configure and aclocal.m4 were generated by automake
|
||||
# 1.15 and autoconf of 2017, and their Makefiles name those programs
|
||||
# (`missing aclocal-1.15'). This host has automake 1.19: a Makefile.am newer
|
||||
# than its Makefile.in (motif's is, 2026-11-13) makes make call the missing
|
||||
# automake-1.15 and stop with "Error 127" (measured 2026-11-22). The
|
||||
# generated files get the current time, so nothing in motif/ is regenerated --
|
||||
# its sources are from 2017 and are not touched. Before configure runs, so
|
||||
# the Makefiles it writes are newer and config.status stays quiet.
|
||||
#
|
||||
# Only motif/: the rest of the tree is ours and its Makefile.in files are made
|
||||
# by autogen.sh from the Makefile.am, which is where a change belongs. Given
|
||||
# the same treatment, a changed Makefile.am (dtphoto's, 2026-11-22) would never
|
||||
# reach its Makefile and the program would link without the library it now
|
||||
# calls (mcde_sys_print_file, undefined reference).
|
||||
find "$B/motif" \( -name Makefile.in -o -name configure -o -name aclocal.m4 \) \
|
||||
-exec touch {} + || finish 1
|
||||
|
||||
# debian/ of this fork: the metadata, copied so a build never edits the tree
|
||||
# it builds from.
|
||||
mkdir -p "$B/debian" || finish 1
|
||||
for f in control.in postinst mcde.desktop; do
|
||||
[ -f "$META/$f" ] || { echo "${0##*/}: no $META/$f" >&2; finish 1; }
|
||||
cp "$META/$f" "$B/debian/$f" || finish 1
|
||||
done
|
||||
|
||||
cd "$B" || finish 1
|
||||
if [ ! -f config.status ] ||
|
||||
[ -n "$(find . -name configure.ac -newer config.status -o \
|
||||
-name Makefile.am -newer config.status | head -1)" ]; then
|
||||
./autogen.sh || finish 1
|
||||
# --with-private-motif is the default and is given for the record: the
|
||||
# package carries its own libXm/libMrm/libUil, as Konrad asked.
|
||||
# --disable-printing: libcups of a build host has no destinations, and
|
||||
# the test HOME of tools/mcde-tests.sh has no printer (mcde-linux.sh).
|
||||
./configure --prefix="$PREFIX" --sysconfdir=/etc --localstatedir=/var \
|
||||
--with-config-dir="$SYSCONF" --with-logfiles-dir=/var/mdt \
|
||||
--with-pamdir=/etc/pam.d --with-calendar-dir=/var/spool/calendar \
|
||||
--with-private-motif --enable-xft --enable-png --enable-jpeg \
|
||||
--disable-printing || finish 1
|
||||
fi
|
||||
nice -n 19 make -j"$JOBS" || finish $?
|
||||
|
||||
# --- the installation -------------------------------------------------------
|
||||
rm -rf "$STAGE" || finish 1
|
||||
make install DESTDIR="$STAGE" >"$B/.install.log" 2>&1 ||
|
||||
{ tail -20 "$B/.install.log" >&2; finish 1; }
|
||||
[ -x "$STAGE$PREFIX/bin/dtwm" ] ||
|
||||
{ echo "${0##*/}: install left no $PREFIX/bin/dtwm" >&2; finish 1; }
|
||||
|
||||
# A package carries no libtool archives (nothing reads them once the libraries
|
||||
# are in place) and no test binaries.
|
||||
find "$STAGE" -name '*.la' -delete
|
||||
find "$STAGE" -type f -name 'test_*' -path '*/bin/*' -delete
|
||||
|
||||
# strip: only the debug and symbol sections, so objdump's RUNPATH, NEEDED and
|
||||
# the loader's view stay exactly as the build made them.
|
||||
find "$STAGE" -type f | while IFS= read -r f; do
|
||||
case $f in
|
||||
*/lib/*.so|*/lib/*.so.*) strip --strip-unneeded "$f" 2>/dev/null ;;
|
||||
*/bin/*|*/libexec/*)
|
||||
case $(head -c 4 "$f" 2>/dev/null | od -An -c | tr -d ' \n') in
|
||||
*177E*L*F) strip --strip-unneeded "$f" 2>/dev/null ;;
|
||||
esac ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# An empty /var/spool/calendar is not a file of a package, and a state
|
||||
# directory belongs to the system's package manager only if it is used.
|
||||
rm -rf "$STAGE/var" || finish 1
|
||||
|
||||
# --- the metadata -----------------------------------------------------------
|
||||
# Version: AC_INIT is the base; a tree with local edits says so, because the
|
||||
# package is then not the commit it claims to be.
|
||||
BASE=$(sed -n 's/^ *\[\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\],$/\1/p' \
|
||||
"$SRC/configure.ac" | head -1)
|
||||
[ -n "$BASE" ] || BASE=0.0.0
|
||||
GIT=$(git -C "$TOP" rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||
DIRTY=
|
||||
git -C "$TOP" status --porcelain -- ext/src/mcde 2>/dev/null | grep -q . &&
|
||||
DIRTY=+git$GIT
|
||||
VERSION=$BASE$DIRTY
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
INSIZE=$(du -sk "$STAGE" | cut -f1)
|
||||
|
||||
# The dependencies the ELF files ask for. Our own libraries (libXm, libMrm,
|
||||
# libUil, libDt*, libMcde*) are in this very package, so they are not
|
||||
# dependencies: a shlibs.local line per library of the package says so, and
|
||||
# without it dpkg-shlibdeps looks for a Debian package that owns
|
||||
# /usr/mdt/lib/libXm.so.4 and finds the system's libxm4 instead.
|
||||
: > "$B/.shlibs.local"
|
||||
find "$STAGE$PREFIX/lib" -maxdepth 1 -name '*.so.*' | while IFS= read -r so; do
|
||||
n=$(basename "$so")
|
||||
lib=${n%%.so.*}
|
||||
# dpkg-shlibdeps matches on the SONAME version (libXm.so.4 -> 4), not on
|
||||
# the file version (libXm.so.4.0.4): a shlibs line with 4.0.4 is ignored
|
||||
# and the system's libxm4 gets the dependency instead.
|
||||
ver=${n#*.so.}
|
||||
ver=${ver%%.*}
|
||||
case $lib in
|
||||
*) echo "$lib $ver $PKG" >> "$B/.shlibs.local" ;;
|
||||
esac
|
||||
done
|
||||
# a library with a symlink and its versioned file gives two lines
|
||||
sort -u -o "$B/.shlibs.local" "$B/.shlibs.local"
|
||||
# -L is the file dpkg-shlibdeps READS for overrides (-T is where it writes
|
||||
# the substvars it produced, which is what the log below is for).
|
||||
dpkg-shlibdeps -O -L"$B/.shlibs.local" -x"$PKG" --ignore-missing-info \
|
||||
-l"$STAGE$PREFIX/lib" \
|
||||
$(find "$STAGE$PREFIX/bin" "$STAGE$PREFIX/libexec" -type f 2>/dev/null |
|
||||
while IFS= read -r f; do
|
||||
case $(head -c 4 "$f" 2>/dev/null | od -An -c | tr -d ' \n') in
|
||||
*177E*L*F) echo "-e$f" ;;
|
||||
esac
|
||||
done) > "$B/.shlibdeps.log" 2>&1
|
||||
SHLIBS=$(sed -n 's/^shlibs:Depends=//p' "$B/.shlibdeps.log")
|
||||
if [ -z "$SHLIBS" ] || grep -q 'no dependency information' "$B/.shlibdeps.log"
|
||||
then
|
||||
echo "${0##*/}: dpkg-shlibdeps found no dependencies:" >&2
|
||||
tail -5 "$B/.shlibdeps.log" >&2
|
||||
finish 1
|
||||
fi
|
||||
|
||||
DEPENDS=$(printf '%s, %s' "$SHLIBS" \
|
||||
"$(echo $RUNTIME_DEPS | tr ' ' ',')" | sed -e 's/, */, /g' -e 's/^, //')
|
||||
|
||||
mkdir -p "$STAGE/DEBIAN" || finish 1
|
||||
sed -e "s|@VERSION@|$VERSION|g" -e "s|@ARCH@|$ARCH|g" \
|
||||
-e "s|@DEPENDS@|$DEPENDS|g" -e "s|@PREFIX@|$PREFIX|g" \
|
||||
-e "s|@PACKAGE@|$PKG|g" -e "s|@DATE@|$(date -R)|g" \
|
||||
-e "s|@INSIZE@|$INSIZE|g" \
|
||||
"$B/debian/control.in" > "$STAGE/DEBIAN/control" || finish 1
|
||||
install -m 755 "$B/debian/postinst" "$STAGE/DEBIAN/postinst" || finish 1
|
||||
# The session entry: without it the display manager lists the desktop of the
|
||||
# host and not MCDE. Type=XSession, so the file goes to /usr/share/xsessions
|
||||
# and not to a package-private share/.
|
||||
install -D -m 644 "$B/debian/mcde.desktop" \
|
||||
"$STAGE/usr/share/xsessions/mcde.desktop" || finish 1
|
||||
# every file under /etc is configuration: a local edit survives an upgrade
|
||||
find "$STAGE/etc" -type f 2>/dev/null | sed "s,^$STAGE,," \
|
||||
> "$STAGE/DEBIAN/conffiles"
|
||||
|
||||
OUT=$B/${PKG}_${VERSION}_${ARCH}.deb
|
||||
# The version carries the commit, so every build leaves a new file here and an
|
||||
# older one stays beside it. `dpkg -i build/mcde-debian/*.deb' then installs
|
||||
# both and the older one wins (measured 2026-11-22): one package, one file.
|
||||
rm -f "$B/${PKG}_"*"_${ARCH}.deb"
|
||||
dpkg-deb --root-owner-group --build "$STAGE" "$OUT" >"$B/.dpkg-deb.log" 2>&1 ||
|
||||
{ tail -20 "$B/.dpkg-deb.log" >&2; finish 1; }
|
||||
echo "${0##*/}: $OUT ($(du -h "$OUT" | cut -f1), $INSIZE KiB installed)"
|
||||
dpkg-deb -f "$OUT" Package Version Depends | sed 's/^/ /'
|
||||
|
||||
if [ "${1:-build}" = install ]; then
|
||||
# The package just built, by name: a glob could take an older one too.
|
||||
apt install -y "$OUT" || finish 1
|
||||
dpkg-query -W -f=' ${Package} ${Version} ${Status}\n' "$PKG" || finish 1
|
||||
fi
|
||||
|
||||
finish 0
|
||||
Reference in new issue
Block a user