Skip to content

Commit 54d29fc

Browse files
authored
fix: E0006 Upgrade 提示按安装布局区分 + AUR 特别关照(bump 至 v2026.8.8.4、新增 mcpp-git) (#395)
* fix: E0006 Upgrade 提示按安装布局给出指引(AUR 检测 + 推荐默认 xlings),避免误导用户装出第二份(#394) * feat(aur): 新增给 arch 系用户的特别关照 😋(bump mcpp-bin/mcpp-m 至 v2026.8.8.4,消除低于索引下限导致的 E0006;新增 mcpp-git 滚动包,跟随 master 永不滞后)
1 parent 8625c45 commit 54d29fc

10 files changed

Lines changed: 266 additions & 29 deletions

File tree

scripts/aur/README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
# AUR packaging
22

3-
Arch Linux packaging for mcpp. Two packages, same runtime layout:
3+
Arch Linux packaging for mcpp. Three packages, same runtime layout:
44

55
| Package | What it installs | Pick it when |
66
| --- | --- | --- |
77
| [`mcpp-bin`](mcpp-bin/) | the **prebuilt** release binary (what [`install.sh`](../../install.sh) downloads) | you just want mcpp, fast |
8-
| [`mcpp-m`](mcpp-m/) | mcpp **built from source**, bootstrapped with `mcpp-bin` | you want a from-source build |
8+
| [`mcpp-m`](mcpp-m/) | mcpp **built from source**, bootstrapped with `mcpp-bin` | you want a from-source build of a release |
9+
| [`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 |
910

1011
```sh
1112
yay -S mcpp-bin # prebuilt
1213
yay -S mcpp-m # from source (pulls mcpp-bin as a build dep)
14+
yay -S mcpp-git # from git master (pulls mcpp-bin as a build dep)
1315
```
1416

15-
The two `conflict` with each other, so only one can be installed at a time.
17+
The three `conflict` with each other, so only one can be installed at a time.
1618
Supported architectures: `x86_64`, `aarch64`.
1719

1820
### Why not just `mcpp`?
1921

2022
The name `mcpp` is already taken by **`extra/mcpp`** — Matsui's C preprocessor,
2123
an unrelated long-standing official Arch package that owns `/usr/bin/mcpp`. The
2224
AUR refuses to host any package whose `pkgname` (or `provides`) collides with an
23-
official-repo package, so our packages are `mcpp-bin` / `mcpp-m`. They still
24-
install the `mcpp` command at `/usr/bin/mcpp`, so both `conflicts=('mcpp')` with
25-
that preprocessor — you can have our mcpp or the preprocessor, not both.
25+
official-repo package, so our packages are `mcpp-bin` / `mcpp-m` / `mcpp-git`.
26+
They still install the `mcpp` command at `/usr/bin/mcpp`, so all three
27+
`conflicts=('mcpp')` with that preprocessor — you can have our mcpp or the
28+
preprocessor, not both.
2629

2730
## Layout & why the wrapper exists
2831

@@ -52,30 +55,39 @@ user already exported, so a custom home or xlings still works.
5255
First `mcpp build`/`mcpp run` bootstraps the sandbox (downloads ninja, patchelf
5356
and the default toolchain into `~/.mcpp`) — expected, and only once per user.
5457

55-
### How the `mcpp-m` source package builds
58+
### How the `mcpp-m` / `mcpp-git` source packages build
5659

57-
mcpp is self-hosting. The `mcpp-m` PKGBUILD uses the installed `mcpp-bin` as the
58-
bootstrap compiler and runs `mcpp build --target <arch>-linux-musl` — the same
60+
mcpp is self-hosting. Both source PKGBUILDs use the installed `mcpp-bin` as the
61+
bootstrap compiler and run `mcpp build --target <arch>-linux-musl` — the same
5962
path [`release.yml`](../../.github/workflows/release.yml) ships. mcpp downloads
6063
its own pinned toolchain (it does **not** use the host gcc), so the build needs
6164
network access, like the upstream release build.
6265

66+
`mcpp-m` builds a pinned release tarball; `mcpp-git` checks out `master` from
67+
the official repo (`source = mcpp::git+…`, `sha256sums = SKIP`) and derives a
68+
monotonic `pkgver` from `git describe` (tag + commit distance). Because it
69+
tracks master, `mcpp-git` can never lag the index floor the way `mcpp-bin` does
70+
between releases — at the cost of tracking bleeding-edge master.
71+
6372
## Files
6473

6574
```
6675
scripts/aur/
6776
README.md this file
68-
update.sh bump BOTH packages to a release version
77+
update.sh bump the release-pinned packages (mcpp-bin, mcpp-m)
6978
mcpp-bin/{PKGBUILD, .SRCINFO, mcpp.sh}
7079
mcpp-m/{PKGBUILD, .SRCINFO, mcpp.sh}
80+
mcpp-git/{PKGBUILD, .SRCINFO, mcpp.sh}
7181
```
7282

73-
`mcpp.sh` is identical in both dirs (each AUR repo must be self-contained);
74-
`update.sh` keeps them in sync.
83+
`mcpp.sh` is identical in all three dirs (each AUR repo must be self-contained);
84+
`update.sh` keeps `mcpp-bin`/`mcpp-m` in sync. `mcpp-git` has no checksums to
85+
bump (VCS source) and is not touched by `update.sh`.
7586

7687
## Releasing a new version
7788

78-
After a GitHub release is published (and mirrored), bump both packages:
89+
After a GitHub release is published (and mirrored), bump the release-pinned
90+
packages (`mcpp-bin`, `mcpp-m`; `mcpp-git` tracks master and needs no bump):
7991

8092
```sh
8193
scripts/aur/update.sh # uses [package].version from mcpp.toml

scripts/aur/mcpp-bin/.SRCINFO

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = mcpp-bin
22
pkgdesc = Modern C++ build & package management tool (prebuilt binary)
3-
pkgver = 0.0.65
3+
pkgver = 2026.8.8.4
44
pkgrel = 1
55
url = https://github.com/mcpp-community/mcpp
66
arch = x86_64
@@ -12,9 +12,9 @@ pkgbase = mcpp-bin
1212
options = !strip
1313
source = mcpp.sh
1414
sha256sums = SKIP
15-
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
16-
sha256sums_x86_64 = 0d1d16aae05e4d7c59a00a2621abc4b99421b9821d2145c139fabf95fcf93409
17-
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
18-
sha256sums_aarch64 = 20dd7a8be657bf2e32dcffcf10b758e34fe740fcdb1ceb374822d5ee25cb4a52
15+
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
16+
sha256sums_x86_64 = a8f30fc73fae75381cdd734d204e6c04a24c55365cdf8bb6da07c3aa663c8f9f
17+
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
18+
sha256sums_aarch64 = e0d63de0f6e0111f47df00e9135baf437aed2bcdb883dbb658880d9ee4418e27
1919

2020
pkgname = mcpp-bin

scripts/aur/mcpp-bin/PKGBUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# how this is published to the AUR and how to bump it (scripts/aur/update.sh).
66

77
pkgname=mcpp-bin
8-
pkgver=0.0.65
8+
pkgver=2026.8.8.4
99
pkgrel=1
1010
pkgdesc="Modern C++ build & package management tool (prebuilt binary)"
1111
arch=('x86_64' 'aarch64')
@@ -28,8 +28,8 @@ source_aarch64=("mcpp-${pkgver}-linux-aarch64.tar.gz::${_relbase}/mcpp-${pkgver}
2828
source=("mcpp.sh")
2929

3030
sha256sums=('SKIP')
31-
sha256sums_x86_64=('0d1d16aae05e4d7c59a00a2621abc4b99421b9821d2145c139fabf95fcf93409')
32-
sha256sums_aarch64=('20dd7a8be657bf2e32dcffcf10b758e34fe740fcdb1ceb374822d5ee25cb4a52')
31+
sha256sums_x86_64=('a8f30fc73fae75381cdd734d204e6c04a24c55365cdf8bb6da07c3aa663c8f9f')
32+
sha256sums_aarch64=('e0d63de0f6e0111f47df00e9135baf437aed2bcdb883dbb658880d9ee4418e27')
3333

3434
package() {
3535
local _src="${srcdir}/mcpp-${pkgver}-linux-${CARCH}"

scripts/aur/mcpp-git/.SRCINFO

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
pkgbase = mcpp-git
2+
pkgdesc = Modern C++ build & package management tool (git master)
3+
pkgver = 2026.8.8.4
4+
pkgrel = 1
5+
url = https://github.com/mcpp-community/mcpp
6+
arch = x86_64
7+
arch = aarch64
8+
license = Apache-2.0
9+
makedepends = mcpp-bin
10+
makedepends = git
11+
depends = git
12+
conflicts = mcpp-bin
13+
conflicts = mcpp-m
14+
conflicts = mcpp
15+
options = !strip
16+
source = mcpp::git+https://github.com/mcpp-community/mcpp.git
17+
source = mcpp.sh
18+
sha256sums = SKIP
19+
sha256sums = SKIP
20+
21+
pkgname = mcpp-git

scripts/aur/mcpp-git/PKGBUILD

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Maintainer: mcpp-community <x.d2learn.org@gmail.com>
2+
#
3+
# mcpp-git — mcpp built from the upstream git repository (rolling master),
4+
# bootstrapped with the prebuilt `mcpp-bin`. Same self-hosted build as
5+
# `mcpp-m`, but tracks master instead of a pinned release — so it can never
6+
# lag the index floor (E0006) the way `mcpp-bin` does between releases.
7+
#
8+
# Rolling master is bleeding-edge: prefer `mcpp-bin` for stable use.
9+
#
10+
# NB: the AUR/official name `mcpp` is taken by Matsui's C preprocessor
11+
# (extra/mcpp), so this package is `mcpp-git`. It still installs the `mcpp`
12+
# command at /usr/bin/mcpp, hence the conflict with that preprocessor.
13+
# See scripts/aur/README.md.
14+
15+
pkgname=mcpp-git
16+
# Static seed only — real builds override it via pkgver() below. Kept at the
17+
# current release so the AUR listing doesn't look ancient; actual version is
18+
# whatever master reports at build time.
19+
pkgver=2026.8.8.4
20+
pkgrel=1
21+
pkgdesc="Modern C++ build & package management tool (git master)"
22+
arch=('x86_64' 'aarch64')
23+
url="https://github.com/mcpp-community/mcpp"
24+
license=('Apache-2.0')
25+
# mcpp/xlings are statically linked; git is used for package-index sync.
26+
depends=('git')
27+
# mcpp-bin is the bootstrap compiler; it also supplies the bundled xlings we
28+
# ship at runtime. git is needed for toolchain/index sync during the build.
29+
makedepends=('mcpp-bin' 'git')
30+
# mcpp-bin / mcpp-m = the same tool (mutually exclusive); mcpp = the C
31+
# preprocessor that also owns /usr/bin/mcpp.
32+
conflicts=('mcpp-bin' 'mcpp-m' 'mcpp')
33+
# We strip the built ELF ourselves; don't let makepkg re-strip the vendored
34+
# xlings binary (a prebuilt third-party artifact).
35+
options=('!strip')
36+
37+
source=("mcpp::git+https://github.com/mcpp-community/mcpp.git"
38+
"mcpp.sh")
39+
sha256sums=('SKIP'
40+
'SKIP')
41+
42+
# Rolling master has no stable release number. Pacman only needs a
43+
# monotonically increasing pkgver, so derive one from the closest tag plus the
44+
# commit distance (AUR -git convention): v2026.8.8.4-5-g<hash> →
45+
# 2026.8.8.4.5.g<hash>. The binary's own version comes from the checked-out
46+
# source (src/version.cppm), independent of pkgver.
47+
pkgver() {
48+
cd "${srcdir}/mcpp"
49+
git describe --long --tags | sed 's/^v//; s/-/./g'
50+
}
51+
52+
# mcpp downloads its own pinned toolchain (gcc/ninja/patchelf) into the build
53+
# sandbox — it does not use the host gcc. This needs network access at build
54+
# time, like the upstream release build.
55+
build() {
56+
cd "${srcdir}/mcpp"
57+
58+
case "$CARCH" in
59+
x86_64) _target=x86_64-linux-musl ;;
60+
aarch64) _target=aarch64-linux-musl ;;
61+
*) echo "unsupported CARCH: $CARCH" >&2; return 1 ;;
62+
esac
63+
64+
# Bootstrap with mcpp-bin's real binary (not its /usr/bin wrapper, which
65+
# would force MCPP_HOME into the user's home). Keep the build sandbox
66+
# self-contained under $srcdir and reuse mcpp-bin's bundled xlings.
67+
export MCPP_HOME="${srcdir}/.mcpp-home"
68+
export MCPP_VENDORED_XLINGS="/opt/mcpp/registry/bin/xlings"
69+
70+
/opt/mcpp/bin/mcpp build --target "$_target"
71+
72+
_artifact=$(find "target/${_target}" -type f -name mcpp | head -1)
73+
test -n "$_artifact" || { echo "build produced no mcpp binary" >&2; return 1; }
74+
file "$_artifact" | grep -q 'statically linked'
75+
# Debug info on a static ELF balloons it ~7×; strip with the native tool.
76+
strip "$_artifact"
77+
78+
# Stash artifact + the vendored xlings for package() (which has no /opt
79+
# guarantees beyond makedepends being installed).
80+
install -Dm755 "$_artifact" "${srcdir}/stage/bin/mcpp"
81+
install -Dm755 /opt/mcpp/registry/bin/xlings "${srcdir}/stage/registry/bin/xlings"
82+
}
83+
84+
package() {
85+
# Same /opt + wrapper layout as mcpp-bin / mcpp-m (see scripts/aur/README.md
86+
# for why the per-user wrapper exists instead of a /usr/bin symlink).
87+
install -Dm755 "${srcdir}/stage/bin/mcpp" "${pkgdir}/opt/mcpp/bin/mcpp"
88+
install -Dm755 "${srcdir}/stage/registry/bin/xlings" "${pkgdir}/opt/mcpp/registry/bin/xlings"
89+
90+
install -Dm755 "${srcdir}/mcpp.sh" "${pkgdir}/usr/bin/mcpp"
91+
92+
install -Dm644 "${srcdir}/mcpp/LICENSE" \
93+
"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
94+
install -Dm644 "${srcdir}/mcpp/README.md" \
95+
"${pkgdir}/usr/share/doc/${pkgname}/README.md"
96+
}

scripts/aur/mcpp-git/mcpp.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
# mcpp launcher (Arch / AUR mcpp-bin package).
3+
#
4+
# The AUR package installs mcpp's self-contained tree read-only under
5+
# /opt/mcpp (shared by every user). But mcpp WRITES its registry sandbox,
6+
# BMI/metadata caches, logs and downloaded toolchains into MCPP_HOME at
7+
# runtime — that has to be a per-user, writable location, never /opt.
8+
#
9+
# mcpp resolves MCPP_HOME from the binary's real path (/proc/self/exe, which
10+
# resolves symlinks), so a plain /usr/bin symlink would make MCPP_HOME land in
11+
# the root-owned /opt tree and every command would fail to write. This wrapper
12+
# fixes that by pinning the two env knobs the binary honors:
13+
#
14+
# MCPP_HOME — per-user home (default ~/.mcpp, same as install.sh)
15+
# MCPP_VENDORED_XLINGS — the bundled xlings under /opt, which mcpp copies
16+
# into $MCPP_HOME/registry/bin/xlings on first run
17+
#
18+
# Both respect a value the user already exported, so power users can still
19+
# point mcpp at a custom home or xlings.
20+
set -eu
21+
22+
MCPP_OPT="/opt/mcpp"
23+
24+
export MCPP_HOME="${MCPP_HOME:-$HOME/.mcpp}"
25+
export MCPP_VENDORED_XLINGS="${MCPP_VENDORED_XLINGS:-$MCPP_OPT/registry/bin/xlings}"
26+
27+
exec "$MCPP_OPT/bin/mcpp" "$@"

scripts/aur/mcpp-m/.SRCINFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = mcpp-m
22
pkgdesc = Modern C++ build & package management tool (built from source)
3-
pkgver = 0.0.65
3+
pkgver = 2026.8.8.4
44
pkgrel = 1
55
url = https://github.com/mcpp-community/mcpp
66
arch = x86_64
@@ -12,7 +12,7 @@ pkgbase = mcpp-m
1212
conflicts = mcpp-bin
1313
conflicts = mcpp
1414
options = !strip
15-
source = mcpp-0.0.65.tar.gz::https://github.com/mcpp-community/mcpp/archive/v0.0.65.tar.gz
15+
source = mcpp-2026.8.8.4.tar.gz::https://github.com/mcpp-community/mcpp/archive/v2026.8.8.4.tar.gz
1616
source = mcpp.sh
1717
sha256sums = 07f8233d3f18565c52607816a82c9facda3a7ed11c67d3772e42bd84cb54476a
1818
sha256sums = SKIP

scripts/aur/mcpp-m/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# See scripts/aur/README.md.
1212

1313
pkgname=mcpp-m
14-
pkgver=0.0.65
14+
pkgver=2026.8.8.4
1515
pkgrel=1
1616
pkgdesc="Modern C++ build & package management tool (built from source)"
1717
arch=('x86_64' 'aarch64')

0 commit comments

Comments
 (0)