Move macOS-specific code into a subdirectory
authorKirill Isakov <bootctl@gmail.com>
Mon, 2 May 2022 07:00:13 +0000 (13:00 +0600)
committerKirill Isakov <bootctl@gmail.com>
Mon, 2 May 2022 18:49:02 +0000 (00:49 +0600)
.ci/tidy/run.sh
src/bsd/darwin/meson.build [new file with mode: 0644]
src/bsd/darwin/tunemu.c [moved from src/bsd/tunemu.c with 100% similarity]
src/bsd/darwin/tunemu.h [moved from src/bsd/tunemu.h with 97% similarity]
src/bsd/device.c
src/bsd/meson.build

index cf05556..a2439f7 100755 (executable)
@@ -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 (file)
index 0000000..5672fcd
--- /dev/null
@@ -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
+
similarity index 100%
rename from src/bsd/tunemu.c
rename to src/bsd/darwin/tunemu.c
similarity index 97%
rename from src/bsd/tunemu.h
rename to src/bsd/darwin/tunemu.h
index 7dcd2d5..9f9edb0 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef TUNEMU_H
 #define TUNEMU_H
 
-#include "../system.h"
+#include "../../system.h"
 
 typedef char tunemu_device[7];
 
index badd77d..c0642f5 100644 (file)
@@ -28,7 +28,7 @@
 #include "../xalloc.h"
 
 #ifdef ENABLE_TUNEMU
-#include "tunemu.h"
+#include "darwin/tunemu.h"
 #endif
 
 #ifdef HAVE_NET_IF_UTUN_H
index d6205f4..e6062dc 100644 (file)
@@ -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