2023-02-22 08:31:38 +01:00
|
|
|
#!/bin/ksh -xe
|
|
|
|
umask 022
|
|
|
|
|
|
|
|
JOBS="${JOBS:=$(sysctl -n hw.ncpuonline)}"
|
|
|
|
|
2023-04-30 14:17:33 +02:00
|
|
|
export GLOBAL_AUTOCONF_CACHE="/var/ccache/config.cache"
|
|
|
|
export CCACHE_DIR="/var/ccache"
|
|
|
|
export CCACHE_SLOPPINESS="locale,time_macros,random_seed"
|
2023-10-21 14:13:07 +02:00
|
|
|
export CCACHE_MAXSIZE=60G
|
|
|
|
export CCACHE_NOHASHDIR=
|
2023-04-30 14:17:33 +02:00
|
|
|
|
|
|
|
# base llvm?
|
|
|
|
export LLVM_CCACHE_BUILD=1
|
|
|
|
export LLVM_CCACHE_DIR="/var/ccache"
|
|
|
|
export CMAKE_CXX_COMPILER_LAUNCHER="ccache"
|
|
|
|
export CMAKE_C_COMPILER_LAUNCHER="ccache"
|
|
|
|
|
2023-10-30 20:13:00 +01:00
|
|
|
FLAGS="-fno-stack-protector -fno-ret-protector -mno-retpoline -O3 -pipe -march=native -mmmx -msse -msse2 -msse3 -msse4 -m3dnow "
|
2023-04-30 14:17:33 +02:00
|
|
|
export CC="/opt/ccache/bin/cc $FLAGS"
|
|
|
|
export CXX="/opt/ccache/bin/c++ $FLAGS"
|
2023-02-22 08:31:38 +01:00
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Usage: ${0} [kernel, base, xenocara, release, all] [clean]"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
doas mkdir -p /usr/obj /usr/xobj
|
|
|
|
doas chown build /usr/obj /usr/xobj
|
|
|
|
|
|
|
|
mkkernel() {
|
|
|
|
set -xe
|
|
|
|
cd /sys/arch/$(machine)/compile/GENERIC.MP
|
|
|
|
doas make clean
|
|
|
|
doas make obj
|
|
|
|
doas make config
|
|
|
|
time doas -u build make -j${JOBS}
|
|
|
|
doas make install
|
2023-10-30 20:13:00 +01:00
|
|
|
doas what /bsd
|
|
|
|
doas ln -f /bsd.booted /bsd.backup
|
2023-02-22 08:31:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
mkbase() {
|
|
|
|
set -xe
|
|
|
|
cd /usr/src
|
|
|
|
doas make obj
|
|
|
|
doas make -j${JOBS} build
|
|
|
|
doas make install
|
|
|
|
doas sysmerge
|
|
|
|
cd /dev
|
|
|
|
doas ./MAKEDEV all
|
|
|
|
}
|
|
|
|
|
|
|
|
mkxenocara() {
|
|
|
|
set -xe
|
2023-09-12 22:25:33 +02:00
|
|
|
doas chown -R sdk /usr/xenocara
|
2023-02-22 08:31:38 +01:00
|
|
|
cd /usr/xenocara
|
|
|
|
doas make clean
|
|
|
|
doas make bootstrap
|
|
|
|
doas make obj
|
|
|
|
doas make -j${JOBS} build
|
|
|
|
doas make install
|
|
|
|
}
|
|
|
|
|
|
|
|
mkrelease() {
|
|
|
|
set -xe
|
|
|
|
doas mkdir -p /data/{OpenBSD,Release}
|
|
|
|
doas chown -R build /data
|
|
|
|
doas chmod -R 700 /data
|
|
|
|
|
|
|
|
export DESTDIR=/data/OpenBSD
|
|
|
|
export RELEASEDIR=/data/Release
|
|
|
|
export RELDIR=/data/Release
|
|
|
|
export RELXDIR=/data/Release
|
|
|
|
|
|
|
|
cd /usr/src/etc
|
|
|
|
doas make release
|
|
|
|
cd /usr/src/distrib/sets
|
|
|
|
doas sh checkflist
|
|
|
|
|
|
|
|
cd /usr/xenocara
|
|
|
|
doas make release
|
|
|
|
doas make checkdist
|
|
|
|
|
|
|
|
cd /usr/src/distrib/$(machine)/iso
|
|
|
|
doas make
|
|
|
|
doas make install
|
|
|
|
}
|
|
|
|
|
|
|
|
kernelclean() {
|
|
|
|
cd /usr/src && doas make clean
|
|
|
|
}
|
|
|
|
baseclean() {
|
|
|
|
doas rm -rf /usr/obj/{,.}*
|
|
|
|
}
|
|
|
|
xenocaraclean() {
|
|
|
|
doas rm -rf /usr/xobj/{,.}*
|
|
|
|
}
|
|
|
|
releaseclean() {
|
|
|
|
doas rm -rf /data/OpenBSD/{,.}*
|
|
|
|
doas rm -rf /data/Release/{,.}*
|
|
|
|
}
|
|
|
|
allclean() {
|
|
|
|
kernelclean
|
|
|
|
baseclean
|
|
|
|
xenocaraclean
|
|
|
|
releaseclean
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$2" == "clean" ]; then
|
|
|
|
case "$1" in
|
|
|
|
kernel) kernelclean; ;;
|
|
|
|
base) baseclean; ;;
|
|
|
|
xenocara) xenocaraclean; ;;
|
|
|
|
release) releaseclean; ;;
|
|
|
|
all) allclean; ;;
|
|
|
|
esac
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
kernel) mkkernel; ;;
|
|
|
|
base) mkbase; ;;
|
|
|
|
xenocara) mkxenocara; ;;
|
|
|
|
release) mkrelease; ;;
|
|
|
|
all) mkkernel; mkbase; mkxenocara; ;;
|
|
|
|
esac
|
|
|
|
sync
|