From 40fd995060fc9697d9a96607d3420853d970a977 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 19 Jun 2017 20:03:00 -0400 Subject: [PATCH] Experiment to build with Meson (#119) * Initial Meson build definitions. * Install man page and headers. --- libpkgconf/client.c | 2 +- libpkgconf/config.h.meson | 88 +++++++++++++++++++++++++++++++++++++++ libpkgconf/meson.build | 12 ++++++ main.c | 2 +- meson.build | 72 ++++++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 libpkgconf/config.h.meson create mode 100644 libpkgconf/meson.build create mode 100644 meson.build diff --git a/libpkgconf/client.c b/libpkgconf/client.c index 601e350..1203ffe 100644 --- a/libpkgconf/client.c +++ b/libpkgconf/client.c @@ -14,7 +14,7 @@ */ #include - +#include /* * !doc * diff --git a/libpkgconf/config.h.meson b/libpkgconf/config.h.meson new file mode 100644 index 0000000..cf9191d --- /dev/null +++ b/libpkgconf/config.h.meson @@ -0,0 +1,88 @@ +/* libpkgconf/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `cygwin_conv_path' function. */ +#mesondefine HAVE_CYGWIN_CONV_PATH + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRING_H + +/* Define to 1 if you have the `strlcat' function. */ +#mesondefine HAVE_STRLCAT + +/* Define to 1 if you have the `strlcpy' function. */ +#mesondefine HAVE_STRLCPY + +/* Define to 1 if you have the `strndup' function. */ +#mesondefine HAVE_STRNDUP + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#mesondefine LT_OBJDIR + +/* Name of package */ +#mesondefine PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#mesondefine PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#mesondefine PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#mesondefine PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#mesondefine PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#mesondefine PACKAGE_URL + +/* Define to the version of this package. */ +#mesondefine PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#mesondefine STDC_HEADERS + +/* Version number of package */ +#mesondefine VERSION + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#mesondefine _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#mesondefine _LARGE_FILES + +#mesondefine PKG_DEFAULT_PATH +#mesondefine SYSTEM_INCLUDEDIR +#mesondefine SYSTEM_LIBDIR diff --git a/libpkgconf/meson.build b/libpkgconf/meson.build new file mode 100644 index 0000000..64db65a --- /dev/null +++ b/libpkgconf/meson.build @@ -0,0 +1,12 @@ +configure_file(input : 'config.h.meson', + output : 'config.h', + configuration : cdata) + + +install_headers('libpkgconf.h', + 'stdinc.h', + 'iter.h', + 'bsdstubs.h', + 'libpkgconf-api.h', + subdir : 'libpkgconf') + diff --git a/main.c b/main.c index d06b471..4622a02 100644 --- a/main.c +++ b/main.c @@ -15,7 +15,7 @@ */ #include -#include "config.h" +#include "libpkgconf/config.h" #include "getopt_long.h" #ifdef _WIN32 #include /* for _setmode() */ diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..f0965ea --- /dev/null +++ b/meson.build @@ -0,0 +1,72 @@ +project('pkg-conf', 'c', + version : '1.3.7') + +cc = meson.get_compiler('c') + +cdata = configuration_data() +check_headers = [ + ['HAVE_DLFCN_H', 'dlfcn.h'], + ['HAVE_INTTYPES_H', 'inttypes.h'], + ['HAVE_MEMORY_H', 'memory.h'], + ['HAVE_STDINT_H', 'stdint.h'], + ['HAVE_STDLIB_H', 'stdlib.h'], + ['HAVE_STRINGS_H', 'strings.h'], + ['HAVE_STRING_H', 'string.h'], + ['HAVE_SYS_STAT_H', 'sys/stat.h'], + ['HAVE_SYS_TYPES_H', 'sys/types.h'], + ['HAVE_UNISTD_H', 'unistd.h'], +] + +foreach h : check_headers + if cc.has_header(h.get(1)) + cdata.set(h.get(0), 1) + endif +endforeach + +check_functions = [ +# check token ('HAVE_CYGWIN_CONV_PATH',) + ['HAVE_STRLCAT', 'strlcat', '#include'], + ['HAVE_STRLCPY', 'strlcpy', '#include'], + ['HAVE_STRNDUP', 'strndup', '#include'], +] + +foreach f : check_functions + if cc.has_function(f.get(1), prefix : f.get(2)) + cdata.set(f.get(0), 1) + endif +endforeach + +cdata.set_quoted('SYSTEM_LIBDIR', '/fixme') +cdata.set_quoted('SYSTEM_INCLUDEDIR', '/fixme') +cdata.set_quoted('PKG_DEFAULT_PATH', '/fixme') +cdata.set_quoted('PACKAGE_NAME', 'pkgconf') +cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) +cdata.set_quoted('PACKAGE_BUGREPORT', 'fixme@example.com') + + + +subdir('libpkgconf') + +libpkg = shared_library('pkgconf', + 'libpkgconf/argvsplit.c', + 'libpkgconf/audit.c', + 'libpkgconf/bsdstubs.c', + 'libpkgconf/cache.c', + 'libpkgconf/client.c', + 'libpkgconf/dependency.c', + 'libpkgconf/fileio.c', + 'libpkgconf/fragment.c', + 'libpkgconf/path.c', + 'libpkgconf/pkg.c', + 'libpkgconf/queue.c', + 'libpkgconf/tuple.c', + install : true, +) + +pkg_bin = executable('pkgconf', + 'main.c', + 'getopt_long.c', + link_with : libpkg, + install : true) + +install_man('pkgconf.1')