diff options
-rw-r--r-- | meta/classes/cross.bbclass | 2 | ||||
l--------- | scripts/cross-intercept/ar | 1 | ||||
-rwxr-xr-x | scripts/native-intercept/ar | 32 |
3 files changed, 35 insertions, 0 deletions
diff --git a/meta/classes/cross.bbclass b/meta/classes/cross.bbclass index 3e6a2f60b9..9d951076a7 100644 --- a/meta/classes/cross.bbclass +++ b/meta/classes/cross.bbclass | |||
@@ -93,3 +93,5 @@ python do_addto_recipe_sysroot () { | |||
93 | } | 93 | } |
94 | addtask addto_recipe_sysroot after do_populate_sysroot | 94 | addtask addto_recipe_sysroot after do_populate_sysroot |
95 | do_addto_recipe_sysroot[deptask] = "do_populate_sysroot" | 95 | do_addto_recipe_sysroot[deptask] = "do_populate_sysroot" |
96 | |||
97 | PATH:prepend = "${COREBASE}/scripts/cross-intercept:" | ||
diff --git a/scripts/cross-intercept/ar b/scripts/cross-intercept/ar new file mode 120000 index 0000000000..bc68ffd7a2 --- /dev/null +++ b/scripts/cross-intercept/ar | |||
@@ -0,0 +1 @@ | |||
../native-intercept/ar \ No newline at end of file | |||
diff --git a/scripts/native-intercept/ar b/scripts/native-intercept/ar new file mode 100755 index 0000000000..dcc623e3ed --- /dev/null +++ b/scripts/native-intercept/ar | |||
@@ -0,0 +1,32 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | # | ||
3 | # Wrapper around 'ar' that defaults to deterministic archives | ||
4 | |||
5 | import os | ||
6 | import shutil | ||
7 | import sys | ||
8 | |||
9 | # calculate path to the real 'ar' | ||
10 | path = os.environ['PATH'] | ||
11 | path = path.replace(os.path.dirname(sys.argv[0]), '') | ||
12 | real_ar = shutil.which('ar', path=path) | ||
13 | |||
14 | if len(sys.argv) == 1: | ||
15 | os.execl(real_ar, 'ar') | ||
16 | |||
17 | # modify args to mimic 'ar' configured with --default-deterministic-archives | ||
18 | argv = sys.argv | ||
19 | if argv[1].startswith('--'): | ||
20 | # No modifier given | ||
21 | None | ||
22 | else: | ||
23 | # remove the optional '-' | ||
24 | if argv[1][0] == '-': | ||
25 | argv[1] = argv[1][1:] | ||
26 | if 'U' in argv[1]: | ||
27 | sys.stderr.write("ar: non-deterministic mode requested\n") | ||
28 | else: | ||
29 | argv[1] = argv[1].replace('u', '') | ||
30 | argv[1] = 'D' + argv[1] | ||
31 | |||
32 | os.execv(real_ar, argv) | ||