summaryrefslogtreecommitdiff
path: root/rules/CC/foreign/shell/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-11-20 16:03:21 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2023-11-20 16:03:21 +0100
commit65e841f4cb062c77fc6cb14e7283cb0c7a1f0bb8 (patch)
treee7d9a912c304c030ad48637a82f2f513a83c1150 /rules/CC/foreign/shell/EXPRESSIONS
parentb4dccdd9e27bb570e1d411f8238e4ed0c89e8e1b (diff)
parent96f7a9f47ee4dafccced87e44f98afa3f14a3df9 (diff)
downloadrules-cc-65e841f4cb062c77fc6cb14e7283cb0c7a1f0bb8.tar.gz
Merge subtree 'rules' into rules-cc
Diffstat (limited to 'rules/CC/foreign/shell/EXPRESSIONS')
-rw-r--r--rules/CC/foreign/shell/EXPRESSIONS79
1 files changed, 18 insertions, 61 deletions
diff --git a/rules/CC/foreign/shell/EXPRESSIONS b/rules/CC/foreign/shell/EXPRESSIONS
index 2f05497..1ed7daa 100644
--- a/rules/CC/foreign/shell/EXPRESSIONS
+++ b/rules/CC/foreign/shell/EXPRESSIONS
@@ -3,8 +3,8 @@
[ "cmds"
, "sources"
, "localbase"
- , "outs"
- , "out_dirs"
+ , "installed_files"
+ , "installed_dirs"
, "CC"
, "CXX"
, "CFLAGS"
@@ -19,6 +19,7 @@
, "BUILD_POSITION_INDEPENDENT"
, "TIMEOUT_SCALE"
, "expand_exec"
+ , "resolve_symlinks"
]
, "imports":
{ "artifacts": ["", "field_artifacts"]
@@ -37,7 +38,6 @@
, "foreign-PATH": ["CC/foreign", "default-PATH"]
, "foreign-TOOLCHAIN": ["CC/foreign", "default-TOOLCHAIN"]
, "foreign-NON_SYSTEM_TOOLS": ["CC/foreign", "default-NON_SYSTEM_TOOLS"]
- , "strip-prefix": ["CC/foreign", "strip-prefix"]
}
, "expression":
{ "type": "let*"
@@ -209,7 +209,6 @@
]
}
]
- , ["install_prefix", "install"]
, [ "localbase"
, { "type": "to_subdir"
, "subdir": "localbase"
@@ -222,34 +221,6 @@
, "$1": {"type": "var", "name": "sources"}
}
]
- , [ "installed_out_files"
- , { "type": "foreach"
- , "var": "file_path"
- , "range": {"type": "var", "name": "outs"}
- , "body":
- { "type": "join"
- , "separator": "/"
- , "$1":
- [ {"type": "var", "name": "install_prefix"}
- , {"type": "var", "name": "file_path"}
- ]
- }
- }
- ]
- , [ "installed_out_dirs"
- , { "type": "foreach"
- , "var": "dir_path"
- , "range": {"type": "var", "name": "out_dirs"}
- , "body":
- { "type": "join"
- , "separator": "/"
- , "$1":
- [ {"type": "var", "name": "install_prefix"}
- , {"type": "var", "name": "dir_path"}
- ]
- }
- }
- ]
, [ "script"
, { "type": "singleton_map"
, "key": "run_cmds.sh"
@@ -269,11 +240,11 @@
, "export TOOLCHAIN=\"$(pwd)/toolchain\""
, "export LOCALBASE=\"$(pwd)/localbase\""
, "export DESTDIR=\"$(pwd)/install\""
- , "export CC=$([ -x \"${CC}\" ] && realpath ${CC} || echo ${CC})"
- , "export CXX=$([ -x \"${CXX}\" ] && realpath ${CXX} || echo ${CXX})"
- , "export AR=$([ -x \"${AR}\" ] && realpath ${AR} || echo ${AR})"
- , "export MAKE=$([ -x \"${MAKE}\" ] && realpath ${MAKE} || echo ${MAKE})"
- , "export CMAKE=$([ -x \"${CMAKE}\" ] && realpath ${CMAKE} || echo ${CMAKE})"
+ , "export CC=$([ -x \"${CC}\" ] && echo $(pwd)/${CC} || echo ${CC})"
+ , "export CXX=$([ -x \"${CXX}\" ] && echo $(pwd)/${CXX} || echo ${CXX})"
+ , "export AR=$([ -x \"${AR}\" ] && echo $(pwd)/${AR} || echo ${AR})"
+ , "export MAKE=$([ -x \"${MAKE}\" ] && echo $(pwd)/${MAKE} || echo ${MAKE})"
+ , "export CMAKE=$([ -x \"${CMAKE}\" ] && echo $(pwd)/${CMAKE} || echo ${CMAKE})"
, { "type": "join"
, "$1":
[ "export PATH=\"$(./expand_exec TOOLCHAIN -- echo "
@@ -287,9 +258,13 @@
, ["(", "set --", "cd ./work"]
, {"type": "var", "name": "cmds"}
, [")"]
- , [ "mv install install_with_symlinks"
- , "cp -rL install_with_symlinks install"
- ]
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "resolve_symlinks"}
+ , "then":
+ [ "mv install install_with_symlinks"
+ , "cp -rL install_with_symlinks install >copy.log 2>&1 || (echo 'ERROR: symlink resolve failed with:' && cat copy.log && exit 1)"
+ ]
+ }
]
}
}
@@ -309,33 +284,15 @@
]
}
, "cmd": ["sh", "run_cmds.sh"]
- , "outs": {"type": "var", "name": "installed_out_files"}
- , "out_dirs": {"type": "var", "name": "installed_out_dirs"}
+ , "outs": {"type": "var", "name": "installed_files"}
+ , "out_dirs": {"type": "var", "name": "installed_dirs"}
, "env": {"type": "var", "name": "ENV"}
, "timeout scaling":
{"type": "var", "name": "TIMEOUT_SCALE", "default": 10.0}
}
]
]
- , "body":
- { "type": "map_union"
- , "$1":
- { "type": "let*"
- , "bindings":
- [ ["artifacts", {"type": "var", "name": "artifacts"}]
- , [ "paths"
- , { "type": "++"
- , "$1":
- [ {"type": "var", "name": "outs"}
- , {"type": "var", "name": "out_dirs"}
- ]
- }
- ]
- , ["prefix", {"type": "var", "name": "install_prefix"}]
- ]
- , "body": {"type": "CALL_EXPRESSION", "name": "strip-prefix"}
- }
- }
+ , "body": {"type": "var", "name": "artifacts"}
}
}
}