490 lines
15 KiB
Bash
490 lines
15 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
component_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
. "$component_dir/common.sh"
|
|
|
|
patch -d "$source_build_dir/tcsh-TCSH6_24_16" -p1 \
|
|
<"$repo_dir/base/patches/tcsh-gethost-native.patch"
|
|
patch -d "$source_build_dir/chimerautils-15.0.3" -p1 \
|
|
<"$repo_dir/base/patches/chimerautils-native-cdefs.patch"
|
|
patch -d "$source_build_dir/chimerautils-15.0.3" -p1 \
|
|
<"$repo_dir/base/patches/chimerautils-scanflike.patch"
|
|
|
|
(
|
|
cd "$source_build_dir/tcsh-TCSH6_24_16"
|
|
CC="$cc" \
|
|
LIBS="-lcurses -lterminfo" \
|
|
./configure \
|
|
--build="$build_triplet" \
|
|
--host=x86_64-linux-musl \
|
|
--prefix=/usr \
|
|
--bindir=/bin \
|
|
--disable-nls-catalogs
|
|
make -j"$jobs"
|
|
install -m 0755 tcsh "$base_root/bin/tcsh"
|
|
)
|
|
|
|
util_linux_build="$source_build_dir/util-linux-build"
|
|
install -d -m 0755 "$util_linux_build"
|
|
(
|
|
cd "$util_linux_build"
|
|
CC="$cc" \
|
|
AR="$ar" \
|
|
RANLIB="$ranlib" \
|
|
CFLAGS="-O2" \
|
|
LDFLAGS="-static" \
|
|
PKG_CONFIG="$tools_dir/bin/pkgconf" \
|
|
PKG_CONFIG_LIBDIR="$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig" \
|
|
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
|
|
"$source_build_dir/util-linux-2.42.2/configure" \
|
|
--build="$build_triplet" \
|
|
--host=x86_64-linux-musl \
|
|
--prefix=/usr \
|
|
--disable-shared \
|
|
--enable-static \
|
|
--disable-nls \
|
|
--disable-all-programs \
|
|
--enable-libuuid \
|
|
--enable-libblkid \
|
|
--enable-libmount \
|
|
--enable-libsmartcols \
|
|
--enable-libfdisk \
|
|
--enable-agetty \
|
|
--enable-nologin \
|
|
--enable-setsid \
|
|
--enable-mount \
|
|
--enable-blkid \
|
|
--enable-fdisks \
|
|
--enable-losetup \
|
|
--enable-wipefs \
|
|
--enable-swapon \
|
|
--enable-lsblk \
|
|
--enable-findmnt \
|
|
--enable-flock \
|
|
--enable-dmesg \
|
|
--enable-static-programs=blkid,fdisk,losetup,mount,sfdisk,umount
|
|
make -s -j"$jobs" \
|
|
agetty nologin setsid mount umount blkid fdisk sfdisk losetup \
|
|
wipefs swapon swapoff lsblk findmnt flock dmesg
|
|
)
|
|
install_util_linux() {
|
|
command=$1
|
|
destination=$2
|
|
binary=$(find "$util_linux_build" -type f -name "$command" -perm -0100 -print | head -1)
|
|
if [ -z "$binary" ]; then
|
|
printf '%s\n' "missing util-linux build output: $command" >&2
|
|
exit 1
|
|
fi
|
|
install -m 0755 "$binary" "$destination"
|
|
}
|
|
install_util_linux agetty "$base_root/sbin/agetty"
|
|
install_util_linux nologin "$base_root/sbin/nologin"
|
|
install_util_linux setsid "$base_root/usr/bin/setsid"
|
|
install_util_linux mount "$base_root/sbin/mount"
|
|
install_util_linux umount "$base_root/sbin/umount"
|
|
install_util_linux blkid "$base_root/sbin/blkid"
|
|
install_util_linux fdisk "$base_root/sbin/fdisk"
|
|
install_util_linux sfdisk "$base_root/sbin/sfdisk"
|
|
install_util_linux losetup "$base_root/sbin/losetup"
|
|
install_util_linux wipefs "$base_root/sbin/wipefs"
|
|
install_util_linux swapon "$base_root/sbin/swapon"
|
|
install_util_linux swapoff "$base_root/sbin/swapoff"
|
|
install_util_linux lsblk "$base_root/usr/bin/lsblk"
|
|
install_util_linux findmnt "$base_root/usr/bin/findmnt"
|
|
install_util_linux flock "$base_root/usr/bin/flock"
|
|
install_util_linux dmesg "$base_root/sbin/dmesg"
|
|
|
|
chimerautils_build="$source_build_dir/chimerautils-15.0.3/build"
|
|
PKG_CONFIG_LIBDIR="$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig" \
|
|
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
|
|
python3 "$meson_source" setup \
|
|
"$chimerautils_build" \
|
|
"$source_build_dir/chimerautils-15.0.3" \
|
|
--cross-file="$cross_file" \
|
|
--prefix=/usr \
|
|
--buildtype=release \
|
|
-Dopenssl=enabled \
|
|
-Dlibedit=disabled \
|
|
-Dzlib=disabled \
|
|
-Dlzma=disabled \
|
|
-Dbzip2=disabled \
|
|
-Dzstd=disabled \
|
|
-Dpam=disabled \
|
|
-Dselinux=disabled \
|
|
-Dchimera_realpath=disabled
|
|
|
|
commands="
|
|
awk basename cat chmod chown chroot cksum cmp col colrm column comm
|
|
cp csplit cut date dd df diff diff3 dirname du echo env expand expr false
|
|
ed fetch find fmt fold gencat getopt grep head hexdump hostname id join kill
|
|
ln logger logname ls m4 md5 mesg mkdir mkfifo mknod mktemp mv nc nice nl nohup
|
|
nproc paste patch pathchk pr printenv printf pwd realpath renice rev rm rmdir script
|
|
sdiff sed seq sh sleep sort split stat stty sync tail tee time timeout touch tr true
|
|
truncate tsort tty ul uname unexpand uniq users vis wc whereis which who xargs yes
|
|
vi
|
|
"
|
|
|
|
targets="
|
|
src.freebsd/awk/awk
|
|
src.freebsd/coreutils/basename/basename
|
|
src.freebsd/coreutils/cat/cat
|
|
src.freebsd/coreutils/chmod/chmod
|
|
src.freebsd/coreutils/chown/chown
|
|
src.freebsd/coreutils/chroot/chroot
|
|
src.freebsd/coreutils/cksum/cksum
|
|
src.freebsd/diffutils/cmp/cmp
|
|
src.freebsd/miscutils/col/col
|
|
src.freebsd/miscutils/colrm/colrm
|
|
src.freebsd/miscutils/column/column
|
|
src.freebsd/coreutils/comm/comm
|
|
src.freebsd/coreutils/cp/cp
|
|
src.freebsd/coreutils/csplit/csplit
|
|
src.freebsd/coreutils/cut/cut
|
|
src.freebsd/coreutils/date/date
|
|
src.freebsd/coreutils/dd/dd
|
|
src.freebsd/coreutils/df/df
|
|
src.freebsd/diffutils/diff/diff
|
|
src.freebsd/diffutils/diff3/diff3
|
|
src.freebsd/coreutils/dirname/dirname
|
|
src.freebsd/coreutils/du/du
|
|
src.freebsd/ed/ed
|
|
src.freebsd/coreutils/echo/echo
|
|
src.freebsd/coreutils/env/env
|
|
src.freebsd/coreutils/expand/expand
|
|
src.freebsd/coreutils/expr/expr
|
|
src.freebsd/coreutils/false/false
|
|
src.freebsd/fetch/fetch
|
|
src.freebsd/findutils/find/find
|
|
src.freebsd/coreutils/fmt/fmt
|
|
src.freebsd/coreutils/fold/fold
|
|
src.freebsd/gencat/gencat
|
|
src.freebsd/miscutils/getopt/getopt
|
|
src.freebsd/grep/grep
|
|
src.freebsd/coreutils/head/head
|
|
src.freebsd/miscutils/hexdump/hexdump
|
|
src.freebsd/coreutils/hostname/hostname
|
|
src.freebsd/coreutils/id/id
|
|
src.freebsd/coreutils/join/join
|
|
src.freebsd/miscutils/kill/kill
|
|
src.freebsd/coreutils/ln/ln
|
|
src.freebsd/miscutils/logger/logger
|
|
src.freebsd/coreutils/logname/logname
|
|
src.freebsd/coreutils/ls/ls
|
|
src.freebsd/m4/m4
|
|
src.freebsd/coreutils/md5/md5
|
|
src.freebsd/miscutils/mesg/mesg
|
|
src.freebsd/coreutils/mkdir/mkdir
|
|
src.freebsd/coreutils/mkfifo/mkfifo
|
|
src.freebsd/coreutils/mknod/mknod
|
|
src.freebsd/coreutils/mktemp/mktemp
|
|
src.freebsd/coreutils/mv/mv
|
|
src.freebsd/netcat/nc
|
|
src.freebsd/coreutils/nice/nice
|
|
src.freebsd/coreutils/nl/nl
|
|
src.freebsd/coreutils/nohup/nohup
|
|
src.freebsd/coreutils/nproc/nproc
|
|
src.freebsd/nvi/vi
|
|
src.freebsd/coreutils/paste/paste
|
|
src.freebsd/patch/patch
|
|
src.freebsd/coreutils/pathchk/pathchk
|
|
src.freebsd/coreutils/pr/pr
|
|
src.freebsd/coreutils/printenv/printenv
|
|
src.freebsd/coreutils/printf/printf
|
|
src.freebsd/coreutils/pwd/pwd
|
|
src.freebsd/coreutils/realpath/realpath
|
|
src.freebsd/miscutils/renice/renice
|
|
src.freebsd/miscutils/rev/rev
|
|
src.freebsd/coreutils/rm/rm
|
|
src.freebsd/coreutils/rmdir/rmdir
|
|
src.freebsd/miscutils/script/script
|
|
src.freebsd/diffutils/sdiff/sdiff
|
|
src.freebsd/sed/sed
|
|
src.freebsd/coreutils/seq/seq
|
|
src.freebsd/sh/sh
|
|
src.freebsd/coreutils/sleep/sleep
|
|
src.freebsd/coreutils/sort/sort
|
|
src.freebsd/coreutils/split/split
|
|
src.freebsd/coreutils/stat/stat
|
|
src.freebsd/coreutils/stty/stty
|
|
src.freebsd/coreutils/sync/sync
|
|
src.freebsd/coreutils/tail/tail
|
|
src.freebsd/coreutils/tee/tee
|
|
src.freebsd/miscutils/time/time
|
|
src.freebsd/coreutils/timeout/timeout
|
|
src.freebsd/coreutils/touch/touch
|
|
src.freebsd/coreutils/tr/tr
|
|
src.freebsd/coreutils/true/true
|
|
src.freebsd/coreutils/truncate/truncate
|
|
src.freebsd/coreutils/tsort/tsort
|
|
src.freebsd/coreutils/tty/tty
|
|
src.freebsd/miscutils/ul/ul
|
|
src.freebsd/coreutils/uname/uname
|
|
src.freebsd/coreutils/unexpand/unexpand
|
|
src.freebsd/coreutils/uniq/uniq
|
|
src.freebsd/coreutils/users/users
|
|
src.freebsd/vis/vis
|
|
src.freebsd/coreutils/wc/wc
|
|
src.freebsd/miscutils/whereis/whereis
|
|
src.freebsd/which/which
|
|
src.freebsd/coreutils/who/who
|
|
src.freebsd/findutils/xargs/xargs
|
|
src.freebsd/coreutils/yes/yes
|
|
src.freebsd/coreutils/xinstall/xinstall
|
|
src.freebsd/coreutils/test/xtest
|
|
"
|
|
|
|
PKG_CONFIG_LIBDIR="$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig" \
|
|
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
|
|
python3 "$meson_source" compile -C "$chimerautils_build" $targets
|
|
|
|
for command in $commands; do
|
|
binary=$(find "$chimerautils_build" -type f -name "$command" -perm -0100 -print | head -1)
|
|
if [ -z "$binary" ]; then
|
|
printf '%s\n' "missing ChimeraUtils build output: $command" >&2
|
|
exit 1
|
|
fi
|
|
destination="$base_root/usr/bin"
|
|
case "$command" in
|
|
cat|chmod|chown|cp|date|dd|df|echo|hostname|kill|ln|ls|mkdir|mv|pwd|rm|rmdir|sed|sh|sleep|stty|sync|touch|uname)
|
|
destination="$base_root/bin"
|
|
;;
|
|
esac
|
|
install -m 0755 "$binary" "$destination/$command"
|
|
done
|
|
|
|
ln -s chown "$base_root/bin/chgrp"
|
|
ln -s vi "$base_root/usr/bin/nvi"
|
|
ln -s vi "$base_root/usr/bin/view"
|
|
|
|
(
|
|
cd "$source_build_dir/procps-ng-4.0.5"
|
|
CC="$cc" \
|
|
AR="$ar" \
|
|
RANLIB="$ranlib" \
|
|
ac_cv_func_malloc_0_nonnull=yes \
|
|
ac_cv_func_realloc_0_nonnull=yes \
|
|
LDFLAGS="-static" \
|
|
PKG_CONFIG="$tools_dir/bin/pkgconf" \
|
|
PKG_CONFIG_LIBDIR="$sysroot/usr/lib/pkgconfig" \
|
|
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
|
|
./configure \
|
|
--build="$build_triplet" \
|
|
--host=x86_64-linux-musl \
|
|
--prefix=/usr \
|
|
--disable-shared \
|
|
--enable-static \
|
|
--disable-nls \
|
|
--disable-pidof \
|
|
--disable-pidwait \
|
|
--disable-kill \
|
|
--disable-w \
|
|
--disable-numa \
|
|
--without-systemd \
|
|
--without-elogind
|
|
make -s -j"$jobs" \
|
|
src/ps/pscommand \
|
|
src/pgrep \
|
|
src/pkill \
|
|
src/top/top \
|
|
src/free \
|
|
src/uptime \
|
|
src/vmstat \
|
|
src/watch \
|
|
src/sysctl
|
|
install -m 0755 src/ps/pscommand "$base_root/bin/ps"
|
|
install -m 0755 src/pgrep "$base_root/usr/bin/pgrep"
|
|
install -m 0755 src/pkill "$base_root/usr/bin/pkill"
|
|
install -m 0755 src/top/top "$base_root/usr/bin/top"
|
|
install -m 0755 src/free "$base_root/usr/bin/free"
|
|
install -m 0755 src/uptime "$base_root/usr/bin/uptime"
|
|
install -m 0755 src/vmstat "$base_root/usr/bin/vmstat"
|
|
install -m 0755 src/watch "$base_root/usr/bin/watch"
|
|
install -m 0755 src/sysctl "$base_root/sbin/sysctl"
|
|
)
|
|
|
|
iputils_build="$source_build_dir/iputils-20250605/build"
|
|
PKG_CONFIG_LIBDIR="$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig" \
|
|
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
|
|
python3 "$meson_source" setup \
|
|
"$iputils_build" \
|
|
"$source_build_dir/iputils-20250605" \
|
|
--cross-file="$cross_file" \
|
|
--prefix=/usr \
|
|
--buildtype=release \
|
|
--default-library=static \
|
|
-DUSE_CAP=false \
|
|
-DUSE_IDN=false \
|
|
-DUSE_GETTEXT=false \
|
|
-DBUILD_ARPING=false \
|
|
-DBUILD_CLOCKDIFF=false \
|
|
-DBUILD_TRACEPATH=false \
|
|
-DBUILD_MANS=false \
|
|
-DSKIP_TESTS=true
|
|
python3 "$meson_source" compile -C "$iputils_build" ping
|
|
install -m 4755 "$iputils_build/ping/ping" "$base_root/bin/ping"
|
|
|
|
(
|
|
cd "$source_build_dir/cronie-1.7.2"
|
|
CC="$cc" \
|
|
AR="$ar" \
|
|
RANLIB="$ranlib" \
|
|
LDFLAGS="-static" \
|
|
./configure \
|
|
--build="$build_triplet" \
|
|
--host=x86_64-linux-musl \
|
|
--prefix=/usr \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var \
|
|
--runstatedir=/run \
|
|
--disable-anacron \
|
|
--without-pam \
|
|
--without-selinux \
|
|
--without-audit
|
|
make -s -j"$jobs"
|
|
install -m 0755 src/crond "$base_root/usr/sbin/cron"
|
|
install -m 4755 src/crontab "$base_root/usr/bin/crontab"
|
|
)
|
|
|
|
(
|
|
cd "$source_build_dir/openntpd-7.9p1"
|
|
CC="$cc" \
|
|
AR="$ar" \
|
|
RANLIB="$ranlib" \
|
|
YACC=byacc \
|
|
LDFLAGS="-static" \
|
|
./configure \
|
|
--build="$build_triplet" \
|
|
--host=x86_64-linux-musl \
|
|
--prefix=/usr \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var \
|
|
--runstatedir=/run \
|
|
--with-privsep-user=_ntp \
|
|
--disable-https-constraint \
|
|
--disable-shared \
|
|
--enable-static
|
|
make -s -j"$jobs" -C compat
|
|
make -s -j"$jobs" -C src ntpd
|
|
install -m 0755 src/ntpd "$base_root/usr/sbin/ntpd"
|
|
ln -s ntpd "$base_root/usr/sbin/ntpctl"
|
|
)
|
|
|
|
(
|
|
cd "$source_build_dir/sysklogd-2.7.2"
|
|
CC="$cc" \
|
|
AR="$ar" \
|
|
RANLIB="$ranlib" \
|
|
LDFLAGS="-static" \
|
|
PKG_CONFIG="$tools_dir/bin/pkgconf" \
|
|
./configure \
|
|
--build="$build_triplet" \
|
|
--host=x86_64-linux-musl \
|
|
--prefix=/usr \
|
|
--sysconfdir=/etc \
|
|
--runstatedir=/run \
|
|
--disable-shared \
|
|
--enable-static \
|
|
--without-logger \
|
|
--with-systemd=no
|
|
make -s -j"$jobs" -C src syslogd
|
|
install -m 0755 src/syslogd "$base_root/usr/sbin/syslogd"
|
|
)
|
|
|
|
(
|
|
cd "$source_build_dir/skalibs-2.15.1.0"
|
|
CC="$cc" AR="$ar" RANLIB="$ranlib" ./configure \
|
|
--prefix=/usr \
|
|
--build="$build_triplet" \
|
|
--target=x86_64-linux-musl \
|
|
--with-include="$sysroot/usr/include" \
|
|
--with-lib="$sysroot/usr/lib" \
|
|
--with-sysdep-devurandom=yes \
|
|
--with-sysdep-posixspawnearlyreturn=no \
|
|
--with-sysdep-procselfexe=/proc/self/exe \
|
|
--with-sysdep-selectinfinite=yes \
|
|
--disable-shared
|
|
make -s -j"$jobs" CC="$cc" AR="$ar" RANLIB="$ranlib"
|
|
make -s DESTDIR="$sysroot" install
|
|
)
|
|
|
|
(
|
|
cd "$source_build_dir/mdevd-0.1.8.2"
|
|
CC="$cc" AR="$ar" RANLIB="$ranlib" ./configure \
|
|
--prefix=/usr \
|
|
--build="$build_triplet" \
|
|
--target=x86_64-linux-musl \
|
|
--with-sysdeps="$sysroot/usr/lib/skalibs/sysdeps" \
|
|
--with-include="$sysroot/usr/include" \
|
|
--with-lib="$sysroot/usr/lib" \
|
|
--enable-static-libc \
|
|
--disable-shared
|
|
make -s -j"$jobs" CC="$cc" AR="$ar" RANLIB="$ranlib"
|
|
install -m 0755 mdevd "$base_root/sbin/mdevd"
|
|
install -m 0755 mdevd-coldplug "$base_root/sbin/mdevd-coldplug"
|
|
)
|
|
|
|
kmod_build="$source_build_dir/kmod-34.2/build"
|
|
PKG_CONFIG_LIBDIR="$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig" \
|
|
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
|
|
python3 "$meson_source" setup \
|
|
"$kmod_build" \
|
|
"$source_build_dir/kmod-34.2" \
|
|
--cross-file="$cross_file" \
|
|
--prefix=/usr \
|
|
--buildtype=release \
|
|
--default-library=static \
|
|
-Dzstd=disabled \
|
|
-Dxz=disabled \
|
|
-Dzlib=disabled \
|
|
-Dopenssl=disabled \
|
|
-Dmanpages=false \
|
|
-Ddocs=false \
|
|
-Dbuild-tests=false
|
|
python3 "$meson_source" compile -C "$kmod_build" kmod:executable
|
|
install -m 0755 "$kmod_build/kmod" "$base_root/sbin/kmod"
|
|
for command in depmod insmod lsmod modinfo modprobe rmmod; do
|
|
ln -s kmod "$base_root/sbin/$command"
|
|
done
|
|
|
|
(
|
|
cd "$source_build_dir/openssl-3.5.7"
|
|
make -s distclean
|
|
CC="$cc" \
|
|
AR="$ar" \
|
|
RANLIB="$ranlib" \
|
|
./Configure \
|
|
linux-x86_64 \
|
|
--prefix=/usr \
|
|
--libdir=lib \
|
|
--openssldir=/etc/ssl \
|
|
no-afalgeng \
|
|
no-docs \
|
|
no-dso \
|
|
no-module \
|
|
no-secure-memory \
|
|
no-shared \
|
|
no-tests
|
|
make -s -j"$jobs" build_generated
|
|
make -s depend
|
|
make -s -j"$jobs" apps/openssl
|
|
install -m 0755 apps/openssl "$base_root/usr/bin/openssl"
|
|
)
|
|
|
|
install -m 0755 \
|
|
"$chimerautils_build/src.freebsd/coreutils/xinstall/xinstall" \
|
|
"$base_root/usr/bin/install"
|
|
install -m 0755 \
|
|
"$chimerautils_build/src.freebsd/coreutils/test/xtest" \
|
|
"$base_root/usr/bin/test"
|
|
|
|
ln -s test "$base_root/usr/bin/["
|
|
ln -s install "$base_root/usr/bin/binstall"
|
|
ln -s id "$base_root/usr/bin/groups"
|
|
ln -s id "$base_root/usr/bin/whoami"
|
|
ln -s md5 "$base_root/usr/bin/sha256"
|
|
ln -s stat "$base_root/usr/bin/readlink"
|
|
|
|
install -m 0755 "$sysroot/usr/bin/tput" "$base_root/usr/bin/tput"
|
|
ln -s tcsh "$base_root/bin/csh"
|