We need to create a new AUR package (or multiple) from scratch.
Code style:
- Language(s): PKGBUILD is bash; .install (if necessary) is POSIX-sh–compatible functions
- Indent 2 spaces; UTF-8; LF endings; no trailing whitespace
- Strings: single quotes for literals; double quotes when expanding vars
- Functions: prepare(), build(), check(), package(); only define needed ones
- No sudo, networking, or user config in build/package functions
- Use install -Dm755 for binaries; set exact modes explicitly
- Checksums: keep hashes in sync with sources
- Keep .SRCINFO in lockstep with PKGBUILD; don't commit build artifacts
During creation, follow this strict workflow. If a planning or todo tool is available, fill it out in detail with these steps; you might get interrupted and have to pick up where you left off based on that todo/planning tool's output.
- List the contents of your current working directory to see what I've already
done.
- If you see text files, read them.
- If you see directories, list their contents.
- If by its contents, it seems like the repository of the project we're packaging, ignore it for now.
- If there are sub-directories of your current working directory with suffixes like
-binor-git, we're actually going to be creating multiple AUR packages for the same piece of software.-gitpackages clone the primary branch (main, master, trunk, etc.) and build and install the software from that source. We do not specify versions for these packages; updpkgsums determines the version and edits the PKGBUILD.-binpackages download the project-built and project-distributed binary and install that.- Packages without a suffix download the nearest thing to a release archive we can find and build/install that source.
- There are no sub-directories of your current working directory, we're only creating one package. Look to your current working directory to determine whether we're creating a suffix-less package, or one with
-gitor-bin.
- Ask me for the package name (
provides=), description (description=), and license (license=()), and the license path inside the project repo (forinstalling). Then for each of the non-gitpackage types, ask me for its current version and the source URL.- For
-gitpackages, you must prefix the source URL withgit+https://.... Ask me which branch to check out. Include the following function to support versioning.pkgver() { cd "$pkgname" || exit ( set -o pipefail git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" ) } - For
-binpackages, usebin-name-$pkgver:https://...in the source, theninstallbin-name-$pkgverasbin-name. Additionally, we'll need to obtain the license from the original repository. If the source is GitHub, the raw URL ishttps://raw.githubusercontent.com/bmf-san/ggc/refs/tags/{TAG}/LICENSE. If the source is not GitHub, ask me for the raw URL to the tagged LICENSE file.
- For
- For each package we're creating, write a new
PKGBUILDto that directory with the details above. TheMaintainercomment at the top should beAmolith <amolith@secluded.site>. If multiple packages, make sure to includeconflicts=()so one can't get installed alongside the other. Make sure packages with-gitor-binuse the suffix-less package name in the provides field. Useb2sums. - Ask me to find and relay the build system/installation methods recommended by the project. This might be
cargofor Rust projects,gofor Go, etc. - Once I've relayed the project's instructions, adapt those for each of the packages depending on project language and update the PKGBUILDs'
build(),check(),package(), etc. functions.- Rust
-gitand-binare pretty self-explanatory for Rust. For suffix-less packages, download the version crate from cargo's API as a.cratefile and build it usingcargo.
- Go
- To keep all Go modules in the package build environment, use
prepare() { cd "${pkgname}-${pkgver}" export GOPATH="${srcdir}" go mod download -modcacherw } - If the build process bakes in version information, use the following in the build() function.
If the build process does not bake version info in, use this.go build \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \ "$pkgname" main.go # or ./cmd or ...export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
- To keep all Go modules in the package build environment, use
- Rust
- Consider the diagnostics and present all issues to me, whether you think they're relevant or not. Include reasoning why those issues are relevant, or why they're not. We'll work on any genuine issues until they're resolved before proceeding.
- Update checksums in each package directory with
updpkgsums - Install dependencies and build/install the package(s) by giving me a code block of
makepkg -Ccsicommands I can copy/paste. If there are multiple packages, includecdprior tomakepkg. We'll work on any issues that arise during this step until they're resolved.- I must run
makepkgcommands because you're prohibited from interacting with it.
- I must run
- After I build the packages, run
namcapon./package-name-*.pkg.tar.zstto lint them. Again, report all the issues to me and we'll work on them before continuing. - Generate each package's
.SRCINFOby, again, giving me a seriesmakepkg --printsrcinfo > .SRCINFO. If just one package, nocdis necessary. Justmakepkg. - If the PKGBUILDs and .SRCINFOs are the only files you've created during this session, enter each package directory, then
git addandgit committhem. If there are other files you've modified that are tracked by git in those package directory, please show me the diff and ask which you should commit. Create a.gitignorein each package repo that lists everything in the dir we have not committed. Use appropriate globbing. - Clean all artefacts with
git clean -fdx