Skip to content

Commit

Permalink
added meson base
Browse files Browse the repository at this point in the history
  • Loading branch information
p01arst0rm committed Jul 9, 2021
1 parent 9cf991f commit 43ebd67
Show file tree
Hide file tree
Showing 55 changed files with 2,260 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dependencies/archive/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# LibArchive Dependency File
#============================================================================


# Look for libarchive, a required dependency
#--------------------------------------------------
libarchive_dep = cpp.find_library('archive')
48 changes: 48 additions & 0 deletions dependencies/aws-sdk-cpp/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# aws s3 dependency file
#============================================================================


# Look for aws-cpp-sdk, an optional dependency
#--------------------------------------------------
if get_option('with_s3')

has_s3client = meson.get_compiler('cpp').check_header('aws/s3/S3Client.h')

aws_version = meson.get_compiler('cpp').get_define(
'AWS_SDK_VERSION_STRING',
prefix : '#include <aws/core/VersionConfig.h>'
).strip('"').split('.')

aws_sdk_cpp_dep = declare_dependency(
dependencies : [
dependency('aws-cpp-sdk-core'),
dependency('aws-cpp-sdk-s3'),
dependency('aws-cpp-sdk-transfer')])

config_h.set(
'ENABLE_S3', 1,
description : 'Whether to enable S3 support via aws-sdk-cpp.')

if has_s3client
config_h.set(
'HAVE_AWS_S3_S3CLIENT_H', 1,
description : 'Whether to enable S3 support via aws-sdk-cpp.')
endif

config_h.set(
'AWS_VERSION_MAJOR', aws_version[0],
description : 'Major version of aws-sdk-cpp.')

config_h.set(
'AWS_VERSION_MINOR', aws_version[1],
description : 'Minor version of aws-sdk-cpp.')
config_h.set(
'AWS_VERSION_PATCH', aws_version[2],
description : 'Patch version of aws-sdk-cpp.')

else
aws_sdk_cpp_dep = dependency('', required: false)
config_h.set(
'ENABLE_S3', 0,
description : 'Whether to enable S3 support via aws-sdk-cpp.')
endif
22 changes: 22 additions & 0 deletions dependencies/bdw-gc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Boehm-gc Dependency File
#============================================================================


## FIXME !! Boehm is supposed to be an optional dependency
## but is currently required for libexpr & libcmd to compile
## correctly.


# Look for Boehm garbage collector, an optional dependency
#--------------------------------------------------
if get_option('with_gc')
gc_dep = dependency('bdw-gc')
else
gc_dep = dependency('', required: false)
endif


config_h.set(
'HAVE_BOEHMGC',
gc_dep.found().to_int(),
description : 'Whether to use the Boehm garbage collector.')
20 changes: 20 additions & 0 deletions dependencies/boost/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Boost Dependency File
#============================================================================


# Look for boost, a required dependency
#----------------------------------------------------
boost_mod_list = [
'system',
'context',
'thread']


boost_dep = dependency(
'boost',
modules: boost_mod_list)


config_h.set(
'HAVE_BOOST', 1,
description : 'Define if the Boost library is available.')
15 changes: 15 additions & 0 deletions dependencies/brotli/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# LibBrotli Dependency File
#============================================================================


# Look for libbrotli{enc,dec}, a required dependency
#--------------------------------------------------
libbrotli_dep = declare_dependency(
dependencies: [
dependency('libbrotlienc'),
dependency('libbrotlidec')])


config_h.set(
'HAVE_BROTLI', 1,
description : 'Define if the brotli library is available.')
12 changes: 12 additions & 0 deletions dependencies/bz2/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# bz2 Dependency File
#============================================================================


# Look for libbz2, a required dependency
#--------------------------------------------------
libbz2_dep = cpp.find_library('bz2')


config_h.set(
'HAVE_BZ2', 1,
description : 'Define if the libbz2 is available.')
12 changes: 12 additions & 0 deletions dependencies/cpuid/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# cpuid dependency file
#============================================================================


