diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..a44138e --- /dev/null +++ b/meson.build @@ -0,0 +1,164 @@ +project('partition_tools', 'c', 'cpp', + default_options: [ + 'strip=true', + 'c_std=c99', + 'cpp_std=c++17',]) + +lib_includes = include_directories('lib/include') + +# log +subdir('lib/liblog') + +liblog_includes = [lib_includes, include_directories('lib/liblog/include')] + +liblog = static_library('log', + liblog_sources, + cpp_args: [ + '-DLIBLOG_LOG_TAG=1006', + '-DSNET_EVENT_LOG_TAG=1397638484', + ], + include_directories: liblog_includes, +) + +# zlib +subdir('lib/zlib') + +libz_includes = [lib_includes, include_directories('lib/zlib')] + +libz = static_library('z', + libz_sources, + cpp_args: [ + '-O3', + '-DHAVE_HIDDEN', + '-DZLIB_CONST', + ], + include_directories: libz_includes, +) + +# base +subdir('lib/base') + +libbase = static_library('base', + libbase_sources, + include_directories: lib_includes, +) + +# sparse +subdir('lib/libsparse') + +libsparse = static_library('sparse', + libsparse_sources, + include_directories: lib_includes, +) + +# fmtlib +fmtlib = static_library('fmtlib', + 'lib/fmtlib/src/format.cc', + include_directories: 'lib/fmtlib/include', + name_prefix: '', +) + +# lp +subdir('lib/liblp') + +liblp = static_library('lp', + liblp_sources, + cpp_args: [ + '-D_FILE_OFFSET_BITS=64', + ], + include_directories: lib_includes, +) + +# ext4_utils +subdir('lib/ext4_utils') + +libext4_utils = static_library('ext4_utils', + libext4_utils_sources, + cpp_args: [ + '-D_FILE_OFFSET_BITS=64', + ], + include_directories: lib_includes, +) + +# crypto_utils +libcrypto_utils_includes = include_directories( + 'lib/libcrypto_utils/include', + 'lib/boringssl/include', +) + +libcrypto_utils = static_library('crypto_utils', + 'lib/libcrypto_utils/android_pubkey.c', + include_directories: libcrypto_utils_includes, +) + +# protobuf +subdir('lib/protobuf') + +libprotobuf_includes = include_directories( + 'lib/protobuf/src', + 'lib/protobuf/android', +) + +libprotobuf = static_library('protobuf-cpp-full', + libprotobuf_sources, + cpp_args: [ + '-DHAVE_ZLIB=1', + ], + include_directories: libprotobuf_includes, +) + +# jsonpb +libjsonpb_includes = [lib_includes, include_directories('lib/libjsonpb/parse/include')] + +libjsonpb = static_library('jsonpbparse', + 'lib/libjsonpb/parse/jsonpb.cpp', + include_directories: libjsonpb_includes, +) + +# crypto +subdir('lib/boringssl') + +libcrypto_cflags = [ + '-DBORINGSSL_IMPLEMENTATION', + '-fvisibility=hidden', + '-DBORINGSSL_SHARED_LIBRARY', + '-DBORINGSSL_ANDROID_SYSTEM', + '-DOPENSSL_SMALL', + '-D_XOPEN_SOURCE=700', +] + +if host_machine.system() != 'linux' + libcrypto_cflags += '-DOPENSSL_NO_ASM' +endif + +libcrypto = static_library('crypto', + libcrypto_sources, + c_args: libcrypto_cflags, + include_directories: 'lib/boringssl/include', +) + +# partition_tools +subdir('partition_tools') +pt_libs = [libbase, liblp, libsparse, libz, libcrypto, liblog, libext4_utils] + +foreach prog : pt_progs + executable(prog[0], + prog[1], + cpp_args: [ + '-D_FILE_OFFSET_BITS=64', + ], + include_directories: lib_includes, + link_with: pt_libs, + install: true, + ) +endforeach + +executable('lpdump', + lpdump_sources, + cpp_args: [ + '-D_FILE_OFFSET_BITS=64', + ], + include_directories: lib_includes, + link_with: [pt_libs, libjsonpb, libprotobuf,], + install: true, +) |