summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Coldrick <othko97@gmail.com>2018-10-04 11:52:15 +0100
committerThomas Coldrick <othko97@gmail.com>2018-10-04 11:53:22 +0100
commite7beb2927b851c39c3c6fbe62bb3d58953b22080 (patch)
tree3624de790c8fbc473c2487cfd17aacb40b858c98
parentfd6a957366e5abe3cddc225118969205000e182d (diff)
downloadbuildstream-e7beb2927b851c39c3c6fbe62bb3d58953b22080.tar.gz
Upstream freedesktop-sdk strip rules
Adds a modified version of the freedesktop-sdk `strip-binaries` to buildstream default `project.conf`. We implemented a few changes to the current default, but the main change is to fix a bug due to permissions. The modifications I made to the freedesktop-sdk commands as they are at present are as follows: * Remove debugedit rules to include source debugging * Add a switch to allow failing on error, rather than this being the default behaviour. These changes mean that we should now have a sensible default for a wide variety of users.
-rw-r--r--buildstream/data/projectconfig.yaml49
1 files changed, 33 insertions, 16 deletions
diff --git a/buildstream/data/projectconfig.yaml b/buildstream/data/projectconfig.yaml
index 4d2ccc647..701a93026 100644
--- a/buildstream/data/projectconfig.yaml
+++ b/buildstream/data/projectconfig.yaml
@@ -51,23 +51,40 @@ variables:
--remove-section=.comment --remove-section=.note --strip-unneeded
+ # Causes strip-binaries to fail on error if set to true
+ fatal-strip: "false"
+
# Generic implementation for stripping debugging symbols
strip-binaries: |
-
- cd "%{install-root}" && find -type f \
- '(' -perm -111 -o -name '*.so*' \
- -o -name '*.cmxs' -o -name '*.node' ')' \
- -exec sh -ec \
- 'read -n4 hdr <"$1" # check for elf header
- if [ "$hdr" != "$(printf \\x7fELF)" ]; then
- exit 0
- fi
- debugfile="%{install-root}%{debugdir}/$1"
- mkdir -p "$(dirname "$debugfile")"
- objcopy %{objcopy-extract-args} "$1" "$debugfile"
- chmod 644 "$debugfile"
- strip %{strip-args} "$1"
- objcopy %{objcopy-link-args} "$debugfile" "$1"' - {} ';'
+ find "%{install-root}" -type f \
+ '(' -perm -111 -o -name '*.so*' \
+ -o -name '*.cmxs' -o -name '*.node' ')' \
+ -print0 | while read -r -d $'\0' file; do
+ read -n4 hdr <"${file}" || continue # check for elf header
+ if [ "$hdr" != "$(printf \\x7fELF)" ]; then
+ continue
+ fi
+ if objdump -j .gnu_debuglink -s "${file}" &>/dev/null; then
+ continue
+ fi
+ case "${file}" in
+ "%{install-root}%{debugdir}/"*)
+ continue
+ ;;
+ *)
+ ;;
+ esac
+ realpath="$(realpath -s --relative-to="%{install-root}" "${file}")"
+ debugfile="%{install-root}%{debugdir}/${realpath}.debug"
+ mkdir -p "$(dirname "$debugfile")"
+ objcopy %{objcopy-extract-args} "${file}" "$debugfile"
+ chmod 644 "$debugfile"
+ mode="$(stat -c 0%a "${file}")"
+ [ -w "${file}" ] || chmod +w "${file}"
+ strip %{strip-args} "${file}" || %{fatal-strip}
+ objcopy %{objcopy-link-args} "$debugfile" "${file}"
+ chmod "${mode}" "${file}"
+ done
# Generic implementation for reproducible python builds
fix-pyc-timestamps: |
@@ -191,4 +208,4 @@ shell:
command: [ 'sh', '-i' ]
remote-execution:
- url: "" \ No newline at end of file
+ url: ""