aboutsummaryrefslogtreecommitdiff
path: root/libpkgconf/buildfile
diff options
context:
space:
mode:
Diffstat (limited to 'libpkgconf/buildfile')
-rw-r--r--libpkgconf/buildfile85
1 files changed, 47 insertions, 38 deletions
diff --git a/libpkgconf/buildfile b/libpkgconf/buildfile
index 3d305c9..37268b9 100644
--- a/libpkgconf/buildfile
+++ b/libpkgconf/buildfile
@@ -4,13 +4,6 @@
lib{pkgconf}: {h c}{* -version} {h}{version}
-# See bootstrap.build for details.
-#
-if $version.pre_release
- lib{pkgconf}: bin.lib.version = @"-$version.project_id"
-else
- lib{pkgconf}: bin.lib.version = @"-$release_num"
-
# The version file is an internal one (it is only included from config.h) so we
# don't distribute nor install it (see below).
#
@@ -18,6 +11,16 @@ h{version}: in{version} $src_root/manifest
tclass = $c.target.class
+bsd = ($tclass == 'bsd')
+macos = ($tclass == 'macos')
+windows = ($tclass == 'windows')
+
+msvc = ($c.class == 'msvc')
+
+# Build options.
+#
+c.poptions =+ "-I$out_root" "-I$src_root"
+
# Define the PKG_DEFAULT_PATH, SYSTEM_INCLUDEDIR and SYSTEM_LIBDIR macros.
# The whole idea feels utterly broken (hello cross-compilation) so we will
# just do bare minimum and wait and see.
@@ -30,7 +33,23 @@ tclass = $c.target.class
# @@ We should probably allow to configure these macros via configuration
# variables config.pkgconfig.pkg_default_path and alike.
#
-if ($tclass == "windows")
+if! $windows
+{
+ inc_dirs = "/usr/include"
+ lib_dirs = "/usr/lib"
+
+ if ($install.root != [null])
+ {
+ def_dirs = "$install.resolve($install.pkgconfig)"
+ personality_dirs = "$def_dirs/personality.d"
+ }
+ else
+ {
+ def_dirs = ""
+ personality_dirs = ""
+ }
+}
+else
{
inc_dirs = ""
lib_dirs = ""
@@ -47,22 +66,6 @@ if ($tclass == "windows")
def_paths = ""
personality_dirs = ""
}
-else
-{
- inc_dirs = "/usr/include"
- lib_dirs = "/usr/lib"
-
- if ($install.root != [null])
- {
- def_dirs = "$install.resolve($install.pkgconfig)"
- personality_dirs = "$def_dirs/personality.d"
- }
- else
- {
- def_dirs = ""
- personality_dirs = ""
- }
-}
c.poptions += -DPKG_DEFAULT_PATH=\"$def_dirs\" \
-DSYSTEM_INCLUDEDIR=\"$inc_dirs\" \
@@ -71,27 +74,21 @@ c.poptions += -DPKG_DEFAULT_PATH=\"$def_dirs\" \
# Disable warnings.
#
-if ($c.class == 'msvc')
+if $msvc
c.coptions += /wd4996 /wd4267
-if ($tclass == "windows")
+if $windows
{
# See libpkgconf/libpkgconf-api.h for details.
#
objs{*}: c.poptions += -DLIBPKGCONF_EXPORT
obja{*}: c.poptions += -DPKGCONFIG_IS_STATIC
- if ($c.target.system == "mingw32")
- c.libs += -ladvapi32
- else
- c.libs += advapi32.lib
+ c.libs += $regex.apply(advapi32, \
+ '(.+)', \
+ $msvc ? '\1.lib' : '-l\1')
}
-c.poptions =+ "-I$out_root" "-I$src_root"
-
-lib{pkgconf}: cc.export.poptions = "-I$src_root"
-liba{pkgconf}: cc.export.poptions += -DPKGCONFIG_IS_STATIC
-
# In the original package the source files are compiled with -std=gnu99 option
# to allow some GNU deviations from the ISO C99 standard. We will compile with
# -std=c9x option (is implied by c.std=99 in root.build) and define _GNU_SOURCE
@@ -100,7 +97,7 @@ liba{pkgconf}: cc.export.poptions += -DPKGCONFIG_IS_STATIC
# We will also re-enable definitions of POSIX macros (specifically PATH_MAX)
# that are disabled by -std=c9x.
#
-if ($tclass != "windows")
+if! $windows
{
# On FreeBSD and MacOS -D_POSIX_C_SOURCE disables declarations of strndup(),
# strlcpy() and alike, that are not POSIX. Not very consistent given that
@@ -112,17 +109,29 @@ if ($tclass != "windows")
# picked up? Alternatively, can we stop specifying the C standard and
# defining _POSIX_C_SOURCE macro altogether?
#
- if ($tclass != "bsd" && $tclass != "macos")
+ if! ($bsd || $macos)
c.poptions += -D_POSIX_C_SOURCE=200112L
obj{client fragment path personality pkg queue tuple}: \
c.poptions += -D_GNU_SOURCE
}
+# Export options.
+#
+lib{pkgconf}: cc.export.poptions = "-I$src_root"
+liba{pkgconf}: cc.export.poptions += -DPKGCONFIG_IS_STATIC
+
+# See bootstrap.build for details.
+#
+if $version.pre_release
+ lib{pkgconf}: bin.lib.version = @"-$version.project_id"
+else
+ lib{pkgconf}: bin.lib.version = @"-$release_num"
+
# Install into the pkgconf/libpkgconf/ subdirectory of, say, /usr/include/.
# Also make sure Cflags is properly set in .pc files to pkgconfig/.
#
-{h}{*}: install = include/$project/
+{h}{*}: install = include/libpkgconf/
install.include = $install.include/pkgconf/
# For the original package config.h is generated during the configuration