From 1118d53aa0838a03a6641f98879a59c64e91e1f7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 22 Dec 2020 00:12:00 -0800 Subject: [PATCH] add meson build files Signed-off-by: Rosen Penev --- common/meson.build | 5 +++++ config.h.meson | 53 ++++++++++++++++++++++++++++++++++++++++++++++ meson.build | 44 ++++++++++++++++++++++++++++++++++++++ meson_options.txt | 4 ++++ src/meson.build | 18 ++++++++++++++++ tools/meson.build | 12 +++++++++++ 6 files changed, 136 insertions(+) create mode 100644 common/meson.build create mode 100644 config.h.meson create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/meson.build create mode 100644 tools/meson.build diff --git a/common/meson.build b/common/meson.build new file mode 100644 index 0000000..ff04893 --- /dev/null +++ b/common/meson.build @@ -0,0 +1,5 @@ +common_files = [ + '../common/socket.c', + '../common/thread.c', + '../common/collection.c', +] diff --git a/config.h.meson b/config.h.meson new file mode 100644 index 0000000..596aa3e --- /dev/null +++ b/config.h.meson @@ -0,0 +1,53 @@ +/* Define if compiled with -fvisibility=hidden */ +#mesondefine HAVE_FVISIBILITY + +/* Define to 1 if you have the `getifaddrs' function. */ +#mesondefine HAVE_GETIFADDRS + +/* Define if you have inotify support (linux only) */ +#mesondefine HAVE_INOTIFY + +/* Define if you have program_invocation_short_name */ +#mesondefine HAVE_PROGRAM_INVOCATION_SHORT_NAME + +/* Define if program_invocation_short_name is declared in errno.h */ +#mesondefine HAVE_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H + +/* Define to 1 if you have the `pselect' function. */ +#mesondefine HAVE_PSELECT + +/* Define to 1 if you have the `pthread_cancel' function. */ +#mesondefine HAVE_PTHREAD_CANCEL + +/* Define to 1 if you have the `realloc' function. */ +#mesondefine HAVE_REALLOC + +/* Define to 1 if you have the `sleep' function. */ +#mesondefine HAVE_SLEEP + +/* Define to 1 if you have the `stpncpy' function. */ +#mesondefine HAVE_STPNCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#mesondefine HAVE_STRCASECMP + +/* Define to 1 if you have the `strdup' function. */ +#mesondefine HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#mesondefine HAVE_STRERROR + +/* 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 home page for this package. */ +#mesondefine PACKAGE_URL + +/* Define to the version of this package. */ +#mesondefine PACKAGE_VERSION diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..f90e534 --- /dev/null +++ b/meson.build @@ -0,0 +1,44 @@ +project('libusbmuxd', 'c', + version : '2.0.3', + default_options : 'c_std=c99') + +cc = meson.get_compiler('c') +cdata = configuration_data() + +cdata.set_quoted('PACKAGE_NAME', meson.project_name()) +cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) +cdata.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version()) +cdata.set_quoted('PACKAGE_URL', 'https://libimobiledevice.org') +cdata.set_quoted('PACKAGE_BUGREPORT', 'https://libimobiledevice.org') + +cdata.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs', prefix: '#include ')) +cdata.set('HAVE_INOTIFY', cc.has_function('inotify_init', prefix: '#include ')) +cdata.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', cc.has_function('program_invocation_short_name', prefix: '#define _GNU_SOURCE\n#include ')) +cdata.set('HAVE_PSELECT', cc.has_function('pselect', prefix: '#define _GNU_SOURCE\n#include ')) +cdata.set('HAVE_REALLOC', cc.has_function('realloc', prefix: '#include ')) +cdata.set('HAVE_SLEEP', cc.has_function('sleep', prefix: '#include ')) +cdata.set('HAVE_STPNCPY', cc.has_function('stpncpy', prefix: '#define _GNU_SOURCE\n#include ')) +cdata.set('HAVE_STRCASECMP', cc.has_function('strcasecmp', prefix: '#include ')) +cdata.set('HAVE_STRDUP', cc.has_function('strdup', prefix: '#define _GNU_SOURCE\n#include ')) +cdata.set('HAVE_STRERROR', cc.has_function('strerror', prefix: '#include ')) + +cdata.set('HAVE_HAVE_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H', cc.has_header_symbol('errno.h', 'program_invocation_short_name')) +cdata.set('HAVE_PTHREAD_CANCEL', cc.has_header_symbol('pthread.h', 'pthread_cancel')) + +configure_file(input : 'config.h.meson', + output : 'config.h', + configuration : cdata) + +libusbmuxd_incdir = include_directories(['include', 'common', '.']) + +add_global_arguments(['-DHAVE_CONFIG_H', '-D_GNU_SOURCE'], language : 'c') + +thread_dep = dependency('threads') + +install_headers(['include/usbmuxd.h', 'include/usbmuxd-proto.h']) + +subdir('common') +subdir('src') +if get_option('tools') + subdir('tools') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..285c475 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,4 @@ +option('tools', type : 'boolean', + value : true, + description : 'Build libusbmuxd utilities', +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..ca7e36a --- /dev/null +++ b/src/meson.build @@ -0,0 +1,18 @@ +pkg = import('pkgconfig') +libplist_dep = dependency('libplist-2.0') +thread_dep = dependency('threads') + +libusbmuxd = library('usbmuxd', + common_files, + 'libusbmuxd.c', + include_directories : libusbmuxd_incdir, + dependencies : [ libplist_dep, thread_dep ], + install : true, +) + +pkg.generate( + libraries : libusbmuxd, + version: meson.project_version(), + name : 'libusbmuxd-2.0', + description : 'A library to communicate with the usbmux daemon', +) diff --git a/tools/meson.build b/tools/meson.build new file mode 100644 index 0000000..aeac953 --- /dev/null +++ b/tools/meson.build @@ -0,0 +1,12 @@ +iproxy = executable('iproxy', + 'iproxy.c', + include_directories : libusbmuxd_incdir, + link_with : libusbmuxd, + dependencies : thread_dep, +) + +inetcat = executable('inetcat', + 'inetcat.c', + include_directories : libusbmuxd_incdir, + link_with : libusbmuxd, +)