Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,53 @@ jobs:
# the compiled build program's actual behaviour under the exact
# environment contract `--target aarch64-ios-sim --format app` and the
# device row would set, run directly rather than through mcpp.
- name: dist-deb and dist-rpm produce packages that carry the program, reproducibly
working-directory: tests/linux-package-consumer
run: |
# A plain build has no distribution edge, yet both formats are known.
"$MCPP" build
if find target -name '*.deb' -o -name '*.rpm' | grep -q .; then
echo "FAIL: a plain build produced a package"; exit 1
fi
set +e
se=$("$MCPP" pack --pkg-format bogus 2>&1 >/dev/null)
set -e
grep -qE 'available in this build: .*\bdeb\b' <<<"$se" && grep -qE 'available in this build: .*\brpm\b' <<<"$se" \
|| { echo "FAIL: the refusal does not name deb and rpm"; echo "$se"; exit 1; }

"$MCPP" pack --pkg-format deb | tee pack-deb.log
"$MCPP" pack --pkg-format rpm | tee pack-rpm.log
deb=$(find target -name 'linux-package-consumer_0.4.0_*.deb' | head -1)
rpm=$(find target -name 'linux-package-consumer-0.4.0-1.*.rpm' | head -1)
test -n "$deb" && test -n "$rpm" || { echo "FAIL: no package was produced"; exit 1; }

# The control fields come from [package], and the dependency the project stated is recorded.
dpkg-deb --field "$deb" Package Version Maintainer Depends | tee fields.log
grep -q '^Maintainer: mcpp-community <' fields.log && grep -q '^Depends: bash' fields.log \
|| { echo "FAIL: the deb's control fields"; exit 1; }
rpm -qp --requires "$rpm" | grep -qx bash || { echo "FAIL: the rpm does not require bash"; exit 1; }

# The same files in both, and the installed program runs through /usr/bin.
dpkg-deb --contents "$deb" | awk '{print $6}' | sed 's|^\./|/|' | grep -v '/$' | sort > deb-files.txt
rpm -qlp "$rpm" | sort > rpm-files.txt
diff deb-files.txt rpm-files.txt || { echo "FAIL: deb and rpm carry different files"; exit 1; }
for f in /usr/bin/linux-package-consumer /usr/share/applications/linux-package-consumer.desktop \
/usr/share/icons/hicolor/scalable/apps/linux-package-consumer.svg; do
grep -qx "$f" deb-files.txt || { echo "FAIL: $f is not in the package"; exit 1; }
done
sudo dpkg -i "$deb"
linux-package-consumer | tee run.log
grep -q '^linux-package-consumer ok' run.log || { echo "FAIL: the installed program did not run"; exit 1; }
sudo dpkg -r linux-package-consumer

# Re-staging an unchanged program gives the same bytes.
before=$(sha256sum "$deb" "$rpm")
touch src/main.cpp
"$MCPP" pack --pkg-format deb > /dev/null
"$MCPP" pack --pkg-format rpm > /dev/null
[ "$before" = "$(sha256sum "$deb" "$rpm")" ] || { echo "FAIL: repacking changed the packages"; exit 1; }
echo "ok: deb and rpm"

- name: dist-apple's iOS row, checked at the plan level
working-directory: tests/ios-app-consumer
run: MCPP="$MCPP" ./check-ios-plan.sh
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module name the member declares, and configures it there.

```toml
[build-dependencies.mcpp]
plugins = { version = "0.22.1", features = ["rules-spirv"], host-module = true }
plugins = { version = "0.23.0", features = ["rules-spirv"], host-module = true }
```

```cpp
Expand Down Expand Up @@ -76,6 +76,8 @@ mcpp 2026.11.7.1 or later; cross configuration requires CMake 3.19 or later.
| `tools-embed` | `mcpp.tools.embed` | 2026.9.5.4 | Writes a data file into a header the program compiles in. | [tools-embed](docs/tools-embed.md) |
| `tools-island` | `mcpp.tools.island` | 2026.9.7.1 | Generates the `extern "C"` boundary and the C++ module of a code island. | [tools-island](docs/tools-island.md) |
| `dist-appimage` | `mcpp.dist.appimage` | 2026.10.1.3 | Turns the tree `mcpp pack` stages into an AppImage (Linux). | [dist](docs/dist.md#dist-appimage) |
| `dist-deb` | `mcpp.dist.deb` | 2026.10.30.1 | Installs the staged tree under `/opt/<name>` with a launcher, a desktop entry and an icon, as a Debian package (Linux targets). | [dist](docs/dist.md#dist-deb-and-dist-rpm) |
| `dist-rpm` | `mcpp.dist.rpm` | 2026.10.30.1 | The same installation as an RPM package (Linux targets). | [dist](docs/dist.md#dist-deb-and-dist-rpm) |
| `dist-wix` | `mcpp.dist.wix` | 2026.10.1.3 | Builds an MSI of the staged tree, and a Burn bundle chaining it (Windows). | [dist](docs/dist.md#dist-wix) |
| `dist-apple` | `mcpp.dist.apple` | 2026.9.14.2 | Lays out a macOS or iOS application bundle, signs it and writes a disk image. | [dist-apple](docs/dist-apple.md) |
| `dist-web` | `mcpp.dist.web` | 2026.9.13.1 | Copies a `wasm32-emscripten` program and its files into a web directory with an `index.html`. | [dist](docs/dist.md#dist-web) |
Expand Down
33 changes: 33 additions & 0 deletions dist/deb.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// mcpp.dist.deb -- a staged program becomes a Debian package for Debian, Ubuntu, and their derivatives.
//
// The layout and the writer are shared with the other Linux package format in
// `mcpp.dist.linux_package`: the staged closure under `/opt/<name>`, a
// launcher in `/usr/bin`, a desktop entry and an icon, written by nfpm from
// the `xim:nfpm` payload, so the host needs no `dpkg-deb`.

export module mcpp.dist.deb;

import std;
export import mcpp.dist.linux_package;

export namespace mcpp::dist::deb {

using options = mcpp::dist::linux_package::options;
using plan = mcpp::dist::linux_package::plan;

// What `generate` would submit for `mcpp pack --format deb`, without submitting it.
inline plan plan_for(options opt = {}) {
return mcpp::dist::linux_package::plan_for("deb", std::move(opt));
}

inline bool submit(const plan& p) {
return mcpp::dist::linux_package::submit(p);
}

// The one call a build program makes: declares the `deb` format in every pass
// and submits the package action when `mcpp pack --format deb` asked for it.
inline bool generate(options opt = {}) {
return mcpp::dist::linux_package::generate("deb", std::move(opt));
}

} // namespace mcpp::dist::deb
Loading
Loading