-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
polar
committed
Mar 24, 2024
1 parent
bbd9566
commit a401adf
Showing
106 changed files
with
3,539 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /usr/bin/env bash | ||
|
||
export PKG_CONFIG_PATH="/usr/lib/pkgconfig/;/lib/pkgconfig/;/usr/share/pkgconfig/" | ||
|
||
# Delete existing buildfiles | ||
#--------------------------------------------------- | ||
rm -rf build | ||
|
||
|
||
# Call meson | ||
#--------------------------------------------------- | ||
meson setup build -Dprefix="/usr" | ||
|
||
|
||
# Build nix | ||
#--------------------------------------------------- | ||
cd build | ||
ninja |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# aws s3 Dependency File | ||
#============================================================================ | ||
|
||
#-------------------------------------------------- | ||
# FIXME: aws-cpp-sdk should be an optional dependency Unfortunately, importing | ||
# it using the pkg-config option, which could be optional, fails because of | ||
# the cflags in the pkg-config. They contain "-fno-exceptions -std=c++11", | ||
# both of which break existing Nix code. | ||
#-------------------------------------------------- | ||
|
||
# Look for aws-cpp-sdk | ||
#-------------------------------------------------- | ||
aws_sdk_cpp_core_dep = declare_dependency( | ||
dependencies : cpp.find_library('aws-cpp-sdk-core', | ||
dirs : get_option('aws_sdk_cpp_lib_dir')), | ||
include_directories : include_directories( | ||
get_option('aws_sdk_cpp_include_dir'))) | ||
|
||
aws_sdk_cpp_s3_dep = declare_dependency( | ||
dependencies : cpp.find_library('aws-cpp-sdk-s3', | ||
dirs : get_option('aws_sdk_cpp_lib_dir')), | ||
include_directories : include_directories( | ||
get_option('aws_sdk_cpp_include_dir'))) | ||
|
||
aws_sdk_cpp_transfer_dep = declare_dependency( | ||
dependencies : cpp.find_library('aws-cpp-sdk-transfer', | ||
dirs : get_option('aws_sdk_cpp_lib_dir')), | ||
include_directories : include_directories( | ||
get_option('aws_sdk_cpp_include_dir'))) | ||
|
||
|
||
aws_sdk_cpp_dep = [ | ||
aws_sdk_cpp_core_dep, | ||
aws_sdk_cpp_s3_dep, | ||
aws_sdk_cpp_transfer_dep, | ||
] | ||
|
||
# check if dependencies are found | ||
#-------------------------------------------------- | ||
have_aws_sdk_cpp = true | ||
foreach dep : aws_sdk_cpp_dep | ||
if not dep.found() | ||
have_aws_sdk_cpp = false | ||
endif | ||
endforeach | ||
|
||
|
||
# set config variable(s) | ||
#-------------------------------------------------- | ||
config_h.set( | ||
'ENABLE_S3', | ||
have_aws_sdk_cpp.to_int(), | ||
description : 'Whether to enable S3 support via aws-sdk-cpp.') | ||
|
||
if have_aws_sdk_cpp | ||
check_s3client = cpp.check_header( | ||
'aws/s3/S3Client.h', | ||
dependencies: aws_sdk_cpp_dep) | ||
|
||
if check_s3client | ||
config_h.set( | ||
'HAVE_AWS_S3_S3CLIENT_H', 1, | ||
description : 'Whether to enable S3 support via aws-sdk-cpp.') | ||
endif | ||
|
||
aws_version = meson.get_compiler('cpp').get_define( | ||
'AWS_SDK_VERSION_STRING', | ||
prefix : '#include <aws/core/VersionConfig.h>' | ||
).strip('"').split('.') | ||
|
||
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.') | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Boehm-gc Dependency File | ||
#============================================================================ | ||
|
||
|
||
# Look for Boehm garbage collector, an optional dependency | ||
#-------------------------------------------------- | ||
gc_dep = dependency('bdw-gc', required: get_option('gc')) | ||
|
||
|
||
config_h.set( | ||
'HAVE_BOEHMGC', | ||
gc_dep.found().to_int(), | ||
description : 'Whether to use the Boehm garbage collector.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Boost Dependency File | ||
#============================================================================ | ||
|
||
|
||
# Look for boost, a required dependency | ||
#---------------------------------------------------- | ||
boost_mod_list = [ | ||
'system', | ||
'context', | ||
'thread'] | ||
|
||
|
||
boost_dep = dependency( | ||
'boost', | ||
modules: boost_mod_list) | ||
|
||
|
||
# set config variable(s) | ||
#-------------------------------------------------- | ||
config_h.set( | ||
'HAVE_BOOST', 1, | ||
description : 'Define if the Boost library is available.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# LibBrotli Dependency File | ||
#============================================================================ | ||
|
||
|
||
# Look for libbrotli{enc,dec}, a required dependency | ||
#-------------------------------------------------- | ||
libbrotli_dep = declare_dependency( | ||
dependencies: [ | ||
dependency('libbrotlienc'), | ||
dependency('libbrotlidec')]) | ||
|
||
|
||
# set config variable(s) | ||
#-------------------------------------------------- | ||
config_h.set( | ||
'HAVE_BROTLI', 1, | ||
description : 'Define if the brotli library is available.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# cpuid Dependency File | ||
#============================================================================ | ||
|
||
|
||
# Look for cpuid, a required dependency | ||
#-------------------------------------------------- | ||
libcpuid_dep = dependency('libcpuid') | ||
|
||
# set config variable(s) | ||
#-------------------------------------------------- | ||
config_h.set( | ||
'HAVE_LIBCPUID', 1, | ||
description : 'Define if the CPUID is available.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# LibCurl Dependency File | ||
#============================================================================ | ||
|
||
|
||
# Look for libcurl, a required dependency | ||
#-------------------------------------------------- | ||
libcurl_dep = dependency('libcurl') | ||
|
||
|
||
# set config variable(s) | ||
#-------------------------------------------------- | ||
config_h.set( | ||
'HAVE_CURL', 1, | ||
description : 'Define if the curl library is available.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 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 not ( | ||
cpp.has_header( | ||
'editline.h', | ||
dependencies : editline_dep)) | ||
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 libeditline version is too old? >= 1.14 is required.') | ||
endif | ||
|
||
# set config variable(s) | ||
#-------------------------------------------------- | ||
config_h.set( | ||
'HAVE_EDITLINE_H', 1, | ||
description : 'Define to 1 if you have the <editline.h> header file.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# nix check functions | ||
#============================================================================ | ||
|
||
|
||
# check for required functions | ||
#-------------------------------------------------- | ||
required_functions = [ | ||
'lutimes', | ||
'lchown', | ||
'pipe2', | ||
'posix_fallocate', | ||
'setresuid', | ||
'setreuid', | ||
'statvfs', | ||
'strsignal', | ||
'sysconf'] | ||
|
||
foreach f : required_functions | ||
if cpp.has_function(f) | ||
config_h.set( | ||
'HAVE_@0@'.format(f.to_upper()), 1, | ||
description : 'Define to 1 if you have the `@0@` function.'.format(f)) | ||
endif | ||
endforeach | ||
|
||
|
||
# compiler check for pubsetbuff | ||
#-------------------------------------------------- | ||
pubsetbuff_c = ''' | ||
#include <iostream> | ||
using namespace std; | ||
static char buf[1024]; | ||
void func() { | ||
cerr.rdbuf()->pubsetbuf(buf, sizeof(buf)); | ||
}''' | ||
|
||
check_pubsetbuff = meson.get_compiler('cpp').compiles(pubsetbuff_c, name : 'pubsetbuf') | ||
config_h.set( | ||
'HAVE_PUBSETBUF', check_pubsetbuff.to_int(), | ||
description : 'Define to 1 if you have the `pubsetbuf` function.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# gtest Dependency File | ||
#======================================================================== | ||
|
||
|
||
# check if gtest is already installed | ||
#--------------------------------------------------- | ||
gtest_dep = dependency( | ||
'gtest', | ||
main : true, | ||
required : false) | ||
|
||
gmock_dep = dependency( | ||
'gmock', | ||
main : true, | ||
required : false) | ||
|
||
|
||
# If not, include the submodule | ||
#--------------------------------------------------- | ||
if not gtest_dep.found() | ||
gtest_proj = subproject('gtest') | ||
gtest_dep = gtest_proj.get_variable('gtest_main_dep') | ||
gmock_dep = gtest_proj.get_variable('gmock_dep') | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# nix check headers | ||
#============================================================================ | ||
|
||
# check for various headers | ||
#-------------------------------------------------- | ||
project_header_deps = [ | ||
'sys/stat.h', | ||
'sys/types.h', | ||
'sys/dir.h', | ||
'sys/ndir.h', | ||
'dirent.h', | ||
'locale.h', | ||
'unistd.h', | ||
'stdint.h', | ||
'stdlib.h', | ||
'strings.h', | ||
'string.h', | ||
'inttypes.h', | ||
'memory.h'] | ||
|
||
foreach f : project_header_deps | ||
if cpp.has_header(f) | ||
config_h.set( | ||
'HAVE_@0@'.format(f.to_upper().underscorify()), 1, | ||
description : 'Define to 1 if you have the `<@0@>` header file..'.format(f)) | ||
endif | ||
endforeach | ||
|
||
|
||
# TODO: this was carried over from the autotools buildsystem, | ||
# but i think it may no longer be needed. | ||
|
||
# compiler check for dirent.h | ||
#-------------------------------------------------- | ||
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 ((config_h.get('HAVE_DIRENT_H') == 1) and (check_struct_dirent)) | ||
config_h.set('HAVE_STRUCT_DIRENT_D_TYPE', 1) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = dependency('lowdown') |
Oops, something went wrong.