[Notes] [Git][BuildStream/buildstream][coldtom/strip-rules] Upstream freedesktop-sdk strip rules



Title: GitLab

Thomas Coldrick pushed to branch coldtom/strip-rules at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/data/projectconfig.yaml
    ... ... @@ -65,23 +65,40 @@ variables:
    65 65
     
    
    66 66
         --remove-section=.comment --remove-section=.note --strip-unneeded
    
    67 67
     
    
    68
    +  # Causes strip-binaries to fail on error if set to True
    
    69
    +  non-fatal-strip: "true"
    
    70
    +
    
    68 71
       # Generic implementation for stripping debugging symbols
    
    69 72
       strip-binaries: |
    
    70
    -
    
    71
    -    cd "%{install-root}" && find -type f \
    
    72
    -      '(' -perm -111 -o -name '*.so*' \
    
    73
    -          -o -name '*.cmxs' -o -name '*.node' ')' \
    
    74
    -      -exec sh -ec \
    
    75
    -      'read -n4 hdr <"$1" # check for elf header
    
    76
    -       if [ "$hdr" != "$(printf \\x7fELF)" ]; then
    
    77
    -           exit 0
    
    78
    -       fi
    
    79
    -       debugfile="%{install-root}%{debugdir}/$1"
    
    80
    -       mkdir -p "$(dirname "$debugfile")"
    
    81
    -       objcopy %{objcopy-extract-args} "$1" "$debugfile"
    
    82
    -       chmod 644 "$debugfile"
    
    83
    -       strip %{strip-args} "$1"
    
    84
    -       objcopy %{objcopy-link-args} "$debugfile" "$1"' - {} ';'
    
    73
    +    find "%{install-root}" -type f \
    
    74
    +    '(' -perm -111 -o -name '*.so*' \
    
    75
    +        -o -name '*.cmxs' -o -name '*.node' ')' \
    
    76
    +        -print0 | while read -r -d $'\0' file; do
    
    77
    +        read -n4 hdr <"${file}" || continue # check for elf header
    
    78
    +        if [ "$hdr" != "$(printf \\x7fELF)" ]; then
    
    79
    +          continue
    
    80
    +        fi
    
    81
    +        if objdump -j .gnu_debuglink -s "${file}" &>/dev/null; then
    
    82
    +          continue
    
    83
    +        fi
    
    84
    +        case "${file}" in
    
    85
    +          "%{install-root}%{debugdir}/"*)
    
    86
    +          continue
    
    87
    +          ;;
    
    88
    +        *)
    
    89
    +          ;;
    
    90
    +        esac
    
    91
    +        realpath="$(realpath -s --relative-to="%{install-root}" "${file}")"
    
    92
    +        debugfile="%{install-root}%{debugdir}/${realpath}.debug"
    
    93
    +        mkdir -p "$(dirname "$debugfile")" || %{non-fatal-strip}
    
    94
    +        objcopy %{objcopy-extract-args} "${file}" "$debugfile" || %{non-fatal-strip}
    
    95
    +        chmod 644 "$debugfile"
    
    96
    +        mode="$(stat -c 0%a "${file}")"
    
    97
    +        [ -w "${file}" ] || chmod +w "${file}"
    
    98
    +        strip %{strip-args} "${file}" || %{non-fatal-strip}
    
    99
    +        objcopy %{objcopy-link-args} "$debugfile" "${file}" || %{non-fatal-strip}
    
    100
    +        chmod "${mode}" "${file}"
    
    101
    +    done
    
    85 102
     
    
    86 103
       # Generic implementation for reproducible python builds
    
    87 104
       fix-pyc-timestamps: |
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]