Experiment to build with Meson (#119)

* Initial Meson build definitions.

* Install man page and headers.
pull/122/head
Jussi Pakkanen 2017-06-19 20:03:00 -04:00 committed by William Pitcock
parent b77fbbb025
commit 40fd995060
5 changed files with 174 additions and 2 deletions

View File

@ -14,7 +14,7 @@
*/
#include <libpkgconf/libpkgconf.h>
#include <libpkgconf/config.h>
/*
* !doc
*

88
libpkgconf/config.h.meson Normal file
View File

@ -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 <dlfcn.h> header file. */
#mesondefine HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#mesondefine HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#mesondefine HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#mesondefine HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#mesondefine HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#mesondefine HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> 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 <sys/stat.h> header file. */
#mesondefine HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#mesondefine HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> 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

12
libpkgconf/meson.build Normal file
View File

@ -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')

2
main.c
View File

@ -15,7 +15,7 @@
*/
#include <libpkgconf/libpkgconf.h>
#include "config.h"
#include "libpkgconf/config.h"
#include "getopt_long.h"
#ifdef _WIN32
#include <io.h> /* for _setmode() */

72
meson.build Normal file
View File

@ -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<string.h>'],
['HAVE_STRLCPY', 'strlcpy', '#include<string.h>'],
['HAVE_STRNDUP', 'strndup', '#include<string.h>'],
]
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')