Skip to content

Commit c1ec460

Browse files
committed
Packaging support on Alpine Linux
1 parent 8c45069 commit c1ec460

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

packaging/packager

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,39 @@ if ! type zip > /dev/null 2>&1; then
5656
echo "zip utility is not found. Please install it and re-run this script"
5757
exit 1
5858
fi
59-
function package_libc_via_pacman {
59+
60+
function pluck_so_files() {
61+
sed -E '/\.so$|\.so\.[0-9]+$/!d'
62+
}
63+
64+
function package_libc_alpine() {
65+
if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then
66+
if type apk > /dev/null 2>&1; then
67+
apk info -L musl 2>/dev/null | pluck_so_files | sed 's/^/\//'
68+
fi
69+
fi
70+
}
71+
72+
function package_libc_pacman() {
6073
if grep --extended-regexp "Arch Linux|Manjaro Linux" < /etc/os-release > /dev/null 2>&1; then
6174
if type pacman > /dev/null 2>&1; then
62-
pacman --query --list --quiet glibc | sed -E '/\.so$|\.so\.[0-9]+$/!d'
75+
pacman --query --list --quiet glibc | pluck_so_files
6376
fi
6477
fi
6578
}
6679

67-
function package_libc_via_dpkg() {
80+
function package_libc_dpkg() {
6881
if type dpkg-query > /dev/null 2>&1; then
6982
if [[ $(dpkg-query --listfiles libc6 | wc -l) -gt 0 ]]; then
70-
dpkg-query --listfiles libc6 | sed -E '/\.so$|\.so\.[0-9]+$/!d'
83+
dpkg-query --listfiles libc6 | pluck_so_files
7184
fi
7285
fi
7386
}
7487

75-
function package_libc_via_rpm() {
88+
function package_libc_rpm() {
7689
if type rpm > /dev/null 2>&1; then
7790
if [[ $(rpm --query --list glibc.$architecture | wc -l) -gt 1 ]]; then
78-
rpm --query --list glibc.$architecture | sed -E '/\.so$|\.so\.[0-9]+$/!d'
91+
rpm --query --list glibc.$architecture | pluck_so_files
7992
fi
8093
fi
8194
}
@@ -99,9 +112,10 @@ PKG_LD=""
99112

100113
list=$(ldd "$PKG_BIN_PATH" | awk '{print $(NF-1)}')
101114
libc_libs=()
102-
libc_libs+=($(package_libc_via_dpkg))
103-
libc_libs+=($(package_libc_via_rpm))
104-
libc_libs+=($(package_libc_via_pacman))
115+
libc_libs+=($(package_libc_dpkg))
116+
libc_libs+=($(package_libc_rpm))
117+
libc_libs+=($(package_libc_pacman))
118+
libc_libs+=($(package_libc_alpine))
105119

106120
mkdir -p "$PKG_DIR/bin" "$PKG_DIR/lib"
107121

0 commit comments

Comments
 (0)