#!/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.36.1
pkgrel=01
pkgdesc='Base initramfs tools'
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"
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=(GPL)

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

sha256sums=(b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314  # busybox-1.36.1.tar.bz2
	7b1dc3e59fa767c0e0b216ffacb070b3587607655dfa0336ccf41a48ae32c3c1  # busybox-1.36.1.tar.bz2.sig
	f1a67ecda5b73a50e49953efaaa0be582e4b707cf5a6270519e28ee022098518) # config

##  e04ec1696c8c7dbebb6bade02c6d8a518c8e8d1a6a51f7a283290a806a90e088  mkinitcpio-busybox-1.36.1-01-x86_64.pkg.tar.lz

