pkgname=bcachefs pkgver=20241025 pkgrel=1 arch=('x86_64') depends=('dkms') license=('GPL2') options=('!strip') provides=("BCACHEFS-MODULE=$pkgver") source=('dkms.conf' 'Makefile' 'compat.h' 'fix-kernel-6.11.patch') sha256sums=('a5e55374ea5966e8304b6436dc1512588a898974b3b0f9acb189342323f826cf' 'd7fa983a3a03a68974ffbc5c96a0c9c7978e2b4001c2305896ba8085c772aa43' '1f3cdd4f85b0a47c80e930c238840de9f6505c1f8c3e3d1ae6333bebb6ebaa73' 'eaed621c99e1af0bba60f4530c4e2d9e29505648b8ff4d23a5d02e9fea90c220') pkgver() { cd bcachefs git --no-pager log -1 --pretty='format:%cd' --date='format:%Y%m%d' } prepare() { sed -i -e "s/@PACKAGE_VERSION@/$pkgver/g" "$srcdir/dkms.conf" rm -rf bcachefs git clone -n --depth=1 --filter=tree:0 https://github.com/koverstreet/bcachefs.git -b bcachefs-for-upstream cd bcachefs git sparse-checkout set --no-cone fs/bcachefs git checkout git apply "$srcdir"/*.patch for i in fs/bcachefs/{fs.c,rcu_pending.c,six.c,journal.c}; do sed -i '/#include[^\n]*/,$!b;//{x;//p;g};//!H;$!d;x;s//&\n#include "compat.h"/' $i done cp ../compat.h "$srcdir"/bcachefs/fs/bcachefs/ } package() { install -Dm644 "$srcdir/Makefile" "$pkgdir/usr/src/$pkgname-$pkgver/Makefile" install -Dm644 "$srcdir/dkms.conf" "$pkgdir/usr/src/$pkgname-$pkgver/dkms.conf" install -d -Dm755 "$pkgdir/usr/src/$pkgname-$pkgver/src/fs/bcachefs" install -m644 -t "$pkgdir/usr/src/$pkgname-$pkgver/src/fs/bcachefs" "$srcdir/$pkgname/fs/bcachefs"/* sed -i 's/$(CONFIG_BCACHEFS_FS)/m/g' "$pkgdir/usr/src/$pkgname-$pkgver/src/fs/bcachefs/Makefile" sed -i "s%^#define TRACE_INCLUDE_PATH \\.\\./\\.\\./fs/bcachefs\$%#define TRACE_INCLUDE_PATH /usr/src/$pkgname-$pkgver/src/fs/bcachefs%" "$pkgdir/usr/src/$pkgname-$pkgver/src/fs/bcachefs/trace.h" }