[PATCH i-g-t 1/1] scripts/generate_iga64_codes: Fix dist build

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Dec 12 10:52:31 UTC 2024


Distro building is running script from different working
directory then scripts are located and this makes script
to try regenerate its files and it fails with:

scripts/generate_iga64_codes: line 43: ../lib/iga64_macros.h: No such file or directory
Generating new lib/iga64_generated_codes.c
Generating iga64_code_gpgpu_fill for platform 2
<command-line>: fatal error: ../lib/iga64_macros.h: No such file or directory

Created workaround for finding the file path and if this fails,
bailing out with warning and no regeneration.

Cc: Andrzej Hajda <andrzej.hajda at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 scripts/generate_iga64_codes | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/scripts/generate_iga64_codes b/scripts/generate_iga64_codes
index 652bf01a0..56419199a 100755
--- a/scripts/generate_iga64_codes
+++ b/scripts/generate_iga64_codes
@@ -32,6 +32,18 @@ while getopts ':i:o:' opt; do
 done
 LIBS=${@:OPTIND}
 
+IGA64_MACROS_H=../lib/iga64_macros.h
+if [ -f ${IGA64_MACROS_H} ]; then
+    IGA64_MACROS_H_PATH=${IGA64_MACROS_H}
+else
+    IGA64_MACROS_H_PATH=`dirname $0`/${IGA64_MACROS_H}
+fi
+if [ ! -f ${IGA64_MACROS_H_PATH} ]; then
+    echo "WARNING: cannot find ${IGA64_MACROS_H} in path, skipping verification"
+    cp $INPUT $OUTPUT
+    exit 0
+fi
+
 # read all assemblies into ASMS array
 ASMS=()
 while  read -d $'\0' asm; do
@@ -40,7 +52,7 @@ while  read -d $'\0' asm; do
 done < <(for f in $LIBS; do objcopy --dump-section .iga64_assembly=/dev/stdout $f.p/*.o /dev/null; done)
 
 # check if we need to recompile - checksum difference and compiler present
-MD5_ASMS="$(md5sum <<< "$(< ../lib/iga64_macros.h) ${ASMS[@]}" | cut -b1-32)"
+MD5_ASMS="$(md5sum <<< "$(< ${IGA64_MACROS_H_PATH}) ${ASMS[@]}" | cut -b1-32)"
 MD5_PRE="$(grep -Po '(?<=^#define MD5_SUM_IGA64_ASMS )\S{32,32}' $INPUT 2>/dev/null)"
 
 if [ "$MD5_ASMS" = "$MD5_PRE" ]; then
@@ -90,7 +102,7 @@ EOF
 # Compiles assembly to binary representation sent to stdout.
 compile_iga64() {
     cmd="cpp -P - -o $WD/$asm_name.$gen_name.asm"
-    cmd+=" -DGEN_VER=$gen_ver -D'ARG(n)=($IGA64_ARG0 + (n))' -imacros ../lib/iga64_macros.h"
+    cmd+=" -DGEN_VER=$gen_ver -D'ARG(n)=($IGA64_ARG0 + (n))' -imacros ${IGA64_MACROS_H_PATH}"
     eval "$cmd" <<<"$asm_body" || die "cpp error for $asm_name.$gen_name\ncmd: $cmd"
     cmd="iga64 -Xauto-deps -Wall -p=$gen_name"
     cmd+=" $WD/$asm_name.$gen_name.asm"
-- 
2.47.1



More information about the igt-dev mailing list