[pacman-dev] [PATCH] doc: makepkg: Add note about dependencies and split packages

Olivier Brunel jjk at jjacky.com
Sun Jun 29 07:52:32 EDT 2014

Specifically, the fact that `makepkg -s` will only use global values,
so any override in "depends" or "optdepends" inside a split package's
packaging function will not be used, and therefore should probably be
included in "makedepends" (Else build could fail e.g. in a clean chroot)

Signed-off-by: Olivier Brunel <jjk at jjacky.com>
So I'm assuming this isn't really a bug, but a known limitation of makepkg.

Once I figured out what was happening and why, I looked into it and couldn't
find any documentation about said limitation (unless I missed something
obvious?), but looking at some official PKGBUILDs it seems to be known, although
sometimes it's a bit "tricky" to figure out.

E.g. if you look at php, you won't find pcre nor libxml2 in makedepends, even
though they're required for building. One could assume makepkg will install them
due to their presence in depends inside package_XXX() functions, while they
actually get installed because apache (which depends on pcre) and libxslt (which
depends on libxml2) are in makedepends.
Others, e.g. unixodbc or sqlite, are listed both in makedepends and as depends
in some package_XXX() functions.

Looking into this, I also found this old blog post[1] of Allan's, introducing
split packages, where he says: "As a general rule, almost every package in the
split packages depends array should probably be present in the global
makedepends array."

No mention of "why"/makepkg's limitation, though. I'm assuming it was/is rather
obvious to you guys, but wasn't to me, and I couldn't find a similar
recommendation in the doc, hence the patch.

[1] http://allanmcrae.com/2009/07/new-pkgbuild-syntax-options-with-pacman-33/

 doc/PKGBUILD.5.txt | 8 ++++++++
 doc/makepkg.8.txt  | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index 17e8af2..1fc19f5 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -372,6 +372,14 @@ each split package's packaging function:
 `depends`, `optdepends`, `provides`, `conflicts`, `replaces`, `backup`,
 `options`, `install` and `changelog`.
+Note that when `makepkg` installs dependencies (via its `--syncdeps` option)
+only global values are used, i.e. any override done in a split package's
+packaging function will not be used.
+Therefore, any dependency featured as `depends` or `optdepends` in such a
+function should probably be listed under the global `makedepends` as well, to
+ensure it will be installed in such cases.
 An optional global directive is available when building a split package:
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 0277f54..01039a9 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -132,6 +132,8 @@ Options
 	Install missing dependencies using pacman. When build-time or run-time
 	dependencies are not found, pacman will try to resolve them. If
 	successful, the missing packages will be downloaded and installed.
+	Note that only global values from the `PKGBUILD` are used, see
+	linkman:PKGBUILD[5] for more.
 *-S, \--source*::
 	Do not actually build the package, but build a source-only tarball that

More information about the pacman-dev mailing list