From 2e21b218db0e979d56b7b6027854a86ad7ffc96b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 May 2024 08:45:22 +0200 Subject: Add libbutl-pkg-config source subdirectory This is an additional (to libbutl) utility library which contains the source code of libpkg-config configured and tuned for our needs. --- libbutl-pkg-config/buildfile | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 libbutl-pkg-config/buildfile (limited to 'libbutl-pkg-config/buildfile') diff --git a/libbutl-pkg-config/buildfile b/libbutl-pkg-config/buildfile new file mode 100644 index 0000000..27159b3 --- /dev/null +++ b/libbutl-pkg-config/buildfile @@ -0,0 +1,65 @@ +# file : libbutl-pkg-config/buildfile +# license : MIT; see accompanying LICENSE file + +windows = ($c.target.class == 'windows') + +msvc_runtime = ($c.target.system == 'win32-msvc') + +msvc = ($c.class == 'msvc') +clang_msvc = ($c.id.type == 'clang' && $msvc_runtime) + +lib{butl-pkg-config}: libpkg-config/{h c}{*} + +# Build options. +# +c.poptions =+ "-I$src_base" + +obja{*}: c.poptions += -DLIBPKG_CONFIG_STATIC_BUILD +objs{*}: c.poptions += -DLIBPKG_CONFIG_SHARED_BUILD + +# Disable warnings. +# +if $msvc + c.coptions += /wd4996 /wd4267 +elif $clang_msvc + c.coptions += -Wno-deprecated-declarations -Wno-unused-function + +if $windows + c.libs += ($msvc_runtime ? advapi32.lib : -ladvapi32) + +# Export options. +# +lib{butl-pkg-config}: c.export.poptions = "-I$src_base" +liba{butl-pkg-config}: c.export.poptions += -DLIBPKG_CONFIG_STATIC +libs{butl-pkg-config}: c.export.poptions += -DLIBPKG_CONFIG_SHARED + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. See the version module +# for details on the version.* variable values. +# +if $version.pre_release + lib{butl-pkg-config}: bin.lib.version = @"-$version.project_id" +else + lib{butl-pkg-config}: bin.lib.version = @"-$version.major.$version.minor" + +# Install into the libbutl/pkg-config/ subdirectory of, say, /usr/include +# recreate subdirectories (so we end up with +# libbutl/pkg-config/libpkg-config/...>). Arrange via pkg-config to be able to +# include headers as . +# +# The reason we add an extra pkg-config/ subdirectory instead of installing +# directly into libbutl/ is because adding -I for libbutl/ will make all the +# libbutl headers includable without a prefix and thus prone to clashes. +# +h{*}: +{ + install = include/libbutl/pkg-config/ + install.subdirs = true +} + +libpkg-config/ +{ + h{config}@./ h{stdinc}@./: install = false +} + +lib{butl-pkg-config}: c.pkgconfig.include = include/libbutl/pkg-config/ -- cgit v1.1