summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-07-09 22:02:41 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-07-11 15:45:23 +0300
commita0cb8991b2cb61e9c0f3d8075759939cc61d57f0 (patch)
tree07349d877ea962acc800bdad2695417d10c99330
parent6ef6c9d2da661bc315d4e690120db9079bfe0b9b (diff)
Add implementation
-rw-r--r--.gitmodules4
-rw-r--r--README-DEV65
-rw-r--r--libpkgconf/.gitignore19
l---------libpkgconf/AUTHORS1
l---------libpkgconf/COPYING1
-rw-r--r--libpkgconf/INSTALL7
-rw-r--r--libpkgconf/README20
-rw-r--r--libpkgconf/README-DEV35
-rw-r--r--libpkgconf/TODO6
-rw-r--r--libpkgconf/build/.gitignore3
-rw-r--r--libpkgconf/build/bootstrap.build30
-rw-r--r--libpkgconf/build/export.build10
-rw-r--r--libpkgconf/build/root.build16
-rw-r--r--libpkgconf/buildfile10
-rw-r--r--libpkgconf/libpkgconf/.gitignore3
l---------libpkgconf/libpkgconf/argvsplit.c1
l---------libpkgconf/libpkgconf/audit.c1
l---------libpkgconf/libpkgconf/bsdstubs.c1
l---------libpkgconf/libpkgconf/bsdstubs.h1
-rw-r--r--libpkgconf/libpkgconf/buildfile155
l---------libpkgconf/libpkgconf/cache.c1
l---------libpkgconf/libpkgconf/client.c1
-rw-r--r--libpkgconf/libpkgconf/config.h56
l---------libpkgconf/libpkgconf/config.h.cmake.in.orig1
l---------libpkgconf/libpkgconf/dependency.c1
l---------libpkgconf/libpkgconf/fileio.c1
l---------libpkgconf/libpkgconf/fragment.c1
l---------libpkgconf/libpkgconf/iter.h1
l---------libpkgconf/libpkgconf/libpkgconf-api.h1
l---------libpkgconf/libpkgconf/libpkgconf.h1
l---------libpkgconf/libpkgconf/parser.c1
l---------libpkgconf/libpkgconf/path.c1
l---------libpkgconf/libpkgconf/personality.c1
l---------libpkgconf/libpkgconf/pkg.c1
l---------libpkgconf/libpkgconf/queue.c1
l---------libpkgconf/libpkgconf/stdinc.h1
l---------libpkgconf/libpkgconf/tuple.c1
-rw-r--r--libpkgconf/libpkgconf/version.h.in10
l---------libpkgconf/libpkgconf/win-dirent.h1
-rw-r--r--libpkgconf/manifest18
-rw-r--r--libpkgconf/tests/.gitignore3
-rw-r--r--libpkgconf/tests/api/buildfile7
-rw-r--r--libpkgconf/tests/api/driver.c187
-rw-r--r--libpkgconf/tests/api/testscript116
-rw-r--r--libpkgconf/tests/basic/buildfile7
-rw-r--r--libpkgconf/tests/basic/driver.c170
-rw-r--r--libpkgconf/tests/basic/testscript74
-rw-r--r--libpkgconf/tests/build/.gitignore3
-rw-r--r--libpkgconf/tests/build/bootstrap.build9
-rw-r--r--libpkgconf/tests/build/root.build24
-rw-r--r--libpkgconf/tests/buildfile5
-rw-r--r--packages.manifest2
-rw-r--r--repositories.manifest2
m---------upstream0
54 files changed, 1099 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e3a7a2c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "upstream"]
+ path = upstream
+ url = https://git.dereferenced.org/pkgconf/pkgconf.git
+ ignore = untracked
diff --git a/README-DEV b/README-DEV
new file mode 100644
index 0000000..1a713f6
--- /dev/null
+++ b/README-DEV
@@ -0,0 +1,65 @@
+This document describes an approach applied to packaging pkgconf for build2.
+In particular, this understanding will be useful when upgrading to a new
+upstream version.
+
+The upstream package contains the libpkgconf library and the pkgconf program.
+Currently, we only package the library.
+
+We add the upstream package as a git submodule and symlink the required files
+and subdirectories into the build2 package subdirectories. Then, when required,
+we "overlay" the upstream with our own header/source files.
+
+Note that symlinking upstream submodule subdirectories into a build2 package
+subdirectory results in creating intermediate build files (.d, .o, etc) inside
+upstream directory while building the package in source tree. That's why we
+need to make sure that packages do not share upstream source files via
+subdirectory symlinks, not to also share the related intermediate files. If
+several packages need to compile the same upstream source file, then only one
+of them can symlink it via the parent directory while others must symlink it
+directly. We also add the `ignore = untracked` configuration option into
+.gitmodules to make sure that git ignores the intermediate build files under
+upstream/ subdirectory.
+
+Normally, when packaging an autoconf/cmake-based project, we try to deduce the
+source file and compilation/linking option sets analyzing the configure.ac,
+CMakeLists.txt, and .cmake files. In practice, however, that can be uneasy and
+error prone, so you may also need to refer to make/configuration files
+produced by the configure script/cmake or, as a last resort, to see the
+actual compiler and linker command lines in the build log. If that's the case,
+you can configure/build the upstream package on the platform of interest
+running the following commands in the project root directory.
+
+On POSIX and in MinGW shell on Windows:
+
+$ ./autogen.sh
+$ mkdir build
+$ cd build
+$ ../configure >build.log 2>&1
+$ make AM_DEFAULT_VERBOSITY=1 >>build.log 2>&1
+
+Note: 1.6.1 fails to build pkgconf utility with MinGW GCC (see issue #37 for
+details).
+
+With MSVC on Windows:
+
+Run Visual Studio and change the settings:
+
+Tools >
+ Options >
+ Projects and Solutions >
+ Build and Run >
+ MSBuild project build output verbosity: Detailed
+
+> mkdir build
+> cd build
+> cmake .. >build.log 2>&1
+> devenv pkgconf.sln /build >>build.log 2>&1
+
+When the packaging is complete, build all the project packages in source tree
+and make sure that all the preprocessor include directives reference the
+packaged header files, rather than pkgconf headers that are installed into the
+system:
+
+$ cat `find . -type f -name '*.d'` | sort -u >headers
+$ emacs headers # Edit, leaving system headers only.
+$ fgrep -e 'pkgconf' headers
diff --git a/libpkgconf/.gitignore b/libpkgconf/.gitignore
new file mode 100644
index 0000000..cece09c
--- /dev/null
+++ b/libpkgconf/.gitignore
@@ -0,0 +1,19 @@
+# Compiler/linker output.
+#
+*.d
+*.t
+*.i
+*.ii
+*.o
+*.obj
+*.so
+*.dll
+*.a
+*.lib
+*.exp
+*.pdb
+*.ilk
+*.exe
+*.exe.dlls/
+*.exe.manifest
+*.pc
diff --git a/libpkgconf/AUTHORS b/libpkgconf/AUTHORS
new file mode 120000
index 0000000..d5589ab
--- /dev/null
+++ b/libpkgconf/AUTHORS
@@ -0,0 +1 @@
+../upstream/AUTHORS \ No newline at end of file
diff --git a/libpkgconf/COPYING b/libpkgconf/COPYING
new file mode 120000
index 0000000..0ca50eb
--- /dev/null
+++ b/libpkgconf/COPYING
@@ -0,0 +1 @@
+../upstream/COPYING \ No newline at end of file
diff --git a/libpkgconf/INSTALL b/libpkgconf/INSTALL
new file mode 100644
index 0000000..d44b974
--- /dev/null
+++ b/libpkgconf/INSTALL
@@ -0,0 +1,7 @@
+The aim of this package is to make reading the INSTALL file unnecessary. So
+next time try running:
+
+$ bpkg build libpkgconf
+
+But if you don't want to use the package manager, then you can also build this
+package manually using the standard build2 build system.
diff --git a/libpkgconf/README b/libpkgconf/README
new file mode 100644
index 0000000..8c29a43
--- /dev/null
+++ b/libpkgconf/README
@@ -0,0 +1,20 @@
+libpkgconf is a C library which helps to configure compiler and linker flags
+for development frameworks. It provids most of the pkgconf's functionality,
+which itself is similar to pkg-config. For more information see:
+
+https://git.dereferenced.org/pkgconf/pkgconf
+
+This package contains the original libpkgconf library source code overlaid with
+the build2-based build system and packaged for the build2 package manager
+(bpkg).
+
+See the INSTALL file for the prerequisites and installation instructions.
+
+Post questions, bug reports, or any other feedback about the library itself at
+https://git.dereferenced.org/pkgconf/pkgconf/issues. Send build system and
+packaging-related feedback to the packaging@build2.org mailing list (see
+https://lists.build2.org for posting guidelines, etc).
+
+The packaging of libpkgconf for build2 is tracked in a Git repository at:
+
+https://git.build2.org/cgit/packaging/pkgconf/
diff --git a/libpkgconf/README-DEV b/libpkgconf/README-DEV
new file mode 100644
index 0000000..5188ab1
--- /dev/null
+++ b/libpkgconf/README-DEV
@@ -0,0 +1,35 @@
+This document describes how libpkgconf was packaged for build2. In particular,
+this understanding will be useful when upgrading to a new upstream version.
+See ../README-DEV for general notes on pkgconf packaging.
+
+Symlink the required upstream files and directories and provide our own
+implementations for auto-generated headers:
+
+$ ln -s ../upstream/{AUTHORS,COPYING} ./
+
+$ ln -s ../../upstream/libpkgconf/config.h.cmake.in \
+ libpkgconf/config.h.cmake.in.orig
+
+$ cd libpkgconf && ln -s ../../upstream/libpkgconf/*.{c,h} ./
+
+Use libpkgconf/config.h.cmake.in.orig for creating libpkgconf/config.h and
+libpkgconf/version.h.in, defining/undefining macros introduced with
+#cmakedefine.
+
+Re-creating libpkgconf/config.h from scratch every time we upgrade to a new
+upstream version would be a real pain. Instead we can only (un)define the
+newly introduced macros, comparing the already defined and currently used
+macro sets:
+
+$ for m in `cat libpkgconf/config.h.cmake.in.orig | \
+ sed -n 's/.*#\s*cmakedefine\s\{1,\}\([_a-zA-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\1/p' | sort -u`; do
+ if grep -q -e "\b$m\b" `find -L . -name '*.h' -a ! -name config.h -a ! -name version.h -o -name '*.c'`; then
+ echo "$m"
+ fi
+ done >used-macros
+
+$ cat libpkgconf/config.h |
+ sed -n 's/#\s*\(define\|undef\)\s\{1,\}\([_a-zA-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\2/p' |
+ sort -u >defined-macros
+
+$ diff defined-macros used-macros >diff-macros
diff --git a/libpkgconf/TODO b/libpkgconf/TODO
new file mode 100644
index 0000000..cbaedea
--- /dev/null
+++ b/libpkgconf/TODO
@@ -0,0 +1,6 @@
+@@ What is a project email (update the manifest file)? Using
+ packaging@build2.org for now.
+
+@@ Consider redefining PKGCONF_BUFSIZE from the current 65535 bytes to
+ something smaller, given it is used to allocate buffers on the stack
+ (sometimes several of them).
diff --git a/libpkgconf/build/.gitignore b/libpkgconf/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libpkgconf/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libpkgconf/build/bootstrap.build b/libpkgconf/build/bootstrap.build
new file mode 100644
index 0000000..83258e5
--- /dev/null
+++ b/libpkgconf/build/bootstrap.build
@@ -0,0 +1,30 @@
+# file : build/bootstrap.build
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+project = libpkgconf
+
+using version
+using config
+using test
+using install
+using dist
+
+# The versioning scheme (after 0.9.12) assumes that each [major?] release has
+# it's own number (starting with 2). In any case, for the 1.3.90 to 1.4.0
+# release version increment the version in the library file name changed from
+# 2 to 3 (libpkgconf.so.2.0.0 -> libpkgconf.so.3.0.0). This probably means
+# that the first two release version components constitute a major version,
+# and the release number increments each time this version changes. So we just
+# need to watch their Makefile.am for any changes.
+#
+# See also: http://kaniini.dereferenced.org/2015/07/20/pkgconf-0-9-12-and-future.html
+#
+# Note that the upstream project didn't increment the release number (3) for
+# the 1.5 library version despite the ABI-breaking changes (issue #15 is
+# reported).
+#
+if ($version.major == 1 && $version.minor == 6)
+ release_num = 4
+else
+ fail "increment the release number?"
diff --git a/libpkgconf/build/export.build b/libpkgconf/build/export.build
new file mode 100644
index 0000000..dc19f45
--- /dev/null
+++ b/libpkgconf/build/export.build
@@ -0,0 +1,10 @@
+# file : build/export.build
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+$out_root/
+{
+ include libpkgconf/
+}
+
+export $out_root/libpkgconf/$import.target
diff --git a/libpkgconf/build/root.build b/libpkgconf/build/root.build
new file mode 100644
index 0000000..7e73ef0
--- /dev/null
+++ b/libpkgconf/build/root.build
@@ -0,0 +1,16 @@
+# file : build/root.build
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+c.std = 99
+
+using c
+
+h{*}: extension = h
+c{*}: extension = c
+
+if ($c.class == 'msvc')
+{
+ c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+ c.coptions += /wd4251 /wd4275 /wd4800
+}
diff --git a/libpkgconf/buildfile b/libpkgconf/buildfile
new file mode 100644
index 0000000..e34a1a4
--- /dev/null
+++ b/libpkgconf/buildfile
@@ -0,0 +1,10 @@
+# file : buildfile
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+./: {*/ -build/} doc{AUTHORS COPYING INSTALL README} manifest
+
+# Don't install tests or the INSTALL file.
+#
+tests/: install = false
+doc{INSTALL}@./: install = false
diff --git a/libpkgconf/libpkgconf/.gitignore b/libpkgconf/libpkgconf/.gitignore
new file mode 100644
index 0000000..620b4c8
--- /dev/null
+++ b/libpkgconf/libpkgconf/.gitignore
@@ -0,0 +1,3 @@
+# Generated version.h.
+#
+version.h
diff --git a/libpkgconf/libpkgconf/argvsplit.c b/libpkgconf/libpkgconf/argvsplit.c
new file mode 120000
index 0000000..fb0efa4
--- /dev/null
+++ b/libpkgconf/libpkgconf/argvsplit.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/argvsplit.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/audit.c b/libpkgconf/libpkgconf/audit.c
new file mode 120000
index 0000000..88bb679
--- /dev/null
+++ b/libpkgconf/libpkgconf/audit.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/audit.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/bsdstubs.c b/libpkgconf/libpkgconf/bsdstubs.c
new file mode 120000
index 0000000..40fea4e
--- /dev/null
+++ b/libpkgconf/libpkgconf/bsdstubs.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/bsdstubs.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/bsdstubs.h b/libpkgconf/libpkgconf/bsdstubs.h
new file mode 120000
index 0000000..25da14c
--- /dev/null
+++ b/libpkgconf/libpkgconf/bsdstubs.h
@@ -0,0 +1 @@
+../../upstream/libpkgconf/bsdstubs.h \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/buildfile b/libpkgconf/libpkgconf/buildfile
new file mode 100644
index 0000000..5131874
--- /dev/null
+++ b/libpkgconf/libpkgconf/buildfile
@@ -0,0 +1,155 @@
+# file : libpkgconf/buildfile
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+lib{pkgconf}: {h c}{* -version} {h}{version}
+
+tclass = $c.target.class
+
+bsd = ($tclass == 'bsd')
+macos = ($tclass == 'macos')
+windows = ($tclass == 'windows')
+
+msvc = ($c.class == 'msvc')
+
+# The version file is internal (it is only included from the internal
+# config.h) so we don't distribute nor install it (see below).
+#
+h{version}: in{version} $src_root/manifest
+
+# Build options.
+#
+# Note that we have to add "-I$src_root" for the headers auto-generating
+# machinery to work properly.
+#
+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.
+#
+# There is also PERSONALITY_PATH macro added in 1.5.1. It looks like the
+# personality files are invented to fix cross-compilation but are unlikely to
+# have any noticeable distribution yet. Normally these files are located in
+# the personality.d/ subdirectory of the .pc files directory.
+#
+# @@ We should probably allow to configure these macros via configuration
+# variables config.pkgconfig.pkg_default_path and alike.
+#
+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 = ""
+
+ # Note that on Windows PKG_DEFAULT_PATH macros is internally redefined as
+ # "../lib/pkgconfig;../share/pkgconfig" and is used as a fallback. Normally
+ # the default path is relative to the program's (that link the library)
+ # directory and has the following format:
+ #
+ # <dir>/../lib/pkgconfig;<dir>/../share/pkgconfig
+ #
+ # So we keep the macros empty.
+ #
+ def_paths = ""
+ personality_dirs = ""
+}
+
+c.poptions += -DPKG_DEFAULT_PATH=\"$def_dirs\" \
+ -DSYSTEM_INCLUDEDIR=\"$inc_dirs\" \
+ -DSYSTEM_LIBDIR=\"$lib_dirs\" \
+ -DPERSONALITY_PATH=\"$personality_dirs\"
+
+# Disable warnings.
+#
+if $msvc
+ c.coptions += /wd4996 /wd4267
+
+# Note: this should go last as it adds obj target-specific options.
+#
+if! $windows
+{
+ # Upstream package compiles the source files 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 for the source files that require such deviations. This macro
+ # also re-enables definitions of POSIX macros (specifically PATH_MAX) that
+ # are disabled by -std=c9x.
+ #
+ # Note that on FreeBSD and MacOS -D_POSIX_C_SOURCE disables declarations of
+ # strndup(), strlcpy() and alike, that are not POSIX. Not very consistent
+ # given that they are also not C99. Luckily, -std=c9x doesn't disable
+ # PATH_MAX on these OSes, so we just don't define the macro for them.
+ #
+ # @@ It all becomes a bit hairy. Should we just undefine the corresponding
+ # HAVE_* macros in config.h, so the custom function implementations are
+ # picked up? Alternatively, can we stop specifying the C standard and
+ # defining _POSIX_C_SOURCE macro altogether?
+ #
+ if! ($bsd || $macos)
+ c.poptions += -D_POSIX_C_SOURCE=200112L
+
+ obj{client fragment path personality pkg queue tuple}: \
+ c.poptions += -D_GNU_SOURCE
+}
+else
+{
+ cc.poptions += -DWIN32 -D_WINDOWS -D_MBCS
+
+ if $msvc
+ cc.coptions += /GS /fp:precise /Zc:wchar_t /Zc:forScope
+
+ # See libpkgconf-api.h for details.
+ #
+ objs{*}: c.poptions += -DLIBPKGCONF_EXPORT
+ obja{*}: c.poptions += -DPKGCONFIG_IS_STATIC
+
+ c.libs += $regex.apply(advapi32, '(.+)', $msvc ? '\1.lib' : '-l\1')
+}
+
+# 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/libpkgconf/
+install.include = $install.include/pkgconf/
+
+# Internal auto-generated header (see above).
+#
+h{version}: install = false
+
+# Implementation details.
+#
+# The upstream's config.h is generated during the configuration phase. We
+# distribute a custom one with a minimal set of macro definitions required to
+# build the project. Note that the file is internal (is only included from C
+# files) and so is not installed.
+#
+for h: config stdinc win-dirent
+ h{$h}@./: install = false
diff --git a/libpkgconf/libpkgconf/cache.c b/libpkgconf/libpkgconf/cache.c
new file mode 120000
index 0000000..96149ad
--- /dev/null
+++ b/libpkgconf/libpkgconf/cache.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/cache.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/client.c b/libpkgconf/libpkgconf/client.c
new file mode 120000
index 0000000..6421e39
--- /dev/null
+++ b/libpkgconf/libpkgconf/client.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/client.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/config.h b/libpkgconf/libpkgconf/config.h
new file mode 100644
index 0000000..c8d5cd5
--- /dev/null
+++ b/libpkgconf/libpkgconf/config.h
@@ -0,0 +1,56 @@
+/* file : libpkgconf/config.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : ISC; see accompanying COPYING file
+ */
+#ifndef LIBPKGCONF_CONFIG_H
+#define LIBPKGCONF_CONFIG_H
+
+/*
+ * For the semantics of the following macros refer to config.h.cmake.in.orig
+ * and upstream's CMakeList.txt.
+ *
+ * Note that we will explicitly undefine macros that are present in the
+ * libpkgconf source code but should not be defined. While this is not
+ * technically required, it simplifies the change tracking (see README-DEV).
+ * As a bonus we also make sure that they are not get eventually defined by
+ * some system headers.
+ */
+
+/*
+ * Auto-generated. Defines the following configuration macros:
+
+#define PACKAGE_VERSION
+
+ * Keep all the macros listed (in this exact form) for the change tracking
+ * (see README-DEV).
+ */
+#include <libpkgconf/version.h>
+
+/*
+ * strndup() is not present on Windows, for gcc and clang if compile with
+ * -std=C99, except for FreeBSD and MacOS.
+ *
+ * strl*() are only present on FreeBSD and MacOS.
+ */
+#if defined(__FreeBSD__) || defined(__APPLE__)
+# define HAVE_STRNDUP 1
+# define HAVE_STRLCPY 1
+# define HAVE_STRLCAT 1
+#endif
+
+/*
+ * Let's assume cygwin_conv_path() is always available if compile with MSYS
+ * gcc.
+ */
+#if defined(__MSYS__)
+# define HAVE_CYGWIN_CONV_PATH 1
+#endif
+
+/*
+ * We don't consider such an outdated environments.
+ */
+#define HAVE_SYS_STAT_H 1
+
+#define PACKAGE_BUGREPORT "https://git.dereferenced.org/pkgconf/pkgconf/issues"
+
+#endif /* LIBPKGCONF_CONFIG_H */
diff --git a/libpkgconf/libpkgconf/config.h.cmake.in.orig b/libpkgconf/libpkgconf/config.h.cmake.in.orig
new file mode 120000
index 0000000..e991bcb
--- /dev/null
+++ b/libpkgconf/libpkgconf/config.h.cmake.in.orig
@@ -0,0 +1 @@
+../../upstream/libpkgconf/config.h.cmake.in \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/dependency.c b/libpkgconf/libpkgconf/dependency.c
new file mode 120000
index 0000000..12b2e16
--- /dev/null
+++ b/libpkgconf/libpkgconf/dependency.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/dependency.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/fileio.c b/libpkgconf/libpkgconf/fileio.c
new file mode 120000
index 0000000..fdbc8e3
--- /dev/null
+++ b/libpkgconf/libpkgconf/fileio.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/fileio.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/fragment.c b/libpkgconf/libpkgconf/fragment.c
new file mode 120000
index 0000000..ccec352
--- /dev/null
+++ b/libpkgconf/libpkgconf/fragment.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/fragment.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/iter.h b/libpkgconf/libpkgconf/iter.h
new file mode 120000
index 0000000..34e65e0
--- /dev/null
+++ b/libpkgconf/libpkgconf/iter.h
@@ -0,0 +1 @@
+../../upstream/libpkgconf/iter.h \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/libpkgconf-api.h b/libpkgconf/libpkgconf/libpkgconf-api.h
new file mode 120000
index 0000000..037d133
--- /dev/null
+++ b/libpkgconf/libpkgconf/libpkgconf-api.h
@@ -0,0 +1 @@
+../../upstream/libpkgconf/libpkgconf-api.h \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf/libpkgconf.h
new file mode 120000
index 0000000..b885e88
--- /dev/null
+++ b/libpkgconf/libpkgconf/libpkgconf.h
@@ -0,0 +1 @@
+../../upstream/libpkgconf/libpkgconf.h \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/parser.c b/libpkgconf/libpkgconf/parser.c
new file mode 120000
index 0000000..e37a0c5
--- /dev/null
+++ b/libpkgconf/libpkgconf/parser.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/parser.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/path.c b/libpkgconf/libpkgconf/path.c
new file mode 120000
index 0000000..9dd7e6f
--- /dev/null
+++ b/libpkgconf/libpkgconf/path.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/path.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/personality.c b/libpkgconf/libpkgconf/personality.c
new file mode 120000
index 0000000..4d70904
--- /dev/null
+++ b/libpkgconf/libpkgconf/personality.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/personality.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/pkg.c b/libpkgconf/libpkgconf/pkg.c
new file mode 120000
index 0000000..ea9e3fd
--- /dev/null
+++ b/libpkgconf/libpkgconf/pkg.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/pkg.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/queue.c b/libpkgconf/libpkgconf/queue.c
new file mode 120000
index 0000000..f8945af
--- /dev/null
+++ b/libpkgconf/libpkgconf/queue.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/queue.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/stdinc.h b/libpkgconf/libpkgconf/stdinc.h
new file mode 120000
index 0000000..a0d601c
--- /dev/null
+++ b/libpkgconf/libpkgconf/stdinc.h
@@ -0,0 +1 @@
+../../upstream/libpkgconf/stdinc.h \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/tuple.c b/libpkgconf/libpkgconf/tuple.c
new file mode 120000
index 0000000..3ec7f18
--- /dev/null
+++ b/libpkgconf/libpkgconf/tuple.c
@@ -0,0 +1 @@
+../../upstream/libpkgconf/tuple.c \ No newline at end of file
diff --git a/libpkgconf/libpkgconf/version.h.in b/libpkgconf/libpkgconf/version.h.in
new file mode 100644
index 0000000..6b30948
--- /dev/null
+++ b/libpkgconf/libpkgconf/version.h.in
@@ -0,0 +1,10 @@
+/* file : libpkgconf/version.h.in -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : ISC; see accompanying COPYING file
+ */
+
+#ifndef PACKAGE_VERSION /* Note: using the version macro itself. */
+
+#define PACKAGE_VERSION "$libpkgconf.version.project_id$"
+
+#endif /* PACKAGE_VERSION */
diff --git a/libpkgconf/libpkgconf/win-dirent.h b/libpkgconf/libpkgconf/win-dirent.h
new file mode 120000
index 0000000..d001518
--- /dev/null
+++ b/libpkgconf/libpkgconf/win-dirent.h
@@ -0,0 +1 @@
+../../upstream/libpkgconf/win-dirent.h \ No newline at end of file
diff --git a/libpkgconf/manifest b/libpkgconf/manifest
new file mode 100644
index 0000000..7f73729
--- /dev/null
+++ b/libpkgconf/manifest
@@ -0,0 +1,18 @@
+: 1
+name: libpkgconf
+version: 1.6.1-a.0.z
+project: pkgconf
+summary: C library for retriving pkg-config compiler and linker flags
+license: ISC, MIT ; ISC for the most of original files.
+topics: C, build system, build toolchain
+description-file: README
+url: https://git.dereferenced.org/pkgconf/pkgconf
+doc-url: http://pkgconf.readthedocs.io/en/latest/?badge=latest
+src-url: https://git.build2.org/cgit/packaging/pkgconf/pkgconf/tree/libpkgconf/
+package-url: https://git.build2.org/cgit/packaging/pkgconf/
+email: packaging@build2.org ; Report issues at https://git.dereferenced.org/pkgconf/pkgconf/issues.
+package-email: packaging@build2.org ; Mailing list.
+build-email: builds@build2.org
+builds: all
+depends: * build2 >= 0.11.0
+depends: * bpkg >= 0.11.0
diff --git a/libpkgconf/tests/.gitignore b/libpkgconf/tests/.gitignore
new file mode 100644
index 0000000..2e508a9
--- /dev/null
+++ b/libpkgconf/tests/.gitignore
@@ -0,0 +1,3 @@
+driver
+test/
+test-*/
diff --git a/libpkgconf/tests/api/buildfile b/libpkgconf/tests/api/buildfile
new file mode 100644
index 0000000..3b343e7
--- /dev/null
+++ b/libpkgconf/tests/api/buildfile
@@ -0,0 +1,7 @@
+# file : tests/api/buildfile
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+import libs = libpkgconf%lib{pkgconf}
+
+exe{driver}: {h c}{*} $libs testscript
diff --git a/libpkgconf/tests/api/driver.c b/libpkgconf/tests/api/driver.c
new file mode 100644
index 0000000..b5e42f3
--- /dev/null
+++ b/libpkgconf/tests/api/driver.c
@@ -0,0 +1,187 @@
+/* file : tests/api/driver.c
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : ISC; see accompanying COPYING file
+ */
+
+/*
+ * Enable assertions.
+ */
+#ifdef NDEBUG
+# undef NDEBUG
+#endif
+
+#include <libpkgconf/libpkgconf.h>
+
+#include <stdio.h> /* printf(), fprintf(), stderr */
+#include <stddef.h> /* size_t, NULL */
+#include <assert.h>
+#include <string.h> /* strcmp(), strlen() */
+#include <stdbool.h> /* bool, true, false */
+
+static bool
+error_handler (const char* msg, const pkgconf_client_t* c, const void* d)
+{
+ (void) c; /* Unused. */
+ (void) d; /* Unused. */
+
+ /*
+ * Seems it always have a trailing newline char. Probably it still a good
+ * idea to check if it is. Let's see if it ever be missed.
+ *
+ */
+ fprintf (stderr, "%s", msg);
+ return true;
+}
+
+static void
+frags_print_and_free (pkgconf_list_t* list)
+{
+ pkgconf_node_t *node;
+ PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
+ {
+ pkgconf_fragment_t* frag = node->data;
+ printf("%c %s\n", frag->type, frag->data);
+ }
+
+ pkgconf_fragment_free (list);
+}
+
+static void
+tuples_print (pkgconf_list_t *list)
+{
+ pkgconf_node_t *node;
+ PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
+ {
+ pkgconf_tuple_t *tuple = node->data;
+
+ // Skip the automatically added variable.
+ //
+ if (strcmp (tuple->key, "pcfiledir") != 0)
+ printf("%s %s\n", tuple->key, tuple->value);
+ }
+}
+
+/*
+ * Usage: argv[0] (--cflags|--libs|--vars) <path>
+ *
+ * Print package compiler flags, linker flags or variable name/values one per
+ * line. The specified package file must have .pc extension.
+ *
+ * --cflags
+ * Print compiler flags in the '<name> <value>' format.
+ *
+ * --libs
+ * Print linker flags in the '<name> <value>' format.
+ *
+ * --vars
+ * Print variables in the '<name> <value>' format.
+ */
+int
+main (int argc, const char* argv[])
+{
+ enum
+ {
+ dump_none,
+ dump_cflags,
+ dump_libs,
+ dump_vars
+ } mode = dump_none;
+
+ int i = 1;
+ for (; i < argc; ++i)
+ {
+ const char* o = argv[i];
+
+ if (strcmp (o, "--cflags") == 0)
+ {
+ assert (mode == dump_none);
+ mode = dump_cflags;
+ }
+ else if (strcmp (o, "--libs") == 0)
+ {
+ assert (mode == dump_none);
+ mode = dump_libs;
+ }
+ else if (strcmp (o, "--vars") == 0)
+ {
+ assert (mode == dump_none);
+ mode = dump_vars;
+ }
+ else
+ break;
+ }
+
+ assert (mode != dump_none);
+
+ assert (i + 1 == argc);
+ const char* path = argv[i];
+
+ // Make sure the file has .pc extension.
+ //
+ size_t n = strlen (path);
+ assert (n > 3 && strcmp (path + n - 3, ".pc") == 0);
+
+ pkgconf_client_t* c =
+ pkgconf_client_new (error_handler,
+ NULL /* error_handler_data */,
+ pkgconf_cross_personality_default ());
+
+ assert (c != NULL);
+
+ int r = 1;
+ int max_depth = 2000;
+
+ pkgconf_client_set_flags (c, 0);
+ pkgconf_pkg_t* p = pkgconf_pkg_find (c, path);
+
+ if (p != NULL)
+ {
+ int e = PKGCONF_PKG_ERRF_OK;
+
+ switch (mode)
+ {
+ case dump_cflags:
+ {
+ pkgconf_client_set_flags (c, PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
+
+ pkgconf_list_t list = PKGCONF_LIST_INITIALIZER;
+ e = pkgconf_pkg_cflags (c, p, &list, max_depth);
+
+ if (e == PKGCONF_PKG_ERRF_OK)
+ frags_print_and_free (&list);
+
+ pkgconf_client_set_flags (c, 0); /* Restore. */
+ break;
+ }
+ case dump_libs:
+ {
+ pkgconf_list_t list = PKGCONF_LIST_INITIALIZER;
+ e = pkgconf_pkg_libs (c, p, &list, max_depth);
+
+ if (e == PKGCONF_PKG_ERRF_OK)
+ frags_print_and_free (&list);
+
+ break;
+ }
+ case dump_vars:
+ {
+ tuples_print (&p->vars);
+ break;
+ }
+ default:
+ {
+ assert (false);
+ }
+ }
+
+ if (e == PKGCONF_PKG_ERRF_OK)
+ r = 0;
+
+ pkgconf_pkg_unref (c, p);
+ }
+ else
+ fprintf (stderr, "package file '%s' not found or invalid\n", path);
+
+ pkgconf_client_free (c);
+ return r;
+}
diff --git a/libpkgconf/tests/api/testscript b/libpkgconf/tests/api/testscript
new file mode 100644
index 0000000..88d8d3e
--- /dev/null
+++ b/libpkgconf/tests/api/testscript
@@ -0,0 +1,116 @@
+# file : tests/api/testscript
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+: double-quoted
+:
+{
+ +cat <<EOI >=libfoo.pc
+ prefix="C:\\Program Files\\Foo"
+ exec_prefix=${prefix}
+ var="A\"B" 'C\'D'
+ Name: libfoo
+ Description: Foo library
+ Version: 1.0
+ Libs: "-LC:\\Program Files\\Foo" "-lC:\\Program Files\\Foo\\foo"
+ Cflags: "-IC:\\Program Files\\Foo"
+ EOI
+
+ f = $~/libfoo.pc
+
+ : cflags
+ :
+ $* --cflags $f >>EOO
+ I C:\Program Files\Foo
+ EOO
+
+ : libs
+ :
+ $* --libs $f >>EOO
+ L C:\Program Files\Foo
+ l C:\Program Files\Foo\foo
+ EOO
+
+ : vars
+ :
+ $* --vars $f >>EOO
+ var A"B 'C\'D'
+ exec_prefix C:\\Program Files\\Foo
+ prefix C:\\Program Files\\Foo
+ EOO
+}
+
+: single-quoted
+{
+ +cat <<EOI >=libfoo.pc
+ prefix='C:\Program Files\Foo'
+ exec_prefix=${prefix}
+ var='A\'B' "C\"D"
+ Name: libfoo
+ Description: Foo library
+ Version: 1.0
+ Libs: '-LC:\Program Files\Foo' '-lC:\Program Files\Foo\foo'
+ Cflags: '-IC:\Program Files\Foo'
+ EOI
+
+ f = $~/libfoo.pc
+
+ : cflags
+ :
+ $* --cflags $f >>EOO
+ I C:\Program Files\Foo
+ EOO
+
+ : libs
+ :
+ $* --libs $f >>EOO
+ L C:\Program Files\Foo
+ l C:\Program Files\Foo\foo
+ EOO
+
+ : vars
+ :
+ $* --vars $f >>EOO
+ var A'B "C\"D"
+ exec_prefix C:\Program Files\Foo
+ prefix C:\Program Files\Foo
+ EOO
+}
+
+: unquoted
+:
+{
+ +cat <<EOI >=libfoo.pc
+ prefix=C:\\Program\ \ \ Files\\Foo
+ exec_prefix=${prefix}
+ var=X A\'B' "C\"D"
+ Name: libfoo
+ Description: Foo library
+ Version: 1.0
+ Libs: -LC:\\Program\ \ \ Files\\Foo -lC:\\Program\ \ \ Files\\Foo\\foo
+ Cflags: -IC:\\Program\ \ \ Files\\Foo
+ EOI
+
+ f = $~/libfoo.pc
+
+ : cflags
+ :
+ $* --cflags $f >>EOO
+ I C:\Program Files\Foo
+ EOO
+
+ : libs
+ :
+ $* --libs $f >>EOO
+ L C:\Program Files\Foo
+ l C:\Program Files\Foo\foo
+ EOO
+
+ : vars
+ :
+ $* --vars $f >>EOO
+ var X A\'B' "C\"D"
+ exec_prefix C:\\Program\ \ \ Files\\Foo
+ prefix C:\\Program\ \ \ Files\\Foo
+ EOO
+}
diff --git a/libpkgconf/tests/basic/buildfile b/libpkgconf/tests/basic/buildfile
new file mode 100644
index 0000000..5446ccd
--- /dev/null
+++ b/libpkgconf/tests/basic/buildfile
@@ -0,0 +1,7 @@
+# file : tests/basic/buildfile
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+import libs = libpkgconf%lib{pkgconf}
+
+exe{driver}: {h c}{*} $libs testscript
diff --git a/libpkgconf/tests/basic/driver.c b/libpkgconf/tests/basic/driver.c
new file mode 100644
index 0000000..b14e0cc
--- /dev/null
+++ b/libpkgconf/tests/basic/driver.c
@@ -0,0 +1,170 @@
+/* file : tests/basic/driver.c
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : ISC; see accompanying COPYING file
+ */
+
+/*
+ * Enable assertions.
+ */
+#ifdef NDEBUG
+# undef NDEBUG
+#endif
+
+#include <libpkgconf/libpkgconf.h>
+
+#include <stdio.h> /* printf(), fprintf(), stderr */
+#include <stddef.h> /* NULL */
+#include <stdlib.h> /* free() */
+#include <assert.h>
+#include <string.h> /* strcmp() */
+#include <stdbool.h> /* bool, true, false */
+
+static bool
+error_handler (const char* msg, const pkgconf_client_t* c, const void* d)
+{
+ (void) c; /* Unused. */
+ (void) d; /* Unused. */
+
+ /*
+ * Seems it always have a trailing newline char. Probably it still a good
+ * idea to check if it is. Let's see if it ever be missed.
+ *
+ */
+ fprintf (stderr, "%s", msg);
+ return true;
+}
+
+static void
+print_and_free (pkgconf_list_t* list)
+{
+ char* buf = pkgconf_fragment_render (list,
+ true /* escape */,
+ NULL /* options */);
+ printf("%s", buf);
+ free (buf);
+
+ pkgconf_fragment_free (list);
+}
+
+/*
+ * Usage: argv[0] [--cflags] [--libs] (--with-path <dir>)* <name>
+ *
+ * Print package compiler and linker flags. If the package name has '.pc'
+ * extension it is interpreted as a file name. Prints all flags, as pkgconf
+ * utility does when --keep-system-libs and --keep-system-cflags are specified.
+ *
+ * --cflags
+ * Print compiler flags.
+ *
+ * --libs
+ * Print linker flags.
+ *
+ * --with-path <dir>
+ * Search through the directory for pc-files. If at least one --with-path
+ * is specified then the default directories are not searched through.
+ */
+int
+main (int argc, const char* argv[])
+{
+ pkgconf_client_t* c =
+ pkgconf_client_new (error_handler,
+ NULL /* error_handler_data */,
+ pkgconf_cross_personality_default ());
+
+ assert (c != NULL);
+
+ bool cflags = false;
+ bool libs = false;
+ bool default_dirs = true;
+ int client_flags = 0;
+
+ int i = 1;
+ for (; i < argc; ++i)
+ {
+ const char* o = argv[i];
+
+ if (strcmp (o, "--cflags") == 0)
+ cflags = true;
+ else if (strcmp (o, "--libs") == 0)
+ libs = true;
+ else if (strcmp (o, "--static") == 0)
+ client_flags = PKGCONF_PKG_PKGF_SEARCH_PRIVATE |
+ PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS;
+ else if (strcmp (o, "--with-path") == 0)
+ {
+ ++i;
+ assert (i < argc);
+
+ pkgconf_path_add (argv[i], &c->dir_list, /* filter_duplicates */ true);
+ default_dirs = false;
+ }
+ else
+ break;
+ }
+
+ assert (i + 1 == argc);
+ const char* name = argv[i];
+
+ int r = 1;
+ int max_depth = 2000;
+
+ pkgconf_client_set_flags (c, client_flags);
+
+ /*
+ * Bootstrap the package search default paths if not specified explicitly.
+ */
+ if (default_dirs)
+ pkgconf_client_dir_list_build (c, pkgconf_cross_personality_default ());
+
+ pkgconf_pkg_t* p = pkgconf_pkg_find (c, name);
+
+ if (p != NULL)
+ {
+ int e = PKGCONF_PKG_ERRF_OK;
+
+ /*
+ * Print C flags.
+ */
+ if (cflags)
+ {
+ pkgconf_client_set_flags (
+ c,
+ client_flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
+
+ pkgconf_list_t list = PKGCONF_LIST_INITIALIZER;
+ e = pkgconf_pkg_cflags (c, p, &list, max_depth);
+
+ if (e == PKGCONF_PKG_ERRF_OK)
+ print_and_free (&list);
+
+ pkgconf_client_set_flags (c, client_flags); /* Restore. */
+ }
+
+ /*
+ * Print libs.
+ */
+ if (libs && e == PKGCONF_PKG_ERRF_OK)
+ {
+ pkgconf_list_t list = PKGCONF_LIST_INITIALIZER;
+ e = pkgconf_pkg_libs (c, p, &list, max_depth);
+
+ if (e == PKGCONF_PKG_ERRF_OK)
+ print_and_free (&list);
+ }
+
+ if (e == PKGCONF_PKG_ERRF_OK)
+ {
+ r = 0;
+
+ if (cflags || libs)
+ printf ("\n");
+ }
+
+ pkgconf_pkg_unref (c, p);
+ }
+ else
+ fprintf (stderr, "package '%s' not found\n", name);
+
+ pkgconf_client_free (c);
+ return r;
+}
diff --git a/libpkgconf/tests/basic/testscript b/libpkgconf/tests/basic/testscript
new file mode 100644
index 0000000..081647c
--- /dev/null
+++ b/libpkgconf/tests/basic/testscript
@@ -0,0 +1,74 @@
+# file : tests/basic/testscript
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+test.options = --with-path $~
+
++cat <<EOI >=openssl.pc
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib64
+includedir=${prefix}/include
+
+Name: OpenSSL
+Description: Secure Sockets Layer and cryptography libraries and tools
+Version: 1.0.2g
+Requires: libssl libcrypto
+EOI
+
++cat <<EOI >=libssl.pc
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib64
+includedir=${prefix}/include
+
+Name: OpenSSL-libssl
+Description: Secure Sockets Layer and cryptography libraries
+Version: 1.0.2g
+Requires.private: libcrypto
+Libs: -L${libdir} -lssl
+Libs.private: -ldl -lz -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto
+Cflags: -I${includedir} -I/usr/include
+EOI
+
++cat <<EOI >=libcrypto.pc
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib64
+includedir=${prefix}/include
+
+Name: OpenSSL-libcrypto
+Description: OpenSSL cryptography library
+Version: 1.0.2g
+Requires:
+Libs: -L${libdir} -lcrypto
+Libs.private: -ldl -lz
+Cflags: -I${includedir}
+EOI
+
++cat <<EOI >=libfaulty.pc
+Name: faulty
+Description: Faulty library
+Version: 1.0
+Requires: non-existent
+EOI
+
+: cflags
+:
+$* --cflags openssl >'-I/usr/include '
+
+: libs
+:
+$* --libs openssl >'-L/usr/lib64 -lssl -lcrypto '
+
+: libs-static
+:
+$* --libs --static openssl >'-L/usr/lib64 -lssl -ldl -lz -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -L/usr/lib64 -ldl -lz -lcrypto -ldl -lz '
+
+: non-existent
+:
+$* non-existent 2>"package 'non-existent' not found" == 1
+
+: faulty
+:
+$* --cflags libfaulty 2>- == 1
diff --git a/libpkgconf/tests/build/.gitignore b/libpkgconf/tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libpkgconf/tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libpkgconf/tests/build/bootstrap.build b/libpkgconf/tests/build/bootstrap.build
new file mode 100644
index 0000000..a14e33e
--- /dev/null
+++ b/libpkgconf/tests/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : tests/build/bootstrap.build
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/libpkgconf/tests/build/root.build b/libpkgconf/tests/build/root.build
new file mode 100644
index 0000000..fa336d1
--- /dev/null
+++ b/libpkgconf/tests/build/root.build
@@ -0,0 +1,24 @@
+# file : tests/build/root.build
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+c.std = 99
+
+using c
+
+h{*}: extension = h
+c{*}: extension = c
+
+if ($c.class == 'msvc')
+{
+ c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+ c.coptions += /wd4251 /wd4275 /wd4800
+}
+
+# Every exe{} in this subproject is by default a test.
+#
+exe{*}: test = true
+
+# Specify the test target for cross-testing.
+#
+test.target = $c.target
diff --git a/libpkgconf/tests/buildfile b/libpkgconf/tests/buildfile
new file mode 100644
index 0000000..d48342d
--- /dev/null
+++ b/libpkgconf/tests/buildfile
@@ -0,0 +1,5 @@
+# file : tests/buildfile
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : ISC; see accompanying COPYING file
+
+./: {*/ -build/}
diff --git a/packages.manifest b/packages.manifest
new file mode 100644
index 0000000..1b9f506
--- /dev/null
+++ b/packages.manifest
@@ -0,0 +1,2 @@
+: 1
+location: libpkgconf/
diff --git a/repositories.manifest b/repositories.manifest
new file mode 100644
index 0000000..320463c
--- /dev/null
+++ b/repositories.manifest
@@ -0,0 +1,2 @@
+: 1
+summary: pkgconf build2 package repository
diff --git a/upstream b/upstream
new file mode 160000
+Subproject be6011222b52db362d2a4fdf602b4e4928b5317