Skip to contentSkip to conversation

meson: Use input/output for entitlements target

PATCH In review Akihiko Odaki 2 participants 2 messages Jul 9, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: Use input/output for entitlements target

input/output parameters respect dependencies.

---
 meson.build            | 30 +++++++++++++++++-------------
 scripts/entitlement.sh | 10 +++++-----
 2 files changed, 22 insertions(+), 18 deletions(-)
meson.build +17 -13
index 7e12de01bec..d21adecc0d8 100644
@@ -2521,28 +2521,32 @@ foreach target : target_dirs
                link_args: link_args,
                gui_app: exe['gui'])
 
-    if 'CONFIG_HVF' in config_target
-      entitlements = meson.current_source_dir() / 'accel/hvf/entitlements.plist'
-    else
-      entitlements = '/dev/null'
-    endif
     if targetos == 'darwin'
-      icon = meson.current_source_dir() / 'pc-bios/qemu.rsrc'
+      icon = 'pc-bios/qemu.rsrc'
+      build_input = [emulator, files(icon)]
+      install_input = [
+        get_option('bindir') / exe_name,
+        meson.current_source_dir() / icon
+      ]
+      if 'CONFIG_HVF' in config_target
+        entitlements = 'accel/hvf/entitlements.plist'
+        build_input += files(entitlements)
+        install_input += meson.current_source_dir() / entitlements
+      endif
+
       emulators += {exe['name'] : custom_target(exe['name'],
-                   depends: emulator,
+                   input: build_input,
                    output: exe['name'],
                    command: [
-                     meson.current_source_dir() / 'scripts/entitlement.sh',
-                     meson.current_build_dir() / exe_name,
-                     meson.current_build_dir() / exe['name'],
-                     entitlements, icon
+                     files('scripts/entitlement.sh'),
+                     '@OUTPUT@',
+                     '@INPUT@'
                    ])
       }
 
       meson.add_install_script('scripts/entitlement.sh', '--install',
-                               get_option('bindir') / exe_name,
                                get_option('bindir') / exe['name'],
-                               entitlements, icon)
+                               install_input)
     else
       emulators += {exe['name']: emulator}
     endif
scripts/entitlement.sh +5 -5
index d2a7079ce3e..e2c956a3ac9 100755
@@ -8,10 +8,10 @@ if [ "$1" = --install ]; then
   in_place=false
 fi
 
-SRC="$1"
-DST="$2"
-ENTITLEMENT="$3"
-ICON="$4"
+DST="$1"
+SRC="$2"
+ICON="$3"
+ENTITLEMENT="$4"
 
 if $in_place; then
   trap 'rm "$DST.tmp"' exit
@@ -21,7 +21,7 @@ else
   cd "$MESON_INSTALL_DESTDIR_PREFIX"
 fi
 
-if test "$ENTITLEMENT" != '/dev/null'; then
+if test -n "$ENTITLEMENT"; then
   codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC"
 fi
 
Signature · 1 line
2.30.1 (Apple Git-130)
#1 lore raw
Quoted 79 lines · Akihiko Odaki

input/output parameters respect dependencies.

---
  meson.build            | 30 +++++++++++++++++-------------
  scripts/entitlement.sh | 10 +++++-----
  2 files changed, 22 insertions(+), 18 deletions(-)
meson.build +17 -13
index 7e12de01bec..d21adecc0d8 100644
@@ -2521,28 +2521,32 @@ foreach target : target_dirs
                 link_args: link_args,
                 gui_app: exe['gui'])
 
-    if 'CONFIG_HVF' in config_target
-      entitlements = meson.current_source_dir() / 'accel/hvf/entitlements.plist'
-    else
-      entitlements = '/dev/null'
-    endif
      if targetos == 'darwin'
-      icon = meson.current_source_dir() / 'pc-bios/qemu.rsrc'
+      icon = 'pc-bios/qemu.rsrc'
+      build_input = [emulator, files(icon)]
+      install_input = [
+        get_option('bindir') / exe_name,
+        meson.current_source_dir() / icon
+      ]
+      if 'CONFIG_HVF' in config_target
+        entitlements = 'accel/hvf/entitlements.plist'
+        build_input += files(entitlements)
+        install_input += meson.current_source_dir() / entitlements
+      endif
+
        emulators += {exe['name'] : custom_target(exe['name'],
-                   depends: emulator,
+                   input: build_input,
                     output: exe['name'],
                     command: [
-                     meson.current_source_dir() / 'scripts/entitlement.sh',
-                     meson.current_build_dir() / exe_name,
-                     meson.current_build_dir() / exe['name'],
-                     entitlements, icon
+                     files('scripts/entitlement.sh'),
+                     '@OUTPUT@',
+                     '@INPUT@'
                     ])
        }
 
        meson.add_install_script('scripts/entitlement.sh', '--install',
-                               get_option('bindir') / exe_name,
                                 get_option('bindir') / exe['name'],
-                               entitlements, icon)
+                               install_input)
      else
        emulators += {exe['name']: emulator}
      endif
scripts/entitlement.sh +4 -4
index d2a7079ce3e..e2c956a3ac9 100755
@@ -8,10 +8,10 @@ if [ "$1" = --install ]; then
    in_place=false
  fi
 
-SRC="$1"
-DST="$2"
-ENTITLEMENT="$3"
-ICON="$4"
+DST="$1"
+SRC="$2"
+ICON="$3"
+ENTITLEMENT="$4"
 
  if $in_place; then
    trap 'rm "$DST.tmp"' exit

scripts/entitlement.sh else · line 27

Quoted 8 lines
scripts/entitlement.sh +1 -1
@@ -21,7 +21,7 @@ else
    cd "$MESON_INSTALL_DESTDIR_PREFIX"
  fi
 
-if test "$ENTITLEMENT" != '/dev/null'; then
+if test -n "$ENTITLEMENT"; then
    codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC"
  fi
 

Definitely better, thanks!! I queued the patch.

Paolo