This repository has been archived by the owner on Aug 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplan.sh
90 lines (76 loc) · 1.9 KB
/
plan.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
source ../gcc/plan.sh
pkg_name=gcc-libs
pkg_version=9.4.0
pkg_origin=core
pkg_maintainer="The Habitat Maintainers <[email protected]>"
pkg_description="Runtime libraries shipped by GCC."
pkg_upstream_url="https://gcc.gnu.org/"
pkg_license=('GPL-3.0-or-later' 'GCC Runtime Library Exception')
# The shared libraries only depend on core/glibc
pkg_deps=(
core/glibc
core/zlib
)
# Add the same version of the full gcc package as a build dep
pkg_build_deps=(
core/gcc/"$pkg_version"
core/patchelf
)
# Zero out the bin and include paths, as we're only shipping shared libs
pkg_bin_dirs=()
pkg_include_dirs=()
# The list of GCC libraries to copy
_gcc_libs=(
libasan
libatomic
libgcc_s
libgfortran
libgomp
libitm
liblsan
libquadmath
libstdc++
libtsan
libubsan
libvtv
)
do_install() {
mkdir -pv "$pkg_prefix/lib"
for lib in "${_gcc_libs[@]}"; do
cp -av "$(pkg_path_for gcc)/lib/${lib}".* "$pkg_prefix/lib"/
done
rm -fv "$pkg_prefix/lib"/*.spec "$pkg_prefix/lib"/*.py
mkdir -pv "$pkg_prefix/share/licenses"
cp -av "$(pkg_path_for gcc)"/share/licenses/RUNTIME.LIBRARY.EXCEPTION \
"$pkg_prefix/share/licenses/"
# Due to the copy-from-package trick above, the resulting `RUNPATH` entries
# have more path entries than are actually being used (for mpfr, libmpc,
# etc), so we'll use `patchelf` trim these unused path entries for each
# shared library.
find "$pkg_prefix/lib" \
-type f \
-name '*.so.*' \
-exec patchelf --set-rpath "$(pkg_path_for glibc)/lib:$(pkg_path_for zlib)/lib:$pkg_prefix/lib" {} \;
find "$pkg_prefix/lib" \
-type f \
-name '*.so.*' \
-exec patchelf --shrink-rpath {} \;
}
# Turn the remaining default phases into no-ops
do_download() {
return 0
}
do_verify() {
return 0
}
do_unpack() {
return 0
}
do_prepare() {
return 0
}
do_build() {
return 0
}
# We will rely on tests from `gcc`, so skip them here
unset -f do_check