blob: f54009cdb15e7f597d93e091cf5686988bc3f2bb (
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
|
#!/bin/sh -e
# Set the variable sys_arch so that we can change the
# build procedure depending on the host arch. Currently,
# we are only supporting i686 and x86_64.
sys_arch="${3:-$(uname -m)}"
kinstall_t() {
# install -Dm* -t alternative
# usage: kinstall_t 755 /usr/bin file file2 file3
mod=$1 dir=$2; mkdir -p "$dir"
shift 2
for file; do
cp "$file" "$dir"
chmod "$mod" "$dir/$file"
done
}
patch -p0 < CVE-2020-28928.patch
[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc AR=$CPT_CROSS_TRIPLET-ar
cpt-configure \
--syslibdir=/usr/lib
make
make DESTDIR="$1" install
mkdir -p "$1/usr/bin"
case "${CPT_CROSS_TRIPLET:-$sys_arch}" in
x86_64*)
ln -sf libc.so "$1/usr/lib/ld-musl-x86_64.so.1"
ln -s ../lib/ld-musl-x86_64.so.1 "$1/usr/bin/ldd" ;;
i?86*)
ln -sf libc.so "$1/usr/lib/ld-musl-i686.so.1"
ln -s libc.so "$1/usr/lib/libc.musl-x86.so"
ln -s ../lib/ld-musl-i386.so.1 "$1/usr/bin/ldd"
;;
esac
# Install BSD compatibility headers.
kinstall_t 755 "$1/usr/include/sys" cdefs.h queue.h tree.h
# Install getconf.
"${CC:=cc}" --static getconf.c -o "$1/usr/bin/getconf"
"$CC" -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o
"${AR:-ar}" r "$1/usr/lib/libssp_nonshared.a" __stack_chk_fail_local.o
# Install getent
kinstall_t 755 "$1/usr/bin" getent
|