In a PKGBUILD file its common to refer to a git URL directly, eg:


However, I would like to be able to pass arguments to the git command use to clone the repository.

Failing that is it possible to set environment variable git uses?

Is this possible? if sow how?

Note, the reason I want to do this is so the checkout can bypass pre-compiled libraries for MS-Windows & OSX, which arent needed for Linux builds.


2 Answers 2


The man page for PKGBUILD covers how to use version control sources. While makepkg natively supports git sources, it does not provide a simple means of providing options to git. While it is possible to modify makepkg.conf, as I suggested in this answer, to override the default git behavior or specify a custom dlagent/vcsclient, the man page for PKGBUILD suggests:

For other version control systems, manual cloning of upstream repositories must be done in the prepare() function.

In other words, don't add the git repository to the sources array, but rather do everything in the prepare function.

  • Are there any examples of a prepare() function that clones a repo? (with some sanity, not to barf on existing checkouts for eg).
    – ideasman42
    Jul 8, 2017 at 6:24

There doesn't seem to be any options for this in PKGBUILD (1, 2). To work around this you can either create a fork or branch containing only the files you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.