meson: Refactor the programmer selection

This implements a positive selection choice of which programmers should
be built.

- Each programmer is represented through an entry in the programmer
  dictionary
- The entry contains:
  - A list of systems and CPU families where the programmer can run on
  - A list of required dependencies
  - A list of sources needed to build the programmer
  - A list of compiler flags
  - A flag to determin if the programmer should be build on 'auto'
- If an entry is not given it is set to the default value
- If a programmer gets selected, an 'active' flag is added to the entry
  on runtime
- All programmers with an 'active' flag will be included in the build
- One or more programmers can be selected through '-Dprogrammer=<>'
  - 'auto' enables all programmers which are available, deps are found
    and have the 'default' flag
  - 'all' enables all programmers which are available and deps are found
  - 'group_***' enables all programmers which are available, deps are
    found and the programmer belongs to the selected group
  - '_programmer_name_' forces the programmer to be built or the build
    will fail.

Change-Id: Ib44b26e3748fc71f116184082b4aed0bb208b4c1
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/63724
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72357
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/platform/meson.build b/platform/meson.build
index 5a74cef..42e85ee 100644
--- a/platform/meson.build
+++ b/platform/meson.build
@@ -9,3 +9,34 @@
 if host_machine.endian() == 'big'
   add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c')
 endif
+
+# OpenBSD requires libi386 or libamd64 for I/O port handling
+if host_machine.system() == 'openbsd'
+  if host_machine.cpu_family() == 'x86'
+    libi386 = cc.find_library('i386')
+    deps += libi386
+  elif host_machine.cpu_family() == 'x86_64'
+    libamd64 = cc.find_library('amd64')
+    deps += libamd64
+  endif
+endif
+
+# NetBSD requires libx86 or libx86_64 for I/O port handling
+if host_machine.system() == 'netbsd'
+  if host_machine.cpu_family() == 'x86'
+    libx86 = cc.find_library('x86')
+    deps += libx86
+  elif host_machine.cpu_family() == 'x86_64'
+    libx86_64 = cc.find_library('x86_64')
+    deps += libx86_64
+  endif
+endif
+
+
+# SunOS requires external libraries for network sockets
+# they are used to support serial devices via network
+if host_machine.system() == 'sunos'
+  libsocket = cc.find_library('socket')
+  libnsl = cc.find_library('nsl')
+  deps += [ libsocket, libnsl]
+endif