diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 677b212..8ad16f2 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -9,13 +9,15 @@ jobs: steps: - uses: actions/checkout@v1 - - name: autogen - run: ./autogen.sh - - name: configure - run: ./configure - - name: make - run: make - - name: make check - run: make check - - name: make test - run: make test + - name: install meson + run: | + sudo apt-get install -y python3-pip ninja-build python3-setuptools + sudo python3 -m pip install meson + - name: compile & test + run: | + meson build + cd build + ninja + sudo ninja install + sudo ldconfig + ninja test diff --git a/include/config_liberasurecode.h.in b/include/config_liberasurecode.h.in new file mode 100644 index 0000000..a2d9c5b --- /dev/null +++ b/include/config_liberasurecode.h.in @@ -0,0 +1,144 @@ +/* include/config_liberasurecode.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `calloc' function. */ +#mesondefine HAVE_CALLOC + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_CTYPE_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_ERRNO_H + +/* Define to 1 if you have the `free' function. */ +#mesondefine HAVE_FREE + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_ICONV_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LIMITS_H + +/* Define to 1 if you have the `malloc' function. */ +#mesondefine HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MEMORY_H + +/* Define to 1 if you have the `openlog' function. */ +#mesondefine HAVE_OPENLOG + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_PTHREAD_H + +/* Define to 1 if you have the `realloc' function. */ +#mesondefine HAVE_REALLOC + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SIGNAL_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#mesondefine LT_OBJDIR + +/* Name of package */ +#mesondefine PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#mesondefine PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#mesondefine PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#mesondefine PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#mesondefine PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#mesondefine PACKAGE_URL + +/* Define to the version of this package. */ +#mesondefine PACKAGE_VERSION + +/* The size of `long', as computed by sizeof. */ +#mesondefine SIZEOF_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#mesondefine STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#mesondefine _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#mesondefine _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#mesondefine _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#mesondefine _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#mesondefine __EXTENSIONS__ +#endif + + +/* Version number of package */ +#mesondefine VERSION + +/* Define to 1 if on MINIX. */ +#mesondefine _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#mesondefine _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#mesondefine _POSIX_SOURCE diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..36475b4 --- /dev/null +++ b/meson.build @@ -0,0 +1,94 @@ +project('erasurecode', 'c', default_options : ['buildtype=debugoptimized', 'c_std=c11', 'optimization=2', 'werror=true']) + +ec_inc = [include_directories('include/erasurecode', 'include/isa_l', 'include/rs_vand', 'include/xor_codes')] +# ec_files = [files('get_flags_from_cpuid.c')] +ec_files = [] + +c_compiler = meson.get_compiler('c') + +flags = [['-mmmx','-DINTEL_MMX'], + ['-msse', '-DINTEL_SSE'], + ['-msse2','-DINTEL_SSE2'],['-msse3','-DINTEL_SSE3'],['-mssse3','-DINTEL_SSSE3'],['-msse4.1','-DINTEL_SSE41'], + ['-msse4.2','-DINTEL_SSE42'],['-mavx','-DINTEL_AVX']] + +optim_flags = [] + +foreach f : flags + if c_compiler.has_argument(f[0]) + optim_flags += f + endif +endforeach + +conf_data = configuration_data() +if c_compiler.has_function('calloc') +conf_data.set('HAVE_CALLOC', 1) +endif + +if c_compiler.has_header('ctype.h') + conf_data.set('HAVE_CTYPE_H', '1') +endif + +conf_data.set('HAVE_DLFCN_H', '1') +conf_data.set('HAVE_ERRNO_H', '1') +conf_data.set('HAVE_FREE', '1') +conf_data.set('HAVE_ICONV_H', '1') +conf_data.set('HAVE_INTTYPES_H', '1') +conf_data.set('HAVE_LIMITS_H', '1') +conf_data.set('HAVE_MALLOC', '1') +conf_data.set('HAVE_MEMORY_H', '1') +conf_data.set('HAVE_OPENLOG', '1') +conf_data.set('HAVE_PTHREAD_H', '1') +conf_data.set('HAVE_SIGNAL_H', '1') +conf_data.set('HAVE_STDARG_H', '1') +conf_data.set('HAVE_STDDEF_H', '1') +conf_data.set('HAVE_STDINT_H', '1') +conf_data.set('HAVE_STDIO_H', '1') +conf_data.set('HAVE_REALLOC', '1') +conf_data.set('HAVE_STRINGS_H', '1') +conf_data.set('HAVE_STRING_H', '1') +conf_data.set('HAVE_UNISTD_H', '1') +conf_data.set('HAVE_STDLIB_H', '1') +conf_data.set('HAVE_SYSLOG_H', '1') +conf_data.set('HAVE_SYS_STAT_H', '1') +conf_data.set('HAVE_SYS_TYPES_H', '1') +conf_data.set('STDC_HEADERS', '1') +conf_data.set('_ALL_SOURCE', '1') +conf_data.set('_POSIX_PTHREAD_SEMANTICS', '1') +conf_data.set('_TANDEM_SOURCE', '1') +conf_data.set('__EXTENSIONS__', '1') +conf_data.set_quoted('PACKAGE', 'liberasurecode') +conf_data.set_quoted('PACKAGE_BUGREPORT', 'tusharsg AT gmail DOT com, kmgreen2 AT gmail DOT com') +conf_data.set_quoted('PACKAGE_NAME', 'liberasurecode') +conf_data.set_quoted('PACKAGE_STRING', 'liberasurecode -') +conf_data.set_quoted('PACKAGE_TARNAME', 'liberasurecode') +conf_data.set_quoted('PACKAGE_URL', 'https://github.com/openstack/liberasurecode') +conf_data.set('SIZEOF_LONG', '8') +conf_data.set('_GNU_SOURCE', '1') +conf_data.set_quoted('VERSION', '-') +conf_data.set_quoted('PACKAGE_VERSION', '-') + +inc = configure_file(input : 'include/config_liberasurecode.h.in', + output : 'config_liberasurecode.h', + configuration : conf_data) + +ec_inc += [include_directories('.')] + +c_args = ['-D_GNU_SOURCE=1', '-pedantic'] +c_args += optim_flags + +subdir('src') + +zlib_dep = c_compiler.find_library('z') +m_dep = c_compiler.find_library('m') +dl_dep = c_compiler.find_library('dl') +threads_dep = dependency('threads') +ec_deps = [zlib_dep, m_dep, dl_dep, threads_dep] + +ec_lib = library('erasurecode', ec_files + [inc], include_directories: ec_inc, dependencies: ec_deps, c_args: c_args, install: true, soversion: 1) + +ec_dep = declare_dependency(link_with : ec_lib, dependencies: ec_deps, + include_directories : ec_inc) + +liberasurecode_test = executable('liberasurecode_test', files('test/liberasurecode_test.c'), dependencies: [ec_dep]) + +test('liberasurecode_test', liberasurecode_test) diff --git a/src/backends/isa-l/meson.build b/src/backends/isa-l/meson.build new file mode 100644 index 0000000..cc93eaf --- /dev/null +++ b/src/backends/isa-l/meson.build @@ -0,0 +1,5 @@ +ec_files += [files( +'isa_l_common.c', +'isa_l_rs_cauchy.c', +'isa_l_rs_vand.c', +)] diff --git a/src/backends/jerasure/meson.build b/src/backends/jerasure/meson.build new file mode 100644 index 0000000..0df4ce5 --- /dev/null +++ b/src/backends/jerasure/meson.build @@ -0,0 +1,4 @@ +ec_files += [files( +'jerasure_rs_cauchy.c', +'jerasure_rs_vand.c', +)] \ No newline at end of file diff --git a/src/backends/meson.build b/src/backends/meson.build new file mode 100644 index 0000000..242234c --- /dev/null +++ b/src/backends/meson.build @@ -0,0 +1,10 @@ +subdir('isa-l') + +subdir('jerasure') +subdir('null') +subdir('phazrio') + +subdir('rs_vand') +subdir('shss') + +subdir('xor') diff --git a/src/backends/null/meson.build b/src/backends/null/meson.build new file mode 100644 index 0000000..36f9591 --- /dev/null +++ b/src/backends/null/meson.build @@ -0,0 +1,3 @@ +ec_files += [files( +'null.c', +)] diff --git a/src/backends/phazrio/meson.build b/src/backends/phazrio/meson.build new file mode 100644 index 0000000..51be229 --- /dev/null +++ b/src/backends/phazrio/meson.build @@ -0,0 +1,3 @@ +ec_files += [files( +'libphazr.c', +)] diff --git a/src/backends/rs_vand/meson.build b/src/backends/rs_vand/meson.build new file mode 100644 index 0000000..c9e1a5b --- /dev/null +++ b/src/backends/rs_vand/meson.build @@ -0,0 +1,3 @@ +ec_files += [files( +'liberasurecode_rs_vand.c', +)] \ No newline at end of file diff --git a/src/backends/shss/meson.build b/src/backends/shss/meson.build new file mode 100644 index 0000000..d223bf3 --- /dev/null +++ b/src/backends/shss/meson.build @@ -0,0 +1,3 @@ +ec_files += [files( +'shss.c', +)] diff --git a/src/backends/xor/meson.build b/src/backends/xor/meson.build new file mode 100644 index 0000000..e6d7507 --- /dev/null +++ b/src/backends/xor/meson.build @@ -0,0 +1,3 @@ +ec_files += [files( +'flat_xor_hd.c', +)] diff --git a/src/builtin/meson.build b/src/builtin/meson.build new file mode 100644 index 0000000..179fb12 --- /dev/null +++ b/src/builtin/meson.build @@ -0,0 +1,4 @@ +subdir('null_code') +subdir('rs_vand') +subdir('xor_codes') + diff --git a/src/builtin/null_code/meson.build b/src/builtin/null_code/meson.build new file mode 100644 index 0000000..1fe11f1 --- /dev/null +++ b/src/builtin/null_code/meson.build @@ -0,0 +1,3 @@ +library('nullcode', [files( +'null_code.c', +)], soversion: 1, install: true, c_args: c_args) diff --git a/src/builtin/rs_vand/meson.build b/src/builtin/rs_vand/meson.build new file mode 100644 index 0000000..0854f48 --- /dev/null +++ b/src/builtin/rs_vand/meson.build @@ -0,0 +1,2 @@ +library('erasurecode_rs_vand', files('liberasurecode_rs_vand.c', 'rs_galois.c'), include_directories: ec_inc, c_args: c_args, soversion: 1, install: true) +# library('erasurecode_rs_galois', files('rs_galois.c'), include_directories: ec_inc) \ No newline at end of file diff --git a/src/builtin/xor_codes/meson.build b/src/builtin/xor_codes/meson.build new file mode 100644 index 0000000..d5b0842 --- /dev/null +++ b/src/builtin/xor_codes/meson.build @@ -0,0 +1,9 @@ +ec_files += [files( +'xor_code.c', +'xor_hd_code.c', +)] + +library('Xorcode', files( +'xor_code.c', +'xor_hd_code.c', +), include_directories: ec_inc, c_args: c_args, soversion: 1, install: true) \ No newline at end of file diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..9d1b157 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,12 @@ +message('dump') +# message(ec_files) + +ec_files += [files('erasurecode.c', +'erasurecode_helpers.c', +'erasurecode_postprocessing.c', +'erasurecode_preprocessing.c', +)] + +subdir('backends') +subdir('builtin') +subdir('utils') diff --git a/src/utils/chksum/meson.build b/src/utils/chksum/meson.build new file mode 100644 index 0000000..55da498 --- /dev/null +++ b/src/utils/chksum/meson.build @@ -0,0 +1 @@ +ec_files += [files('alg_sig.c', 'crc32.c', 'md5.c')] \ No newline at end of file diff --git a/src/utils/meson.build b/src/utils/meson.build new file mode 100644 index 0000000..6731b14 --- /dev/null +++ b/src/utils/meson.build @@ -0,0 +1 @@ +subdir('chksum') \ No newline at end of file