# Look for cpuid, a required dependency
#--------------------------------------------------
libcpuid_dep = dependency('libcpuid')


config_h.set(
'HAVE_LIBCPUID', 1,
description : 'Define if the CPUID is available.')
11 changes: 11 additions & 0 deletions dependencies/curl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# LibCurl Dependency File
#============================================================================


# Look for libcurl, a required dependency
#--------------------------------------------------
libcurl_dep = dependency('libcurl')

config_h.set(
'HAVE_CURL', 1,
description : 'Define if the curl library is available.')
7 changes: 7 additions & 0 deletions dependencies/dl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# libdl Dependency File
#============================================================================


# Look for libdl, a required dependency
#--------------------------------------------------
libdl_dep = cpp.find_library('dl')
29 changes: 29 additions & 0 deletions dependencies/editline/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Editline Dependency File
#============================================================================


# Look for editline, a required dependency
#--------------------------------------------------
# NOTE: The the libeditline.pc file was added only in libeditline >= 1.15.2, see
# https://github.com/troglobit/editline/commit/0a8f2ef4203c3a4a4726b9dd1336869cd0da8607,
# but e.g. Ubuntu 16.04 has an older version, so we fall back to searching for
# editline.h when the pkg-config approach fails.

editline_dep = cpp.find_library('editline')

if (cpp.has_header('editline.h'))
config_h.set(
'HAVE_EDITLINE_H', 1,
description : 'Define to 1 if you have the <editline.h> header file.')
else
error('Nix requires editline.h; however the header was not found.')
endif

if not (
cpp.has_function(
'read_history',
prefix : '#include <stdio.h>\n#include "editline.h"',
dependencies : editline_dep))
error('Nix requires libeditline; However, required functions do not work. Maybe ' +\
'it is too old? >= 1.14 is required.')
endif
73 changes: 73 additions & 0 deletions dependencies/functions/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# nix check functions
#============================================================================

if (cpp.has_function('lutimes'))
config_h.set(
'HAVE_LUTIMES', 1,
description : 'Define to 1 if you have the `lutimes` function.')
endif

if (cpp.has_function('lchown'))
config_h.set(
'HAVE_LCHOWN', 1,
description : 'Define to 1 if you have the `lchown` function.')
endif

if (cpp.has_function('pipe2'))
config_h.set(
'HAVE_PIPE2', 1,
description : 'Define to 1 if you have the `pipe2` function.')
endif

if (cpp.has_function('posix_fallocate'))
config_h.set(
'HAVE_POSIX_FALLOCATE', 1,
description : 'Define to 1 if you have the `posix_fallocate` function.')
endif

if (cpp.has_function('setresuid'))
config_h.set(
'HAVE_SETRESUID', 1,
description : 'Define to 1 if you have the `setresuid` function.')
endif

if (cpp.has_function('setreuid'))
config_h.set(
'HAVE_SETREUID', 1,
description : 'Define to 1 if you have the `setreuid` function.')
endif

if (cpp.has_function('statvfs'))
config_h.set(
'HAVE_STATVFS', 1,
description : 'Define to 1 if you have the `statvfs` function.')
endif

if (cpp.has_function('strsignal'))
config_h.set(
'HAVE_STRSIGNAL', 1,
description : 'Define to 1 if you have the `strsignal` function.')
endif

if (cpp.has_function('sysconf'))
config_h.set(
'HAVE_SYSCONF', 1,
description : 'Define to 1 if you have the `sysconf` function.')
endif

pubsetbuff_c = '''
#include <iostream>
using namespace std;
static char buf[1024];
void func() {
cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));
}'''

if meson.get_compiler('cpp').compiles(
pubsetbuff_c,
name : 'pubsetbuf'
)
config_h.set(
'HAVE_PUBSETBUF', 1,
description : 'Define to 1 if you have the `pubsetbuf` function.')
endif
17 changes: 17 additions & 0 deletions dependencies/gtest/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# gtest Dependency File
#========================================================================


