-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplan.sh
85 lines (75 loc) · 2.42 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
#!/usr/bin/env bash
pkg_origin="ryanwoodsmall"
pkg_name="zulu17musl"
pkg_maintainer="ryanwoodsmall <[email protected]>"
ver1="17.48.15"
ver2="17.0.10"
pkg_version="${ver1}.${ver2}"
pkg_dirname="zulu${ver1}-ca-jdk${ver2}-linux_musl_x64"
pkg_filename="${pkg_dirname}.tar.gz"
pkg_source="https://cdn.azul.com/zulu/bin/${pkg_filename}"
pkg_shasum="2e6d14c4d4c18e148fa91da5a522492a1a0dd6dd2c1882e06d93799fb88d1508"
pkg_license=( "GPL-2.0-only WITH Classpath-exception-2.0" )
pkg_description=( 'Zulu is a build of the Open Java Development Kit (OpenJDK) on musl libc with long-term support from Azul' )
pkg_upstream_url="https://www.azul.com/downloads/zulu-community/"
pkg_deps=(
core/musl
core/zlib-musl
)
pkg_build_deps=(
core/gawk
core/file
core/findutils
core/patchelf
)
pkg_bin_dirs=( bin )
pkg_lib_dirs=( lib )
pkg_include_dirs=( include )
do_build() {
return 0
}
do_default_unpack() {
return 0
}
do_strip() {
return 0
}
do_setup_environment() {
set_runtime_env JAVA_HOME "${pkg_prefix}"
}
do_unpack() {
local t="${pkg_prefix}"
local f="${HAB_CACHE_SRC_PATH}/${pkg_filename}"
build_line "Extracting '${f}' to '${t}'"
mkdir -p "${t}"
tar -C "${t}/" -zxf "${f}"
pushd "${t}/" >/dev/null 2>&1 || exit 1
cd "${pkg_dirname}"
for i in $(find . -mindepth 1 -maxdepth 1) ; do
mv "${i}" ..
done
cd ..
rmdir "${pkg_dirname}"
popd >/dev/null 2>&1 || exit 1
}
do_install() {
pushd "${pkg_prefix}" >/dev/null 2>&1 || exit 1
# rpath - where shared libs are found
export LD_RUN_PATH="${LD_RUN_PATH}"
build_line "Adding '${LD_RUN_PATH}' to rpath for all libraries and executables"
# interpreter - dynamic linker
local interp="$(pkg_path_for core/musl)/lib/ld-musl-x86_64.so.1"
build_line "Setting interpreter for all executables to '${interp}'"
for i in $($(pkg_path_for core/findutils)/bin/find "${pkg_prefix}" -exec $(pkg_path_for core/file)/bin/file {} + | $(pkg_path_for core/gawk)/bin/awk -F: '/:.*ELF/{print $1}') ; do
local orpath="$(patchelf --print-rpath ${i})"
local nrpath="${LD_RUN_PATH}:${orpath}"
nrpath="${nrpath//::/:}"
build_line "Setting '${i}' rpath to '${nrpath}'"
$(pkg_path_for core/patchelf)/bin/patchelf --set-rpath "${nrpath}" "${i}"
if ! $(echo "${i}" | grep -q '\.so') ; then
build_line "Setting '${i}' interpreter to '${interp}'"
$(pkg_path_for core/patchelf)/bin/patchelf --set-interpreter "${interp}" "${i}"
fi
done
popd >/dev/null 2>&1 || exit 1
}