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
2 changes: 1 addition & 1 deletion .github/workflows/aur-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ jobs:
}

publish mcpp-bin
publish mcpp
publish mcpp-m
29 changes: 19 additions & 10 deletions scripts/aur/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@ Arch Linux packaging for mcpp. Two 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`](mcpp/) | 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 |

```sh
yay -S mcpp-bin # prebuilt
yay -S mcpp # from source (pulls mcpp-bin as a build dep)
yay -S mcpp-m # from source (pulls mcpp-bin as a build dep)
```

Both `provides`/`conflicts` each other, so only one can be installed at a time.
The two `conflict` with each other, so only one can be installed at a time.
Supported architectures: `x86_64`, `aarch64`.

### Why not just `mcpp`?

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.

## Layout & why the wrapper exists

mcpp ships as a single self-contained tree. At runtime it **writes** into
Expand Down Expand Up @@ -43,9 +52,9 @@ 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` source package builds
### How the `mcpp-m` source package builds

mcpp is self-hosting. The `mcpp` PKGBUILD uses the installed `mcpp-bin` as the
mcpp is self-hosting. The `mcpp-m` PKGBUILD uses the installed `mcpp-bin` as the
bootstrap compiler and runs `mcpp build --target <arch>-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
Expand All @@ -58,7 +67,7 @@ scripts/aur/
README.md this file
update.sh bump BOTH packages to a release version
mcpp-bin/{PKGBUILD, .SRCINFO, mcpp.sh}
mcpp/{PKGBUILD, .SRCINFO, mcpp.sh}
mcpp-m/{PKGBUILD, .SRCINFO, mcpp.sh}
```

