#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=mkinitcpio-busybox
pkgver=1.35.0
pkgrel=02
pkgdesc='Base initramfs tools'
arch=(x86_64)
url="https://www.busybox.net/"
depends=(glibc libxcrypt)
options=(!buildflags)
source=(https://busybox.net/downloads/busybox-$pkgver.tar.bz2{,.sig}
        config)

prepare() {
  cd "busybox-$pkgver"
  
  local safeflags="-march=${CARCH/_/-} -mtune=generic -Os -pipe -fno-strict-aliasing"

  # use make oldconfig for updating the config file
  sed 's|^\(CONFIG_EXTRA_CFLAGS\)=.*|\1="'"$safeflags"'"|' "$srcdir/config" > .config
}

build() {
  # reproducible build
  export KCONFIG_NOTIMESTAMP=1
  make -C "busybox-$pkgver"
}

package() {
  install -Dm755 "$srcdir/busybox-$pkgver/busybox" "$pkgdir/usr/lib/initcpio/busybox"
}

#---- license gpg-key sha256sums ----

license=(GPL)

validpgpkeys=('C9E9416F76E610DBD09D040F47B70C55ACC9965B') # Denis Vlasenko <vda.linux@googlemail.com>

sha256sums=(faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694 # busybox-1.35.0.tar.bz2
	c85450ac2bf121ca30585304145e7088cd6c2aecfb2a85448d1a7586fd32039b # busybox-1.35.0.tar.bz2.sig
	fe7bd3c7150c25a8ad24190d305a012b84766f34847a7efc7126e19261b0c711) #  config

