blob: 98b0e2238527e6dc95528e68e63d35b23f895ba4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/bin/bash
#
# Produces Abseil patch from build log passed on stdin.
set -e
source PKGBUILD
build_files=()
src_dir="src/chromium-${pkgver:?}"
tmp_dir="$(mktemp -d)"
while IFS= read -r line; do
lib_path="$(grep -oP '(?<=^//).+?(?=:)' <<<"${line}" || true)"
if [ ! "${lib_path}" ]; then
continue
fi
build_file="${lib_path}/BUILD.gn"
if [ ! -f "${tmp_dir}/${build_file}" ]; then
build_files+=("${build_file}")
install -Dm644 "${src_dir}/${build_file}" "${tmp_dir}/${build_file}"
fi
IFS= read -r line
dependency="$(grep -oP '(?<= needs ).+?(?=\()' <<<"${line}" || true)"
if [ ! "${dependency}" ]; then
continue
fi
base_name=${dependency#"//${lib_path}/"}
sed -i -e "\|^\s*\"\(//${lib_path}/\)\{0,1\}${base_name}\",\$|d" \
-e "s|\[\s*\"\(//${lib_path}/\)\{0,1\}${base_name}\"\s*\]|[]|g" \
"${tmp_dir}/${build_file}"
done
cat > abseil-remove-unused-targets.patch <<EOF
These targets are dead code and they aren't available with system Abseil. Based on:
https://build.opensuse.org/package/view_file/openSUSE:Factory:ARM/nodejs-electron
EOF
for build_file in "${build_files[@]}"; do
diff -u "${src_dir}/${build_file}" "${tmp_dir}/${build_file}" \
| sed "s, \(${src_dir}\|${tmp_dir}\)/, ,g" \
>> abseil-remove-unused-targets.patch
done
rm -r "${tmp_dir}"
|