# check if gtest is already installed
#---------------------------------------------------
gtest_dep = dependency(
'gtest',
required : false)


# If not, include the submodule
#---------------------------------------------------
if not gtest_dep.found()
gtest_proj = cmake.subproject('gtest')
gtest_dep = gtest_proj.dependency('gtest')
endif
99 changes: 99 additions & 0 deletions dependencies/headers/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# nix check headers
#============================================================================

if (cpp.has_header('sys/stat.h'))
config_h.set(
'HAVE_SYS_STAT_H', 1,
description : 'Define to 1 if you have the <sys/stat.h> header file.')
endif

if (cpp.has_header('sys/types.h'))
config_h.set(
'HAVE_SYS_TYPES_H', 1,
description : 'Define to 1 if you have the <sys/types.h> header file.')
endif

if (cpp.has_header('sys/dir.h'))
config_h.set(
'HAVE_DIR_H', 1,
description : 'Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR`')
endif

if (cpp.has_header('sys/ndir.h'))
config_h.set(
'HAVE_NDIR_H', 1,
description : 'Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR`')
endif

has_dirent_h = cpp.has_header('dirent.h')
if (has_dirent_h)
config_h.set(
'HAVE_DIRENT_H', 1,
description : 'Define to 1 if you have the <dirent.h> header file, and it defines `DIR`')
endif

if (cpp.has_header('locale.h'))
config_h.set(
'HAVE_LOCALE', 1,
description : 'Define to 1 if you have the <locale.h> header file.')
endif

if (cpp.has_header('unistd.h'))
config_h.set(
'HAVE_UNISTD_H', 1,
description: 'Define to 1 if you have the <unistd.h> header file.')
endif

if (cpp.has_header('stdint.h'))
config_h.set(
'HAVE_STDINT_H', 1,
description: 'Define to 1 if you have the <stdint.h> header file.')
endif

if (cpp.has_header('stdlib.h'))
config_h.set(
'HAVE_STDLIB_H', 1,
description: 'Define to 1 if you have the <stdlib.h> header file.')
endif

if (cpp.has_header('strings.h'))
config_h.set(
'HAVE_STRINGS_H', 1,
description: 'Define to 1 if you have the <strings.h> header file.')
endif

if (cpp.has_header('string.h'))
config_h.set(
'HAVE_STRING_H', 1,
description: 'Define to 1 if you have the <strings.h> header file.')
endif

if (cpp.has_header('bzlib.h'))
config_h.set(
'HAVE_BZLIB_H', 1,
description : 'Define to 1 if you have the <bzlib.h> header file.')
endif

if (cpp.has_header('inttypes.h'))
config_h.set(
'HAVE_INTTYPES_H', 1,
description : 'Define to 1 if you have the <inttypes.h> header file.')
endif

if (cpp.has_header('memory.h'))
config_h.set(
'HAVE_MEMORY_H', 1,
description : 'Define to 1 if you have the <memory.h> header file.')
endif

dirent_h_prefix = '''
#include <sys/types.h>
#include <dirent.h>
'''

check_struct_dirent = meson.get_compiler('cpp').has_member(
'struct dirent', 'd_type', prefix: dirent_h_prefix)

if ((has_dirent_h) and (check_struct_dirent))
config_h.set('HAVE_STRUCT_DIRENT_D_TYPE', 1)
endif
11 changes: 11 additions & 0 deletions dependencies/lowdown/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# lowdown Dependency File
#============================================================================


# FIXME !! lowdown is seemingly a required dependency for building, but
# it isn't listed anywhere on documentation that i could find. dependency
# object needs to be added to meson.

# Look for lowdown, a required dependency
#--------------------------------------------------
liblowdown_dep = cpp.find_library('lowdown')
Loading

0 comments on commit 43ebd67

Please sign in to comment.