aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcore/musl/build39
-rw-r--r--core/musl/checksums1
-rwxr-xr-xcore/musl/files/getent107
-rw-r--r--core/musl/sources1
-rw-r--r--core/musl/version2
5 files changed, 144 insertions, 6 deletions
diff --git a/core/musl/build b/core/musl/build
index f2150a2f..4a062201 100755
--- a/core/musl/build
+++ b/core/musl/build
@@ -1,5 +1,21 @@
#!/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="$(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
+}
+
./configure \
--prefix=/usr \
--syslibdir=/usr/lib
@@ -8,12 +24,25 @@ make
make DESTDIR="$1" install
mkdir -p "$1/usr/bin"
-ln -s /usr/lib/ld-musl-x86_64.so.1 "$1/usr/bin/ldd"
+
+case "$sys_arch" in
+ x86_64) ln -s /usr/lib/ld-musl-x86_64.so.1 "$1/usr/bin/ldd" ;;
+ i*86)
+ 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.
-install -Dm 755 cdefs.h "$1/usr/include/sys/cdefs.h"
-install -Dm 755 queue.h "$1/usr/include/sys/queue.h"
-install -Dm 755 tree.h "$1/usr/include/sys/tree.h"
+kinstall_t 755 "$1/usr/include/sys" cdefs.h queue.h tree.h
# Install getconf.
-cc getconf.c -o "$1/usr/bin/getconf"
+"${CC:=cc}" getconf.c -o "$1/usr/bin/getconf"
+
+case $sys_arch in i*86)
+ "$CC" -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o
+ ar r "$1/usr/lib/libssp_nonshared.a" __stack-chk_fail_local.o
+esac
+
+# Install getent
+kinstall_t 755 "$1/usr/bin" getent
diff --git a/core/musl/checksums b/core/musl/checksums
index 2c1529df..910381b4 100644
--- a/core/musl/checksums
+++ b/core/musl/checksums
@@ -3,3 +3,4 @@ c6de7b191139142d3f9a7b5b702c9cae1b5ee6e7f57e582da9328629408fd4e8 musl-1.2.0.tar
c13407edd0e33be73cae72514cb234f8612e1c0e54401c9448daffd3a240158b queue.h
e1e498a79bf160a5766fa560f2b07b206fe89fe21a62600c77d72e00a6992f92 tree.h
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
+802b01b0349f6aa04cb02f78d01312921bc13f41b5acb88862a23b357e1706c6 getent
diff --git a/core/musl/files/getent b/core/musl/files/getent
new file mode 100755
index 00000000..145be4ba
--- /dev/null
+++ b/core/musl/files/getent
@@ -0,0 +1,107 @@
+#!/bin/sh
+# POSIX sh variant for getent.
+#
+# This is similar to NetBSD's C implementation for getent
+# but without support for enumeration. There is simply no
+# specification for getent. I have simply made functions
+# for databases I have found to be common with the Glibc
+# implementation and NetBSD implementation. So, enumeration
+# is not supported. I am not sure why that is even a feature.
+#
+# Glibc implementation basically 'cat's a formatted output
+# for everything if no arguments are given. NetBSD only does
+# that for passwd and group. I will be sticking with NetBSD
+# here.
+#
+#
+# Copyright (c) 2020 Cem Keylan
+#
+# Permission is hereby granted, free of charge, to any
+# person obtaining a copy of this software and associated
+# documentation files (the "Software"), to deal in the
+# Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute,
+# sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice
+# shall be included in all copies or substantial portions
+# of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+out() { printf '%s\n' "$@" ;}
+usage() {
+ out "usage: ${0##*/} [database] [key ...]" \
+ " database may be one of:" \
+ " ethers group hosts networks passwd"
+ exit "${1:-0}"
+}
+
+# We will be using this for all databases, so that we can
+# remove comments and empty lines. Removing lines make it
+# faster to parse the lines.
+rm_comment() { sed 's/#.*//g;/^$/d' "$@" ;}
+
+hosts() {
+ while read -r ip canon aliases; do
+ case "$1" in "$ip"|"$canon")
+ printf '%-16s %s %s\n' "$ip" "$canon" "$aliases"
+ return 0
+ esac
+ done
+}
+
+passwd() {
+ while read -r line; do
+ # The specification only checks for user name and UID.
+ case "$line" in "$1:"*|*:*:$1:*:*:*:*)
+ printf '%s\n' "$line"; return 0
+ esac
+ done
+}
+
+group() {
+ while read -r line; do
+ # The specification only checks for group name and GID.
+ case "$line" in "$1:"*|*:*:"$1":*)
+ printf '%s\n' "$line"; return 0
+ esac
+ done
+}
+
+ethers() {
+ while read -r mac host; do
+ [ "$1" ] && case "$1" in "$mac"|"$host")
+ printf '%-16s %s\n' "$mac" "$host"
+ return 0
+ esac
+ done
+}
+
+networks() {
+ while read -r alias ip; do
+ case "$1" in "$alias"|"$ip")
+ printf '%-16s %s\n' "$alias" "$ip"
+ return 0
+ esac
+ done
+}
+
+
+[ "$1" ] || usage
+database=$1; shift
+case "$database" in
+ passwd|group) [ "$1" ] || rm_comment "/etc/$database" ;;
+ ethers|networks|hosts) ;;
+ *) out "error: Unknown database '$database'"; usage 1 ;;
+esac
+for key do rm_comment "/etc/$database" | "$database" "$key"; done
diff --git a/core/musl/sources b/core/musl/sources
index 502f8461..e09d2941 100644
--- a/core/musl/sources
+++ b/core/musl/sources
@@ -3,3 +3,4 @@ files/cdefs.h
files/queue.h
files/tree.h
files/getconf.c
+files/getent
diff --git a/core/musl/version b/core/musl/version
index 8b9a47f0..9d7d10ab 100644
--- a/core/musl/version
+++ b/core/musl/version
@@ -1 +1 @@
-1.2.0 1
+1.2.0 2