From e22fee614707b9831f64ebb0499d9d0ee8f75ae5 Mon Sep 17 00:00:00 2001 From: lildengzi <2580862656@qq.com> Date: Sun, 9 Aug 2026 02:44:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20E0006=20Upgrade=20=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=8C=89=E5=AE=89=E8=A3=85=E5=B8=83=E5=B1=80=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E6=8C=87=E5=BC=95=EF=BC=88AUR=20=E6=A3=80=E6=B5=8B=20+=20?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E9=BB=98=E8=AE=A4=20xlings=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E8=AF=AF=E5=AF=BC=E7=94=A8=E6=88=B7=E8=A3=85?= =?UTF-8?q?=E5=87=BA=E7=AC=AC=E4=BA=8C=E4=BB=BD=EF=BC=88#394=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pm/index_contract.cppm | 66 +++++++++++++++++++++++++++--- tests/unit/test_index_contract.cpp | 25 +++++++++++ 2 files changed, 86 insertions(+), 5 deletions(-) diff --git a/src/pm/index_contract.cppm b/src/pm/index_contract.cppm index 0637da8c..8018da90 100644 --- a/src/pm/index_contract.cppm +++ b/src/pm/index_contract.cppm @@ -21,6 +21,7 @@ export module mcpp.pm.index_contract; import std; import mcpp.libs.toml; +import mcpp.platform.fs; // self_exe_path (distro-layout detection) import mcpp.version_req; import mcpp.version; // MCPP_VERSION (leaf — see that module) @@ -44,6 +45,13 @@ read_index_contract(const std::filesystem::path& indexRoot); std::optional floor_violation(std::string_view minMcpp, std::string_view ownVersion); +// Pure: E0006 message with the Upgrade advice suited to the install layout +// (`distroManaged` is detected once by the caller via self_exe_path). The +// plain one-liner misleads users of the other install methods — an AUR install +// plus the install.sh command installs a second copy that does not update the +// running binary. +std::string e0006_message(std::string violation, bool distroManaged); + // Pure predicate — no reporting, no registration, no dedup. For callers that // need to ask "would this tree be usable?" without the side effects of // check_index_floor (the refresh guard asks it twice per refresh). @@ -118,6 +126,26 @@ read_index_contract(const std::filesystem::path& indexRoot) return c; } +// Upgrade advice embedded in the E0006 message. mcpp supports several install +// methods (xlings is the recommended default; install.sh / AUR / Homebrew are +// alternatives), and each lands in a different place. A single hardcoded +// one-liner misleads users of the other methods — e.g. an AUR install plus the +// install.sh command installs a SECOND copy that does not update the running +// binary. So the message names the method and how to upgrade IT. +namespace { +constexpr std::string_view kInstallShUpgrade = + " Upgrade: re-run the install.sh one-liner\n" + " curl -fsSL https://github.com/mcpp-community/mcpp/" + "releases/latest/download/install.sh | bash\n"; +constexpr std::string_view kDistroUpgrade = + " Upgrade: this is a distro-managed install (AUR) — update the package\n" + " with your AUR helper (e.g. 'paru -Syu mcpp-bin' or\n" + " 'yay -Syu mcpp-bin'). The install.sh one-liner installs a\n" + " separate copy and will NOT update this one.\n"; +constexpr std::string_view kXlingsUpgrade = + " Upgrade: 'xlings update mcpp' (recommended default installer)\n"; +} // namespace + std::optional floor_violation(std::string_view minMcpp, std::string_view ownVersion) { @@ -128,11 +156,37 @@ floor_violation(std::string_view minMcpp, std::string_view ownVersion) if (*have >= *need) return std::nullopt; return std::format( "index requires mcpp >= {} but this is mcpp {} [E0006]\n" - " Upgrade: curl -fsSL https://github.com/mcpp-community/mcpp/" - "releases/latest/download/install.sh | bash\n" + "{}" " Details: mcpp explain E0006 " "(override for debugging: MCPP_INDEX_FLOOR=ignore)", - minMcpp, ownVersion); + minMcpp, ownVersion, kInstallShUpgrade); +} + +// Pure: swap the Upgrade advice for the install layout the caller detected. +std::string e0006_message(std::string violation, bool distroManaged) +{ + if (distroManaged) { + auto pos = violation.find(kInstallShUpgrade); + if (pos != std::string::npos) + violation.replace(pos, kInstallShUpgrade.size(), kDistroUpgrade); + } + // Append the recommended installer note to every layout. + violation += kXlingsUpgrade; + return violation; +} + +// Impure (reads /proc/self/exe): true when the running binary sits under the +// distro-managed tree (/opt/mcpp — the AUR layout). install.sh / xlings +// installs keep the binary inside $MCPP_HOME (~/.mcpp) instead. +bool distro_managed_install() +{ +#if defined(_WIN32) || defined(__APPLE__) + return false; +#else + std::error_code ec; + auto self = mcpp::platform::fs::self_exe_path(); + return self.string().find("/opt/mcpp/") != std::string::npos; +#endif } bool index_usable(const std::filesystem::path& indexRoot) @@ -192,15 +246,17 @@ check_index_floor(const std::filesystem::path& indexRoot) auto violation = floor_violation(c->minMcpp, mcpp::MCPP_VERSION); if (!violation) return std::nullopt; + auto message = e0006_message(*violation, distro_managed_install()); + // Record BEFORE the dedup return: the fact must be queryable no matter how // many times this root is opened, while the message is printed only once. // Deriving "was anything unusable?" from "did we print?" is what made the // second and later reads indistinguishable from an ordinary miss. if (!index_marked_unusable(indexRoot)) - unusable_registry().push_back({indexRoot, *violation}); + unusable_registry().push_back({indexRoot, message}); else return std::nullopt; // already reported — stay quiet - return violation; + return message; } } // namespace mcpp::pm diff --git a/tests/unit/test_index_contract.cpp b/tests/unit/test_index_contract.cpp index a6f991d6..3163a013 100644 --- a/tests/unit/test_index_contract.cpp +++ b/tests/unit/test_index_contract.cpp @@ -14,6 +14,31 @@ TEST(IndexContract, FloorViolationOrdering) { EXPECT_NE(v->find("0.0.85"), std::string::npos); } +// The Upgrade advice must tell the user which install method THEY have. A +// single hardcoded install.sh one-liner misleads distro (AUR) users into +// installing a second copy that does not update the running binary. +TEST(IndexContract, E0006MessageSwitchesUpgradeAdviceByLayout) { + using mcpp::pm::floor_violation; + using mcpp::pm::e0006_message; + auto violation = floor_violation("2026.8.3.3", "2026.7.28.2"); + ASSERT_TRUE(violation.has_value()); + + // Non-distro (install.sh / xlings) layout keeps the install.sh one-liner + // and always appends the recommended-installer note. + auto script = e0006_message(*violation, /*distroManaged=*/false); + EXPECT_NE(script.find("install.sh"), std::string::npos); + EXPECT_EQ(script.find("distro-managed"), std::string::npos); + EXPECT_NE(script.find("xlings update mcpp"), std::string::npos); + EXPECT_NE(script.find("E0006"), std::string::npos); + + // Distro (AUR) layout swaps in the package-manager advice. + auto distro = e0006_message(*violation, /*distroManaged=*/true); + EXPECT_NE(distro.find("distro-managed"), std::string::npos); + EXPECT_EQ(distro.find("re-run the install.sh one-liner"), std::string::npos); + EXPECT_NE(distro.find("xlings update mcpp"), std::string::npos); + EXPECT_NE(distro.find("E0006"), std::string::npos); +} + // The floor compares mcpp's OWN version, so the date scheme (YYYY.M.D.N) has // to be ordered on all four segments. While parse_version truncated at three, // every release of a given day compared equal and the floor let a too-old mcpp From b300395afe807fcaf8187e4c3891e9367aaee5d3 Mon Sep 17 00:00:00 2001 From: lildengzi <2580862656@qq.com> Date: Sun, 9 Aug 2026 02:45:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(aur):=20=E6=96=B0=E5=A2=9E=E7=BB=99=20?= =?UTF-8?q?arch=20=E7=B3=BB=E7=94=A8=E6=88=B7=E7=9A=84=E7=89=B9=E5=88=AB?= =?UTF-8?q?=E5=85=B3=E7=85=A7=20=F0=9F=98=8B=EF=BC=88bump=20mcpp-bin/mcpp-?= =?UTF-8?q?m=20=E8=87=B3=20v2026.8.8.4=EF=BC=8C=E6=B6=88=E9=99=A4=E4=BD=8E?= =?UTF-8?q?=E4=BA=8E=E7=B4=A2=E5=BC=95=E4=B8=8B=E9=99=90=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=20E0006=EF=BC=9B=E6=96=B0=E5=A2=9E=20mcpp-git=20?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=8C=85=EF=BC=8C=E8=B7=9F=E9=9A=8F=20master?= =?UTF-8?q?=20=E6=B0=B8=E4=B8=8D=E6=BB=9E=E5=90=8E=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/aur/README.md | 38 +++++++++----- scripts/aur/mcpp-bin/.SRCINFO | 10 ++-- scripts/aur/mcpp-bin/PKGBUILD | 6 +-- scripts/aur/mcpp-git/.SRCINFO | 21 ++++++++ scripts/aur/mcpp-git/PKGBUILD | 96 +++++++++++++++++++++++++++++++++++ scripts/aur/mcpp-git/mcpp.sh | 27 ++++++++++ scripts/aur/mcpp-m/.SRCINFO | 4 +- scripts/aur/mcpp-m/PKGBUILD | 2 +- 8 files changed, 180 insertions(+), 24 deletions(-) create mode 100644 scripts/aur/mcpp-git/.SRCINFO create mode 100644 scripts/aur/mcpp-git/PKGBUILD create mode 100755 scripts/aur/mcpp-git/mcpp.sh diff --git a/scripts/aur/README.md b/scripts/aur/README.md index 426bbe07..83b49c4a 100644 --- a/scripts/aur/README.md +++ b/scripts/aur/README.md @@ -1,18 +1,20 @@ # AUR packaging -Arch Linux packaging for mcpp. Two packages, same runtime layout: +Arch Linux packaging for mcpp. Three packages, same runtime layout: | Package | What it installs | Pick it when | | --- | --- | --- | | [`mcpp-bin`](mcpp-bin/) | the **prebuilt** release binary (what [`install.sh`](../../install.sh) downloads) | you just want mcpp, fast | -| [`mcpp-m`](mcpp-m/) | mcpp **built from source**, bootstrapped with `mcpp-bin` | you want a from-source build | +| [`mcpp-m`](mcpp-m/) | mcpp **built from source**, bootstrapped with `mcpp-bin` | you want a from-source build of a release | +| [`mcpp-git`](mcpp-git/) | mcpp **built from the git master**, bootstrapped with `mcpp-bin` | you want to track master (rolling) and never lag the index floor | ```sh yay -S mcpp-bin # prebuilt yay -S mcpp-m # from source (pulls mcpp-bin as a build dep) +yay -S mcpp-git # from git master (pulls mcpp-bin as a build dep) ``` -The two `conflict` with each other, so only one can be installed at a time. +The three `conflict` with each other, so only one can be installed at a time. Supported architectures: `x86_64`, `aarch64`. ### Why not just `mcpp`? @@ -20,9 +22,10 @@ Supported architectures: `x86_64`, `aarch64`. The name `mcpp` is already taken by **`extra/mcpp`** — Matsui's C preprocessor, an unrelated long-standing official Arch package that owns `/usr/bin/mcpp`. The AUR refuses to host any package whose `pkgname` (or `provides`) collides with an -official-repo package, so our packages are `mcpp-bin` / `mcpp-m`. They still -install the `mcpp` command at `/usr/bin/mcpp`, so both `conflicts=('mcpp')` with -that preprocessor — you can have our mcpp or the preprocessor, not both. +official-repo package, so our packages are `mcpp-bin` / `mcpp-m` / `mcpp-git`. +They still install the `mcpp` command at `/usr/bin/mcpp`, so all three +`conflicts=('mcpp')` with that preprocessor — you can have our mcpp or the +preprocessor, not both. ## Layout & why the wrapper exists @@ -52,30 +55,39 @@ user already exported, so a custom home or xlings still works. First `mcpp build`/`mcpp run` bootstraps the sandbox (downloads ninja, patchelf and the default toolchain into `~/.mcpp`) — expected, and only once per user. -### How the `mcpp-m` source package builds +### How the `mcpp-m` / `mcpp-git` source packages build -mcpp is self-hosting. The `mcpp-m` PKGBUILD uses the installed `mcpp-bin` as the -bootstrap compiler and runs `mcpp build --target -linux-musl` — the same +mcpp is self-hosting. Both source PKGBUILDs use the installed `mcpp-bin` as the +bootstrap compiler and run `mcpp build --target -linux-musl` — the same path [`release.yml`](../../.github/workflows/release.yml) ships. mcpp downloads its own pinned toolchain (it does **not** use the host gcc), so the build needs network access, like the upstream release build. +`mcpp-m` builds a pinned release tarball; `mcpp-git` checks out `master` from +the official repo (`source = mcpp::git+…`, `sha256sums = SKIP`) and derives a +monotonic `pkgver` from `git describe` (tag + commit distance). Because it +tracks master, `mcpp-git` can never lag the index floor the way `mcpp-bin` does +between releases — at the cost of tracking bleeding-edge master. + ## Files ``` scripts/aur/ README.md this file - update.sh bump BOTH packages to a release version + update.sh bump the release-pinned packages (mcpp-bin, mcpp-m) mcpp-bin/{PKGBUILD, .SRCINFO, mcpp.sh} mcpp-m/{PKGBUILD, .SRCINFO, mcpp.sh} + mcpp-git/{PKGBUILD, .SRCINFO, mcpp.sh} ``` -`mcpp.sh` is identical in both dirs (each AUR repo must be self-contained); -`update.sh` keeps them in sync. +`mcpp.sh` is identical in all three dirs (each AUR repo must be self-contained); +`update.sh` keeps `mcpp-bin`/`mcpp-m` in sync. `mcpp-git` has no checksums to +bump (VCS source) and is not touched by `update.sh`. ## Releasing a new version -After a GitHub release is published (and mirrored), bump both packages: +After a GitHub release is published (and mirrored), bump the release-pinned +packages (`mcpp-bin`, `mcpp-m`; `mcpp-git` tracks master and needs no bump): ```sh scripts/aur/update.sh # uses [package].version from mcpp.toml diff --git a/scripts/aur/mcpp-bin/.SRCINFO b/scripts/aur/mcpp-bin/.SRCINFO index f101e913..02c7a9e4 100644 --- a/scripts/aur/mcpp-bin/.SRCINFO +++ b/scripts/aur/mcpp-bin/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = mcpp-bin pkgdesc = Modern C++ build & package management tool (prebuilt binary) - pkgver = 0.0.65 + pkgver = 2026.8.8.4 pkgrel = 1 url = https://github.com/mcpp-community/mcpp arch = x86_64 @@ -12,9 +12,9 @@ pkgbase = mcpp-bin options = !strip source = mcpp.sh sha256sums = SKIP - source_x86_64 = mcpp-0.0.65-linux-x86_64.tar.gz::https://github.com/mcpp-community/mcpp/releases/download/v0.0.65/mcpp-0.0.65-linux-x86_64.tar.gz - sha256sums_x86_64 = 0d1d16aae05e4d7c59a00a2621abc4b99421b9821d2145c139fabf95fcf93409 - source_aarch64 = mcpp-0.0.65-linux-aarch64.tar.gz::https://github.com/mcpp-community/mcpp/releases/download/v0.0.65/mcpp-0.0.65-linux-aarch64.tar.gz - sha256sums_aarch64 = 20dd7a8be657bf2e32dcffcf10b758e34fe740fcdb1ceb374822d5ee25cb4a52 + source_x86_64 = mcpp-2026.8.8.4-linux-x86_64.tar.gz::https://github.com/mcpp-community/mcpp/releases/download/v2026.8.8.4/mcpp-2026.8.8.4-linux-x86_64.tar.gz + sha256sums_x86_64 = a8f30fc73fae75381cdd734d204e6c04a24c55365cdf8bb6da07c3aa663c8f9f + source_aarch64 = mcpp-2026.8.8.4-linux-aarch64.tar.gz::https://github.com/mcpp-community/mcpp/releases/download/v2026.8.8.4/mcpp-2026.8.8.4-linux-aarch64.tar.gz + sha256sums_aarch64 = e0d63de0f6e0111f47df00e9135baf437aed2bcdb883dbb658880d9ee4418e27 pkgname = mcpp-bin diff --git a/scripts/aur/mcpp-bin/PKGBUILD b/scripts/aur/mcpp-bin/PKGBUILD index c0614f19..1d0ba43f 100644 --- a/scripts/aur/mcpp-bin/PKGBUILD +++ b/scripts/aur/mcpp-bin/PKGBUILD @@ -5,7 +5,7 @@ # how this is published to the AUR and how to bump it (scripts/aur/update.sh). pkgname=mcpp-bin -pkgver=0.0.65 +pkgver=2026.8.8.4 pkgrel=1 pkgdesc="Modern C++ build & package management tool (prebuilt binary)" arch=('x86_64' 'aarch64') @@ -28,8 +28,8 @@ source_aarch64=("mcpp-${pkgver}-linux-aarch64.tar.gz::${_relbase}/mcpp-${pkgver} source=("mcpp.sh") sha256sums=('SKIP') -sha256sums_x86_64=('0d1d16aae05e4d7c59a00a2621abc4b99421b9821d2145c139fabf95fcf93409') -sha256sums_aarch64=('20dd7a8be657bf2e32dcffcf10b758e34fe740fcdb1ceb374822d5ee25cb4a52') +sha256sums_x86_64=('a8f30fc73fae75381cdd734d204e6c04a24c55365cdf8bb6da07c3aa663c8f9f') +sha256sums_aarch64=('e0d63de0f6e0111f47df00e9135baf437aed2bcdb883dbb658880d9ee4418e27') package() { local _src="${srcdir}/mcpp-${pkgver}-linux-${CARCH}" diff --git a/scripts/aur/mcpp-git/.SRCINFO b/scripts/aur/mcpp-git/.SRCINFO new file mode 100644 index 00000000..9a934475 --- /dev/null +++ b/scripts/aur/mcpp-git/.SRCINFO @@ -0,0 +1,21 @@ +pkgbase = mcpp-git + pkgdesc = Modern C++ build & package management tool (git master) + pkgver = 2026.8.8.4 + pkgrel = 1 + url = https://github.com/mcpp-community/mcpp + arch = x86_64 + arch = aarch64 + license = Apache-2.0 + makedepends = mcpp-bin + makedepends = git + depends = git + conflicts = mcpp-bin + conflicts = mcpp-m + conflicts = mcpp + options = !strip + source = mcpp::git+https://github.com/mcpp-community/mcpp.git + source = mcpp.sh + sha256sums = SKIP + sha256sums = SKIP + +pkgname = mcpp-git diff --git a/scripts/aur/mcpp-git/PKGBUILD b/scripts/aur/mcpp-git/PKGBUILD new file mode 100644 index 00000000..1637fe02 --- /dev/null +++ b/scripts/aur/mcpp-git/PKGBUILD @@ -0,0 +1,96 @@ +# Maintainer: mcpp-community +# +# mcpp-git — mcpp built from the upstream git repository (rolling master), +# bootstrapped with the prebuilt `mcpp-bin`. Same self-hosted build as +# `mcpp-m`, but tracks master instead of a pinned release — so it can never +# lag the index floor (E0006) the way `mcpp-bin` does between releases. +# +# Rolling master is bleeding-edge: prefer `mcpp-bin` for stable use. +# +# NB: the AUR/official name `mcpp` is taken by Matsui's C preprocessor +# (extra/mcpp), so this package is `mcpp-git`. It still installs the `mcpp` +# command at /usr/bin/mcpp, hence the conflict with that preprocessor. +# See scripts/aur/README.md. + +pkgname=mcpp-git +# Static seed only — real builds override it via pkgver() below. Kept at the +# current release so the AUR listing doesn't look ancient; actual version is +# whatever master reports at build time. +pkgver=2026.8.8.4 +pkgrel=1 +pkgdesc="Modern C++ build & package management tool (git master)" +arch=('x86_64' 'aarch64') +url="https://github.com/mcpp-community/mcpp" +license=('Apache-2.0') +# mcpp/xlings are statically linked; git is used for package-index sync. +depends=('git') +# mcpp-bin is the bootstrap compiler; it also supplies the bundled xlings we +# ship at runtime. git is needed for toolchain/index sync during the build. +makedepends=('mcpp-bin' 'git') +# mcpp-bin / mcpp-m = the same tool (mutually exclusive); mcpp = the C +# preprocessor that also owns /usr/bin/mcpp. +conflicts=('mcpp-bin' 'mcpp-m' 'mcpp') +# We strip the built ELF ourselves; don't let makepkg re-strip the vendored +# xlings binary (a prebuilt third-party artifact). +options=('!strip') + +source=("mcpp::git+https://github.com/mcpp-community/mcpp.git" + "mcpp.sh") +sha256sums=('SKIP' + 'SKIP') + +# Rolling master has no stable release number. Pacman only needs a +# monotonically increasing pkgver, so derive one from the closest tag plus the +# commit distance (AUR -git convention): v2026.8.8.4-5-g → +# 2026.8.8.4.5.g. The binary's own version comes from the checked-out +# source (src/version.cppm), independent of pkgver. +pkgver() { + cd "${srcdir}/mcpp" + git describe --long --tags | sed 's/^v//; s/-/./g' +} + +# mcpp downloads its own pinned toolchain (gcc/ninja/patchelf) into the build +# sandbox — it does not use the host gcc. This needs network access at build +# time, like the upstream release build. +build() { + cd "${srcdir}/mcpp" + + case "$CARCH" in + x86_64) _target=x86_64-linux-musl ;; + aarch64) _target=aarch64-linux-musl ;; + *) echo "unsupported CARCH: $CARCH" >&2; return 1 ;; + esac + + # Bootstrap with mcpp-bin's real binary (not its /usr/bin wrapper, which + # would force MCPP_HOME into the user's home). Keep the build sandbox + # self-contained under $srcdir and reuse mcpp-bin's bundled xlings. + export MCPP_HOME="${srcdir}/.mcpp-home" + export MCPP_VENDORED_XLINGS="/opt/mcpp/registry/bin/xlings" + + /opt/mcpp/bin/mcpp build --target "$_target" + + _artifact=$(find "target/${_target}" -type f -name mcpp | head -1) + test -n "$_artifact" || { echo "build produced no mcpp binary" >&2; return 1; } + file "$_artifact" | grep -q 'statically linked' + # Debug info on a static ELF balloons it ~7×; strip with the native tool. + strip "$_artifact" + + # Stash artifact + the vendored xlings for package() (which has no /opt + # guarantees beyond makedepends being installed). + install -Dm755 "$_artifact" "${srcdir}/stage/bin/mcpp" + install -Dm755 /opt/mcpp/registry/bin/xlings "${srcdir}/stage/registry/bin/xlings" +} + +package() { + # Same /opt + wrapper layout as mcpp-bin / mcpp-m (see scripts/aur/README.md + # for why the per-user wrapper exists instead of a /usr/bin symlink). + install -Dm755 "${srcdir}/stage/bin/mcpp" "${pkgdir}/opt/mcpp/bin/mcpp" + install -Dm755 "${srcdir}/stage/registry/bin/xlings" "${pkgdir}/opt/mcpp/registry/bin/xlings" + + install -Dm755 "${srcdir}/mcpp.sh" "${pkgdir}/usr/bin/mcpp" + + install -Dm644 "${srcdir}/mcpp/LICENSE" \ + "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -Dm644 "${srcdir}/mcpp/README.md" \ + "${pkgdir}/usr/share/doc/${pkgname}/README.md" +} diff --git a/scripts/aur/mcpp-git/mcpp.sh b/scripts/aur/mcpp-git/mcpp.sh new file mode 100755 index 00000000..87cbde91 --- /dev/null +++ b/scripts/aur/mcpp-git/mcpp.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# mcpp launcher (Arch / AUR mcpp-bin package). +# +# The AUR package installs mcpp's self-contained tree read-only under +# /opt/mcpp (shared by every user). But mcpp WRITES its registry sandbox, +# BMI/metadata caches, logs and downloaded toolchains into MCPP_HOME at +# runtime — that has to be a per-user, writable location, never /opt. +# +# mcpp resolves MCPP_HOME from the binary's real path (/proc/self/exe, which +# resolves symlinks), so a plain /usr/bin symlink would make MCPP_HOME land in +# the root-owned /opt tree and every command would fail to write. This wrapper +# fixes that by pinning the two env knobs the binary honors: +# +# MCPP_HOME — per-user home (default ~/.mcpp, same as install.sh) +# MCPP_VENDORED_XLINGS — the bundled xlings under /opt, which mcpp copies +# into $MCPP_HOME/registry/bin/xlings on first run +# +# Both respect a value the user already exported, so power users can still +# point mcpp at a custom home or xlings. +set -eu + +MCPP_OPT="/opt/mcpp" + +export MCPP_HOME="${MCPP_HOME:-$HOME/.mcpp}" +export MCPP_VENDORED_XLINGS="${MCPP_VENDORED_XLINGS:-$MCPP_OPT/registry/bin/xlings}" + +exec "$MCPP_OPT/bin/mcpp" "$@" diff --git a/scripts/aur/mcpp-m/.SRCINFO b/scripts/aur/mcpp-m/.SRCINFO index 47e8b09e..80e8e287 100644 --- a/scripts/aur/mcpp-m/.SRCINFO +++ b/scripts/aur/mcpp-m/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = mcpp-m pkgdesc = Modern C++ build & package management tool (built from source) - pkgver = 0.0.65 + pkgver = 2026.8.8.4 pkgrel = 1 url = https://github.com/mcpp-community/mcpp arch = x86_64 @@ -12,7 +12,7 @@ pkgbase = mcpp-m conflicts = mcpp-bin conflicts = mcpp options = !strip - source = mcpp-0.0.65.tar.gz::https://github.com/mcpp-community/mcpp/archive/v0.0.65.tar.gz + source = mcpp-2026.8.8.4.tar.gz::https://github.com/mcpp-community/mcpp/archive/v2026.8.8.4.tar.gz source = mcpp.sh sha256sums = 07f8233d3f18565c52607816a82c9facda3a7ed11c67d3772e42bd84cb54476a sha256sums = SKIP diff --git a/scripts/aur/mcpp-m/PKGBUILD b/scripts/aur/mcpp-m/PKGBUILD index 8306674d..ff1ff8e7 100644 --- a/scripts/aur/mcpp-m/PKGBUILD +++ b/scripts/aur/mcpp-m/PKGBUILD @@ -11,7 +11,7 @@ # See scripts/aur/README.md. pkgname=mcpp-m -pkgver=0.0.65 +pkgver=2026.8.8.4 pkgrel=1 pkgdesc="Modern C++ build & package management tool (built from source)" arch=('x86_64' 'aarch64')