From c0fe36ee95b6b91d71f256798dce21ae85d0627f Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Sun, 27 Sep 2020 00:08:57 +0100 Subject: [PATCH] Add support for FreeBSD Signed-off-by: Jonathan Dieter --- meson.build | 42 +++++++++++++++++++++++--------------- src/lib/index/index_read.c | 4 ++++ src/unzck.c | 3 ++- src/zck.c | 3 ++- src/zck_dl.c | 3 ++- src/zck_gen_zdict.c | 3 ++- test/copy_chunks.c | 3 ++- 7 files changed, 39 insertions(+), 22 deletions(-) diff --git a/meson.build b/meson.build index a705d5a..5101fda 100644 --- a/meson.build +++ b/meson.build @@ -1,16 +1,22 @@ -project('zck', 'c', - version : '1.1.6', - meson_version : '>=0.44.0', - default_options : ['c_std=gnu99']) +project( + 'zck', 'c', + version : '1.1.6', + meson_version : '>=0.44.0', + default_options : ['c_std=gnu99'] +) so_version = '1' common_cflags = [ - '-Wunused-result', + '-Wunused-result', ] cc = meson.get_compiler('c') add_project_arguments(cc.get_supported_arguments(common_cflags), language : 'c') +if build_machine.system() == 'freebsd' + add_project_arguments('-DFREEBSD', language : 'c') +endif + if get_option('with-zstd') == 'disabled' zstd_dep = dependency('', required : false) else @@ -22,7 +28,7 @@ endif curl_dep = dependency('libcurl') -if not cc.links('#include \nstatic error_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage(state); }; void main() {}') +if build_machine.system() == 'freebsd' or not cc.links('#include \nstatic error_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage(state); }; void main() {}') argplib = cc.find_library('argp') else argplib = dependency('', required : false) @@ -46,17 +52,19 @@ if not get_option('coverity') endif pkg_mod = import('pkgconfig') -pkg_mod.generate(libraries : zcklib, - version : meson.project_version(), - name : 'libzck', - filebase : 'zck', - description : 'A library for generating easy-to-delta files.') +pkg_mod.generate( + libraries : zcklib, + version : meson.project_version(), + name : 'libzck', + filebase : 'zck', + description : 'A library for generating easy-to-delta files.' +) install_man([ - 'doc/unzck.1', - 'doc/zck.1', - 'doc/zck_delta_size.1', - 'doc/zck_gen_zdict.1', - 'doc/zck_read_header.1', - 'doc/zckdl.1', + 'doc/unzck.1', + 'doc/zck.1', + 'doc/zck_delta_size.1', + 'doc/zck_gen_zdict.1', + 'doc/zck_read_header.1', + 'doc/zckdl.1', ]) diff --git a/src/lib/index/index_read.c b/src/lib/index/index_read.c index 6d8e49f..c6ee98b 100644 --- a/src/lib/index/index_read.c +++ b/src/lib/index/index_read.c @@ -28,7 +28,11 @@ #include #include #include +#ifdef FREEBSD +#include +#else #include +#endif #include #include "zck_private.h" diff --git a/src/unzck.c b/src/unzck.c index 01eff6f..7cfe9e1 100644 --- a/src/unzck.c +++ b/src/unzck.c @@ -1,5 +1,5 @@ /* - * Copyright 2018 Jonathan Dieter + * Copyright 2018, 2020 Jonathan Dieter * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/src/zck.c b/src/zck.c index 84231b1..854591c 100644 --- a/src/zck.c +++ b/src/zck.c @@ -1,5 +1,5 @@ /* - * Copyright 2018 Jonathan Dieter + * Copyright 2018, 2020 Jonathan Dieter * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/src/zck_dl.c b/src/zck_dl.c index 045f08f..b19471e 100644 --- a/src/zck_dl.c +++ b/src/zck_dl.c @@ -1,5 +1,5 @@ /* - * Copyright 2018 Jonathan Dieter + * Copyright 2018, 2020 Jonathan Dieter * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/src/zck_gen_zdict.c b/src/zck_gen_zdict.c index 030f09a..0263eea 100644 --- a/src/zck_gen_zdict.c +++ b/src/zck_gen_zdict.c @@ -1,5 +1,5 @@ /* - * Copyright 2018 Jonathan Dieter + * Copyright 2018, 2020 Jonathan Dieter * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/test/copy_chunks.c b/test/copy_chunks.c index ad8f2fb..111132c 100644 --- a/test/copy_chunks.c +++ b/test/copy_chunks.c @@ -1,5 +1,5 @@ /* - * Copyright 2018 Jonathan Dieter + * Copyright 2018, 2020 Jonathan Dieter * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include -- 2.30.2