pkgbuild-mode provides an Emacs interface for editing and building
PKGBUILD files, the build scripts used by the
Arch Linux package manager.
Turning on pkgbuild-mode calls the value of the variable
pkgbuild-mode-hook with no args, if that value is non-nil.
- Automatic recognition of
PKGBUILDfiles - Syntax checking (the buffer is sourced with
bashto detect errors) - Update the
*sumslines (md5sums,sha256sums, …) automatically viamakepkg -g - Generate and update
.SRCINFOfiles - Build binary packages and source tarballs with
makepkg - Increase the
pkgrelrelease tag with a single keystroke - Open the package
urlin your default browser etagssupport: create aTAGSfile for quick navigation betweenPKGBUILDfiles in a toplevel directoryflymakeintegration: warns about source files which are not available inpkgbuild-source-directory-locations- Template insertion for new
PKGBUILDfiles
- Emacs 26.1 or later
- makepkg (for sums generation, building packages and generating
.SRCINFO) /bin/bash
pkgbuild-mode is available from MELPA:
M-x package-install RET pkgbuild-mode RETWith use-package:
(use-package pkgbuild-mode
:mode "/PKGBUILD$")Put this in your init.el file to enable autoloading of pkgbuild-mode
and auto-recognition of PKGBUILD files:
(autoload 'pkgbuild-mode "pkgbuild-mode.el" "PKGBUILD mode." t)
(setq auto-mode-alist (append '(("/PKGBUILD$" . pkgbuild-mode))
auto-mode-alist))| Key | Command | Description |
|---|---|---|
C-c C-b | pkgbuild-makepkg | Build a binary package with makepkg |
C-c C-a | pkgbuild-tar | Build a source tarball (makepkg --source) |
C-c C-m | pkgbuild-update-sums-line | Update the *sums lines |
C-c C-s | pkgbuild-update-srcinfo | Update the .SRCINFO file |
C-c C-r | pkgbuild-increase-release-tag | Increase the pkgrel release tag by 1 |
C-c C-u | pkgbuild-browse-url | Visit the package url |
C-c C-e | pkgbuild-etags | Create a TAGS file |
If pkgbuild-update-sums-on-save is non-nil (the default), the sums lines
are updated automatically whenever the PKGBUILD buffer is saved.
All options are available via the pkgbuild customization group
(M-x customize-group RET pkgbuild RET). The most notable ones:
pkgbuild-initialize- Automatically insert a default
PKGBUILDtemplate when visiting a new, emptyPKGBUILDfile. pkgbuild-template- The template used for new
PKGBUILDfiles. pkgbuild-template-default-license-identifier- The license
identifier used in the template (default:
GPL). pkgbuild-user-full-nameandpkgbuild-user-mail-address- Used for
the
# Maintainer:header in the template. Default touser-full-nameanduser-mail-address. pkgbuild-makepkg-command- The default
makepkgcommand (default: ~makepkg -m -f ~). pkgbuild-read-makepkg-command/pkgbuild-read-tar-command- Prompt for the commands to use instead of using the defaults.
pkgbuild-update-sums-on-save- Update sums lines on save
(default:
t). pkgbuild-source-directory-locations- Colon-separated search path
used by the
flymakechecker to find source files (default:.:src:/var/cache/pacman/src). pkgbuild-sums-command- Shell command used to generate
*sumslines (default:("makepkg" "-g")). pkgbuild-srcinfo-command- Shell command used to generate
.SRCINFO(default:makepkg --printsrcinfo 2>/dev/null > .SRCINFO). pkgbuild-ask-about-save- Whether
pkgbuild-makepkgasks which buffers to save before starting the build (default:t).
Bug reports and pull requests are welcome at https://github.com/juergenhoetzel/pkgbuild-mode.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.