-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux makepkg Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to makepkg on Linux, covering Arch Linux, CachyOS, and other distributions including building packages from PKGBUILD files, creating custom packages, and package building best practices.
- Understanding makepkg
- makepkg Installation
- Building Packages
- PKGBUILD Files
- Creating PKGBUILDs
- Troubleshooting
makepkg builds packages from PKGBUILD files.
Uses:
- Build AUR packages: Build packages from AUR
- Create packages: Build custom packages
- Test packages: Test before installing
- Package development: Develop new packages
Why it matters:
- AUR packages: Required for AUR
- Custom packages: Create your own
- Package control: Full control over builds
Arch/CachyOS:
# Install base-devel (includes makepkg)
sudo pacman -S base-devel
# Verify
makepkg --versionmakepkg is included in base-devel group.
Basic build:
# Download PKGBUILD
# Or create your own
# Build package
makepkg
# Install after build
makepkg -iCommon options:
# Clean build
makepkg -c
# Skip checksums
makepkg --skipinteg
# Install after build
makepkg -i
# Source only
makepkg -SBasic PKGBUILD:
pkgname=my-package
pkgver=1.0
pkgrel=1
pkgdesc="My package description"
arch=('x86_64')
url="https://example.com"
license=('GPL')
depends=('dependency1' 'dependency2')
source=("https://example.com/$pkgname-$pkgver.tar.gz")
md5sums=('checksum')
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr
make
}
package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir" install
}Create PKGBUILD:
# Create directory
mkdir -p ~/pkgbuilds/my-package
cd ~/pkgbuilds/my-package
# Create PKGBUILD
vim PKGBUILDValidate:
# Check syntax
makepkg --printsrcinfo
# Test build
makepkg -fCheck dependencies:
# Install dependencies
sudo pacman -S base-devel
# Check PKGBUILD
makepkg --printsrcinfoFix permissions:
# Check user in wheel group
groups
# Or build as user (not root)This guide covered makepkg usage, PKGBUILD creation, and package building for Arch Linux, CachyOS, and other distributions.
- Arch Build System - ABS guide
- Package Management - Package management
-
makepkg Documentation:
man makepkg
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.