forked from spyre-project/spyre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch-musl-spec.sh
executable file
·60 lines (50 loc) · 1.07 KB
/
patch-musl-spec.sh
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
56
57
58
59
60
#!/bin/sh
set -eu
readonly prefix=$1
case $prefix in
*x86_64*)
sed -i \
-e 's/^-dynamic-linker/-m elf_x86_64 &/' \
$prefix/lib/musl-gcc.specs
cat >> $prefix/lib/musl-gcc.specs <<EOF
*multilib:
64:../lib64:x86_64-linux-gnu m64;
*multilib_defaults:
m64
*asm:
--64
*cc1_cpu:
-m64
EOF
;;
*i386*)
sed -i \
-e 's/^-dynamic-linker/-m elf_i386 &/' \
$prefix/lib/musl-gcc.specs
cat >> $prefix/lib/musl-gcc.specs <<EOF
*multilib:
32:../lib32:i386-linux-gnu m32;
*multilib_defaults:
m32
*asm:
--32
*cc1_cpu:
-m32
EOF
;;
default)
echo "Could not guess architecture from prefix $prefix" >&2;
exit 1 ;;
esac
# On Debian/stretch x86_64 can't build executables without these
# options, see <https://bugs.debian.org/847776>. However, it seems that
if [ -e /usr/share/dpkg/no-pie-link.specs ]; then
sed -i \
-e 's,-specs ,-specs /usr/share/dpkg/no-pie-link.specs &,' \
$prefix/bin/musl-gcc
fi
if [ -e /usr/share/dpkg/no-pie-compile.specs ]; then
sed -i \
-e 's,-specs ,-specs /usr/share/dpkg/no-pie-compile.specs &,' \
$prefix/bin/musl-gcc
fi