# Contributor: Jan Alexander Steffens (heftig) # Maintainer: Luna D. Dragon (nullrequest) # Maintainer: memchr # shellcheck disable=SC2034,SC1091,SC2148,SC2155,SC2154 # Use build.conf to override default build options source default.conf || { echo "needs default.conf"; exit 1; } [[ -e options.conf ]] && source options.conf echo -e "\ :: The build and source options can be configurated with options.conf, see default.conf for the available options and their defaults" 1>&2 ####### pkgbase="${_kernel_name}" pkgver=6.7.2.arch1 pkgrel=1 pkgdesc='Linux' _srctag=v${pkgver%.*}-${pkgver##*.} url="https://github.com/archlinux/linux/commits/$_srctag" arch=(x86_64) license=(GPL2) makedepends=( bc cpio gettext git libelf pahole perl python tar xz ) (( _use_clang )) && \ makedepends+=( clang llvm lld ) (( _build_docs )) && \ makedepends+=( graphviz imagemagick python-sphinx texlive-latexextra ) options=('!strip') if (( _use_tarball)); then _srcname="linux-${pkgver%.*}-${pkgver##*.}" source=( "https://github.com/archlinux/linux/archive/refs/tags/${_srctag}.tar.gz" ) else _srcname="archlinux-linux" source=( "$_srcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag" ) fi source+=(config) # the main kernel config file validpgpkeys=( ABAF11C65A2970B130ABE3C479BE3E4300411886 # Linus Torvalds 647F28654894E3BD457199BE38DBBDC86092693E # Greg Kroah-Hartman A2FF3A36AAA56654109064AB19802F8B0D70FC30 # Jan Alexander Steffens (heftig) ) b2sums=('SKIP' 'SKIP') ## update pkgver and pkgrel pkgver="${_pkgver:-$pkgver}" pkgrel="${_pkgrel:-$pkgrel}" ## Kernel optitmization _kcflags=( "$_optimization" "-pipe" ) if [[ -n "$_march" ]]; then _kcflags+=(-march="$_march") fi ## ccache if command -v ccache > /dev/null; then export CCACHE_NOHASHDIR=1 export CCACHE_BASEDIR="$PWD/src/$_srcname" _kcflags+=(-fdebug-prefix-map=$PWD/src/$_srcname=.) fi if (( _use_ccache )) && [[ -d /usr/lib/ccache ]]; then export PATH="/usr/lib/ccache/bin:$PATH" fi ## build information echo -n "\ :: Source Options Source Type = $( ((_use_tarball)) && echo tarball || echo git) :: Build Options Kernel Name = $_kernel_name pkgver = $pkgver pkgrel = $pkgrel Compiler = $( ((_use_clang)) && echo clang || echo gcc ) LTO = $( ((_use_clang)) && echo thin || echo none ) KCFLAGS = \"${_kcflags[@]}\" Build docs = $( (( _build_docs )) && echo yes || echo no ) Make jobs = $_make_jobs ccache = $( (( _use_ccache )) && echo yes || echo no ) " 1>&2 _buildinfo="$_optimization target:$([[ -n $_march ]] && echo $_march || echo generic) compiler:$( ((_use_clang)) && echo clang )" ## export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" _make() { test -s version make -j "$_make_jobs" LLVM="$_use_clang" LLVM_IAS="$_use_clang" KCFLAGS="${_kcflags[*]}" KERNELRELEASE="$( localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname make defconfig make -s kernelrelease > version make mrproper local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" [[ $src = *.patch ]] || continue echo "Applying patch $src..." patch -Np1 < "../$src" done echo "Setting config..." cp ../config .config # Enable LTO for clang build if (( _use_clang )); then scripts/config \ -d LTO_NONE \ -e HAS_LTO_CLANG \ -e LTO_CLANG_THIN fi if (( _use_menuconfig )); then _make menuconfig else _make olddefconfig fi diff -u ../config .config || : echo "Prepared $pkgbase version $(