`mcpp.sh` is identical in both dirs (each AUR repo must be self-contained);
Expand All @@ -74,14 +83,14 @@ scripts/aur/update.sh # uses [package].version from mcpp.toml
```

`update.sh` pulls the per-arch `.sha256` sidecars (for `mcpp-bin`) and hashes
the source archive (for `mcpp`), rewrites `pkgver` + checksums, resets
the source archive (for `mcpp-m`), rewrites `pkgver` + checksums, resets
`pkgrel=1`, and regenerates both `.SRCINFO` files.

### Test locally (on Arch)

```sh
cd scripts/aur/mcpp-bin && makepkg -si # prebuilt
cd scripts/aur/mcpp && makepkg -si # from source (slow: builds mcpp)
cd scripts/aur/mcpp-m && makepkg -si # from source (slow: builds mcpp)
mcpp --version
```

Expand All @@ -99,7 +108,7 @@ PKGBUILDs via `update.sh`, and pushes each package to its AUR git repo over SSH.
### One-time setup you need to do

1. **AUR account** — sign in at <https://aur.archlinux.org> with the account
that will own `mcpp` / `mcpp-bin`.
that will own `mcpp-bin` / `mcpp-m`.

2. **Generate a dedicated SSH key** (no passphrase, it's for CI):

Expand Down Expand Up @@ -131,7 +140,7 @@ prefer to claim them by hand first, push an initial commit manually:
```sh
git clone ssh://aur@aur.archlinux.org/mcpp-bin.git
cp scripts/aur/mcpp-bin/{PKGBUILD,.SRCINFO,mcpp.sh} mcpp-bin/ && cd mcpp-bin
git add -A && git commit -m "initial mcpp-bin" && git push # repeat for mcpp
git add -A && git commit -m "initial mcpp-bin" && git push # repeat for mcpp-m
```

After that, every release publishes both packages with no manual step. You can
Expand Down
2 changes: 1 addition & 1 deletion scripts/aur/mcpp-bin/.SRCINFO
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkgbase = mcpp-bin
arch = aarch64
license = Apache-2.0
depends = git
provides = mcpp
conflicts = mcpp-m
conflicts = mcpp
options = !strip
source = mcpp.sh
Expand Down
6 changes: 4 additions & 2 deletions scripts/aur/mcpp-bin/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ 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')
provides=('mcpp')
conflicts=('mcpp')
# mcpp-m = same tool (mutually exclusive); mcpp = Matsui's C preprocessor
# (extra/mcpp), which also owns /usr/bin/mcpp. No `provides=mcpp` — that name
# is the preprocessor, not us.
conflicts=('mcpp-m' 'mcpp')
# Prebuilt upstream binaries — do not strip/repackage them.
options=('!strip')

Expand Down
5 changes: 3 additions & 2 deletions scripts/aur/mcpp/.SRCINFO → scripts/aur/mcpp-m/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pkgbase = mcpp
pkgbase = mcpp-m
pkgdesc = Modern C++ build & package management tool (built from source)
pkgver = 0.0.65
pkgrel = 1
Expand All @@ -10,10 +10,11 @@ pkgbase = mcpp
makedepends = git
depends = git
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.sh
sha256sums = 07f8233d3f18565c52607816a82c9facda3a7ed11c67d3772e42bd84cb54476a
sha256sums = SKIP

pkgname = mcpp
pkgname = mcpp-m
12 changes: 9 additions & 3 deletions scripts/aur/mcpp/PKGBUILD → scripts/aur/mcpp-m/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Maintainer: mcpp-community <x.d2learn.org@gmail.com>
#
# mcpp built from source, bootstrapped with the prebuilt `mcpp-bin`.
# mcpp-m — mcpp built from source, bootstrapped with the prebuilt `mcpp-bin`.
# mcpp is self-hosting: the mcpp-bin compiler builds this release's own
# source (the same `mcpp build --target <arch>-linux-musl` path release.yml
# ships). For the prebuilt-only package, install `mcpp-bin` instead.
#
# NB: the AUR/official name `mcpp` is taken by Matsui's C preprocessor
# (extra/mcpp), so this package is `mcpp-m`. It still installs the `mcpp`
# command at /usr/bin/mcpp, hence the conflict with that preprocessor.
# See scripts/aur/README.md.

pkgname=mcpp
pkgname=mcpp-m
pkgver=0.0.65
pkgrel=1
pkgdesc="Modern C++ build & package management tool (built from source)"
Expand All @@ -18,7 +22,9 @@ 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')
conflicts=('mcpp-bin')
# mcpp-bin = same tool (mutually exclusive); mcpp = the C preprocessor that
# also owns /usr/bin/mcpp.
conflicts=('mcpp-bin' 'mcpp')
# We strip the built ELF ourselves; don't let makepkg re-strip the vendored
# xlings binary (a prebuilt third-party artifact).
options=('!strip')
Expand Down
File renamed without changes.
25 changes: 13 additions & 12 deletions scripts/aur/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# scripts/aur/update.sh — bump BOTH AUR packages to a release version.
#
# mcpp-bin/ prebuilt release binaries (per-arch tarball checksums)
# mcpp/ built from source via mcpp-bin (source-archive checksum)
# mcpp-m/ built from source via mcpp-bin (source-archive checksum)
#
# Pulls checksums straight from the GitHub release / archive, rewrites each
# PKGBUILD's pkgver + sums, resets pkgrel to 1, regenerates both .SRCINFO
Expand Down Expand Up @@ -42,13 +42,13 @@ done
x86=${SUMS[linux-x86_64]}
arm=${SUMS[linux-aarch64]}

# --- source-archive checksum (mcpp) ----------------------------------------
# --- source-archive checksum (mcpp-m) ----------------------------------------
echo ":: hashing source archive ${archive_url}"
src=$(curl -fsSL --connect-timeout 30 "$archive_url" | sha256sum | awk '{print $1}')
[[ -n "$src" ]] || { echo "error: cannot hash source archive" >&2; exit 1; }

# --- keep the wrapper in sync ----------------------------------------------
cp -f mcpp-bin/mcpp.sh mcpp/mcpp.sh 2>/dev/null || true
cp -f mcpp-bin/mcpp.sh mcpp-m/mcpp.sh 2>/dev/null || true

# --- rewrite mcpp-bin/PKGBUILD ---------------------------------------------
sed -i -E \
Expand All @@ -58,12 +58,12 @@ sed -i -E \
-e "s/^sha256sums_aarch64=\('[^']*'\)/sha256sums_aarch64=('${arm}')/" \
mcpp-bin/PKGBUILD

# --- rewrite mcpp/PKGBUILD -------------------------------------------------
# --- rewrite mcpp-m/PKGBUILD ---------------------------------------------
sed -i -E \
-e "s/^pkgver=.*/pkgver=${VER}/" \
-e "s/^pkgrel=.*/pkgrel=1/" \
-e "s/^sha256sums=\('[^']*'\)/sha256sums=('${src}')/" \
mcpp/PKGBUILD
mcpp-m/PKGBUILD

# --- regenerate .SRCINFO files ---------------------------------------------
# Prefer makepkg's own generator on an Arch host; fall back to templates so
Expand All @@ -87,7 +87,7 @@ pkgbase = mcpp-bin
arch = aarch64
license = Apache-2.0
depends = git
provides = mcpp
conflicts = mcpp-m
conflicts = mcpp
options = !strip
source = mcpp.sh
Expand All @@ -100,9 +100,9 @@ pkgbase = mcpp-bin
pkgname = mcpp-bin
EOF
;;
mcpp)
cat > mcpp/.SRCINFO <<EOF
pkgbase = mcpp
mcpp-m)
cat > mcpp-m/.SRCINFO <<EOF
pkgbase = mcpp-m
pkgdesc = Modern C++ build & package management tool (built from source)
pkgver = ${VER}
pkgrel = 1
Expand All @@ -114,22 +114,23 @@ pkgbase = mcpp
makedepends = git
depends = git
conflicts = mcpp-bin
conflicts = mcpp
options = !strip
source = mcpp-${VER}.tar.gz::${archive_url}
source = mcpp.sh
sha256sums = ${src}
sha256sums = SKIP

pkgname = mcpp
pkgname = mcpp-m
EOF
;;
esac
}
_srcinfo mcpp-bin
_srcinfo mcpp
_srcinfo mcpp-m

echo ":: updated to v${VER}"
echo " mcpp-bin x86_64 ${x86}"
echo " mcpp-bin aarch64 ${arm}"
echo " mcpp source ${src}"
echo " mcpp-m source ${src}"
echo ":: review, then publish each package (see scripts/aur/README.md)"
Loading