this post was submitted on 16 Jun 2023
12 points (100.0% liked)
Arch Linux
7641 readers
12 users here now
The beloved lightweight distro
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This is something that I still need to learn about. What is a good starting point to learn how to read them?
It's a shell script. Somebody wrote down the shell commands to download, extract, compile from source code. If you can do shell stuff then you're about 1/2 way there. If you've ever manually compiled from source code then you're all the way there pretty much.
It's quite simple since there isn't any other abstraction to learn than what many Linux users already know. Shell commands and compiling stuff.
Probably the one thing that might be foreign is variable and functions of shell scripting.
First, you should be familiar with the basic process of compiling and installing software from source. For C or C++ projects, this can be as simple as
./configure
,make
,make install
for projects that use GNU Autotools, or something likecmake -B build
,cd build
,make
,make install
for CMake projects.I generally split PKGBUILDs into three important parts. There's the metadata at the top then there's the
build
andpackage
functions.build
is where everything up to themake
(or equivalent build-the-thing) command goes andpackage
is where themake install
bits go.There's also the
prepare
andcheck
functions, but those aren't used as often.As for the actual documentation, the Arch Wiki page for PKGBUILD covers most of the metadata stuff and the page for Creating Packages covers most of the
build
andpackage
stuff.