PKGBUILD variables in arch

Steve Holmes steve at
Wed Mar 2 16:08:39 EST 2011

Yes, never use your top level home directory to build these packages.
You will lose stuff in a hury; orI should say, you will lose your
place before you know it and not be able to find the files that the
build process created.  I do like Cal suggested.  I have a directory
called ~/abs and under that I have one called aur for packages I have
brought down from AUR and I haven't modified - just built to use or
possibly packages I'm maintaining for the AUR.  I also have another
one for testing such as when I apply patches to a git orca tree or
if/when I might make my own changes to a program. So then under each
of these directories, I have the directory for each package.  Within
the package directory, I 'cd into this directory and then do the
'makepkg' to build the package.

Now to answer your questions, the variables $STARTDIR points to the
top level directory of your package and is really not being used much
anymore.  Instead, we usually will use symbols like $SRCDIR and
$PKGDIR; these symbols are pretty much self describing.  $SRCDIR will
go into a directory called src right under the directory containing
your PKGBUILD file.  the $PKGDIR will be called pkg and also lives in
the same directory as your PKGBUILD.  in the pkg directory, is where
the installation environment for your package will go when it builds.
This is very revealing and can help you verify that your build script
is properly configuring things and placing objects in the right
folders.  I find it fun to verify.  The 'makepkg' step should download
the source tarball to the main package directory but untar the thing
into the src folder underneith.

What I have done on some occasions, is to temperarily insert an 'exit'
statement in the PKGBUILD right after the download or even after the
compile process so I can look around to be sure things aren't going
too far south.  This is especially the case if I am build a brand new
PKGBUILD for something.

Hope this all helps.

On Tue, Mar 01, 2011 at 10:55:40PM -0500, Kyle wrote:
> Your source and built binary package will be put into subdirectories
> under the directory where your PKGBUILD file is. The sources are put
> into ./src and the binary package is in ./pkg. It looks like these
> settings can be overridden in /etc/makepkg.conf. You probably should
> use a directory to store your PKGBUILD files other than your home
> directory. Most of the time, you will want a package build
> directory, and each PKGBUILD file should be in a subdirectory under
> the one you selected for all your package builds. Example: I have my
> package builds in ~/build. Under that is a subdirectory for each
> PKGBUILD I want to build, e.g. ~/build/svox-pico-git/, where I have
> my PKGBUILD file for that package, which I hope to build as soon as
> I figure out why I get very strange errors only when I use makepkg
> to build it. :) Using this clean directory structure for each
> package makes it much easier to find the sources for each package
> and to apply your patches. I've never tried just putting PKGBUILD in
> my home directory and building it there to see what would happen,
> but it can't be easy to sort out if something goes wrong. Hope this
> helps a litttle, as I'm lacking in experience myself.
> ~Kyle
> _______________________________________________
> Speakup mailing list
> Speakup at

More information about the Speakup mailing list