From 638f1771a8fa8ffc145a5b2572b964f5b557c10d Mon Sep 17 00:00:00 2001 From: Mitja HORVAT Date: Wed, 22 Sep 2021 18:52:34 +0200 Subject: [PATCH] meson: Setup the Meson build infrastructure --- c/cli/meson.build | 2 ++ c/meson.build | 2 ++ c/phogen/meson.build | 18 ++++++++++++++++++ c/phogen/phogen_map/meson.build | 5 +++++ meson.build | 10 ++++++++++ python/meson.build | 7 +++++++ python/passgeny/meson.build | 24 ++++++++++++++++++++++++ python/phogen_map/meson.build | 2 ++ 8 files changed, 70 insertions(+) create mode 100644 c/cli/meson.build create mode 100644 c/meson.build create mode 100644 c/phogen/meson.build create mode 100644 c/phogen/phogen_map/meson.build create mode 100644 meson.build create mode 100644 python/meson.build create mode 100644 python/passgeny/meson.build create mode 100644 python/phogen_map/meson.build diff --git a/c/cli/meson.build b/c/cli/meson.build new file mode 100644 index 0000000..e857722 --- /dev/null +++ b/c/cli/meson.build @@ -0,0 +1,2 @@ +executable('passgeny', 'src/passgeny.c', dependencies: phogen_dep) + diff --git a/c/meson.build b/c/meson.build new file mode 100644 index 0000000..c873d7f --- /dev/null +++ b/c/meson.build @@ -0,0 +1,2 @@ +subdir('phogen') +subdir('cli') diff --git a/c/phogen/meson.build b/c/phogen/meson.build new file mode 100644 index 0000000..393d9fd --- /dev/null +++ b/c/phogen/meson.build @@ -0,0 +1,18 @@ + +# phogen_map is needed for generating phogen_map.h +subdir('phogen_map') + +phogen_map_h = custom_target( + 'phogen_map.h', + input : PHOGEN_WORD_LIST, + output : 'phogen_map.h', + command : [PHOGEN_MAP_EXE, '--input=@INPUT@', '--clang=@OUTPUT@']) + +phogen_inc = include_directories('inc') + +phogen_lib = static_library( + 'phogen', + [phogen_map_h, 'src/phogen.c'], + include_directories : phogen_inc) + +phogen_dep = declare_dependency(link_with : phogen_lib, include_directories : phogen_inc) diff --git a/c/phogen/phogen_map/meson.build b/c/phogen/phogen_map/meson.build new file mode 100644 index 0000000..cfd44c1 --- /dev/null +++ b/c/phogen/phogen_map/meson.build @@ -0,0 +1,5 @@ +libcrypto_dep = dependency('libcrypto') + +PHOGEN_MAP_EXE = executable('phogen_map', 'phogen_map.c', dependencies: libcrypto_dep) + + diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..18daa75 --- /dev/null +++ b/meson.build @@ -0,0 +1,10 @@ +project( + 'passgeny', + 'c', + default_options: ['warning_level=1', 'werror=true'], + version : '0.1') + +PHOGEN_WORD_LIST = files('data/words_alpha.txt.backup') + +subdir('c') +subdir('python') diff --git a/python/meson.build b/python/meson.build new file mode 100644 index 0000000..7ecfad6 --- /dev/null +++ b/python/meson.build @@ -0,0 +1,7 @@ +pymod = import('python') +pyinst = pymod.find_installation('python3') + +PYTHONPATH = meson.current_build_dir() + +subdir('phogen_map') +subdir('passgeny') diff --git a/python/passgeny/meson.build b/python/passgeny/meson.build new file mode 100644 index 0000000..b6153e2 --- /dev/null +++ b/python/passgeny/meson.build @@ -0,0 +1,24 @@ +pysrc = files( + '__init__.py', + 'passgeny.py', + 'bhash.py', + 'phogen.py') + +phogen_map_py = custom_target( + 'phogen_map.py', + input : PHOGEN_WORD_LIST, + output : 'phogen_map.py', + install: true, + install_dir: pyinst.get_install_dir() / meson.project_name(), + build_by_default: true, + command : [PHOGEN_MAP_EXE, '--input=@INPUT@', '--python=@OUTPUT@']) + +custom_target( + 'python_passgeny', + input: pysrc, + output: 'passgeny', + command: ['cp', '@INPUT@', '@OUTDIR@'], + build_by_default: true) + +pyinst.install_sources(pysrc, subdir: meson.project_name()) + diff --git a/python/phogen_map/meson.build b/python/phogen_map/meson.build new file mode 100644 index 0000000..e7fdc4c --- /dev/null +++ b/python/phogen_map/meson.build @@ -0,0 +1,2 @@ + +PHOGEN_MAP_PY = files('phogen_map.py')