From: Kirill Isakov Date: Mon, 2 May 2022 07:00:13 +0000 (+0600) Subject: Move macOS-specific code into a subdirectory X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=f86a5f1d70206321b01ec60f6a69f8cbf1a2b732;p=tinc Move macOS-specific code into a subdirectory --- diff --git a/.ci/tidy/run.sh b/.ci/tidy/run.sh index cf055568..a2439f7d 100755 --- a/.ci/tidy/run.sh +++ b/.ci/tidy/run.sh @@ -13,7 +13,7 @@ Linux) ;; FreeBSD) - paths="$paths src/linux src/bsd/tunemu.c" + paths="$paths src/linux src/bsd/darwin src/bsd/openbsd" ;; Darwin) diff --git a/src/bsd/darwin/meson.build b/src/bsd/darwin/meson.build new file mode 100644 index 00000000..5672fcd0 --- /dev/null +++ b/src/bsd/darwin/meson.build @@ -0,0 +1,9 @@ +dep_tunemu = dependency('tunemu', required: opt_tunemu, static: static) +dep_pcap = dependency('pcap', required: opt_tunemu, static: static) + +if dep_tunemu.found() and dep_pcap.found() + deps_tincd += [dep_tunemu, dep_pcap] + src_tincd += files('tunemu.c') + cdata.set('ENABLE_TUNEMU', 1) +endif + diff --git a/src/bsd/tunemu.c b/src/bsd/darwin/tunemu.c similarity index 100% rename from src/bsd/tunemu.c rename to src/bsd/darwin/tunemu.c diff --git a/src/bsd/tunemu.h b/src/bsd/darwin/tunemu.h similarity index 97% rename from src/bsd/tunemu.h rename to src/bsd/darwin/tunemu.h index 7dcd2d59..9f9edb01 100644 --- a/src/bsd/tunemu.h +++ b/src/bsd/darwin/tunemu.h @@ -20,7 +20,7 @@ #ifndef TUNEMU_H #define TUNEMU_H -#include "../system.h" +#include "../../system.h" typedef char tunemu_device[7]; diff --git a/src/bsd/device.c b/src/bsd/device.c index badd77d7..c0642f57 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -28,7 +28,7 @@ #include "../xalloc.h" #ifdef ENABLE_TUNEMU -#include "tunemu.h" +#include "darwin/tunemu.h" #endif #ifdef HAVE_NET_IF_UTUN_H diff --git a/src/bsd/meson.build b/src/bsd/meson.build index d6205f4f..e6062dc8 100644 --- a/src/bsd/meson.build +++ b/src/bsd/meson.build @@ -13,18 +13,7 @@ check_functions += [ src_tincd += files('device.c') -if os_name == 'openbsd' - subdir('openbsd') -endif - -if os_name == 'darwin' - dep_tunemu = dependency('tunemu', required: opt_tunemu, static: static) - dep_pcap = dependency('pcap', required: opt_tunemu, static: static) - - if dep_tunemu.found() and dep_pcap.found() - deps_tincd += [dep_tunemu, dep_pcap] - src_tincd += files('tunemu.c') - cdata.set('ENABLE_TUNEMU', 1) - endif +if os_name in ['openbsd', 'darwin'] + subdir(os_name) endif