diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..5cb51c3
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,51 @@
+project('tigersum', 'c', 'd',
+ version: '0.1',
+ meson_version: '>=0.49.2',
+ default_options: [
+ 'buildtype=release',
+ ],
+)
+
+pvt_incl = include_directories('src')
+read_buff_size = (get_option('read_buff_size') / 64) * 64
+if (read_buff_size < 64)
+ read_buff_size = 64
+endif
+
+conf = configuration_data()
+conf.set('PROJECT_NAME', meson.project_name())
+conf.set('DEFAULT_TIGER_VERSION', get_option('default_tiger_version'))
+
+version_arr = meson.project_version().split('.')
+conf.set('TIGERSUM_MAJOR', version_arr[0])
+conf.set('TIGERSUM_MINOR', version_arr[1])
+conf.set('READ_BUFF_SIZE', read_buff_size)
+
+if get_option('reference_tiger')
+ conf.set('BACKEND_NAME', 'tiger')
+ conf.set('BACKEND_WEBSITE', 'http://www.cs.technion.ac.il/~biham/Reports/Tiger/')
+ conf.set('BACKEND_AUTHOR', 'Ross Anderson and Eli Biham')
+ tiger_src = files('lib/reference_tiger/sboxes.c', 'lib/reference_tiger/tiger.c')
+else
+ conf.set('BACKEND_NAME', 'freetiger')
+ conf.set('BACKEND_WEBSITE', 'http://klondike.es/freetiger/')
+ conf.set('BACKEND_AUTHOR', 'klondike')
+ tiger_src = files('lib/freetiger/C/tiger.c')
+endif
+
+project_config_file = configure_file(
+ input: 'src/' + meson.project_name() + 'Config.d.in',
+ output: meson.project_name() + 'Config.d',
+ configuration: conf
+)
+
+executable(meson.project_name(),
+ 'src/main.d',
+ 'src/sums.d',
+ 'src/tiger.d',
+ project_config_file,
+ tiger_src,
+ install: true,
+ include_directories: pvt_incl,
+ d_import_dirs: [include_directories('.')],
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..e752b29
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('reference_tiger', type: 'boolean', value: false)
+option('default_tiger_version', type: 'combo', description: 'Default version of the Tiger algorithm', choices: ['1', '2'], value: '1')
+option('read_buff_size', type: 'integer', value: 16384, min: 64, description: 'Read buffer size in bytes')
diff --git a/src/main.d b/src/main.d
index edcc4ff..4b54157 100644
--- a/src/main.d
+++ b/src/main.d
@@ -15,14 +15,13 @@
along with this program. If not, see .
*/
+import tigersumConfig;
import std.stdio;
import std.file;
import std.array;
import std.getopt;
import sums;
-mixin(import("tigersumConfig.d"));
-
int main (string[] parArgs) {
if (parArgs.length == 1)
return 0;
diff --git a/src/sums.d b/src/sums.d
index 81f26d1..2a0b84c 100644
--- a/src/sums.d
+++ b/src/sums.d
@@ -15,6 +15,7 @@
along with this program. If not, see .
*/
+import tigersumConfig;
import std.regex;
import std.stdio;
import std.file : isDir;
@@ -24,8 +25,6 @@ import std.exception;
import std.format;
import std.array : appender;
-mixin(import("tigersumConfig.d"));
-
private void writeError (string parFile, string parMessage) {
stderr.writefln("tigersum: %s: %s", parFile, parMessage);
}
diff --git a/src/tiger.d b/src/tiger.d
index 7825640..13806cf 100644
--- a/src/tiger.d
+++ b/src/tiger.d
@@ -15,13 +15,12 @@
along with this program. If not, see .
*/
+import tigersumConfig;
import std.stdio;
import std.string;
import std.array, std.range;
import std.algorithm;
-mixin(import("tigersumConfig.d"));
-
private extern(C) void tiger (char* parMessage, ulong parLength, out ulong[3] parOut, char parPadding);
private extern(C) void tiger_init (out ulong[3] parOut);
private extern(C) void tiger_chunk (char* parMessage, ulong parLength, out ulong[3] parOut);