summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 88c09546447401215f6b45f5521c3c69012f2b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Maintainer: kj_sh604 <406hs_jk@proton.me>

pkgname=coreutils-uutils
pkgver=0.1.0
pkgrel=4
pkgdesc='Cross-platform Rust rewrite of the GNU coreutils installed as system
core utilities (WARNING: use at own risk).'
arch=('x86_64')
license=('MIT')
url='https://github.com/uutils/coreutils'
conflicts=(
  coreutils
  b3sum
  sha3sum
)
provides=(
  coreutils
  b3sum
  sha3sum
)
depends=(
  gcc-libs
  glibc
  oniguruma
)
makedepends=(
  cargo
  clang
  python-sphinx
  rust
)
source=("uutils-coreutils-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
         disable_selinux.patch
         build-stty.patch)
sha256sums=('55c528f2b53c1b30cb704550131a806e84721c87b3707b588a961a6c97f110d8'
            '302614165d99f04600627222ddad0444a0144fcad6a1ff59ad43fb0b3162060e'
            '0bd635cc349cfe133ddad0b1d05256c023b46f4a30f81aee123100119762df8e')

prepare() {
  cd ${pkgname%-uutils}-${pkgver}
  patch -Np1 -i $srcdir/disable_selinux.patch
  patch -Np1 -i $srcdir/build-stty.patch

}

package() {
  cd ${pkgname%-uutils}-${pkgver}
  export RUSTONIG_DYNAMIC_LIBONIG=1
  make install \
      DESTDIR="$pkgdir" \
      PREFIX=/usr \
      MANDIR=/share/man/man1 \
      PROG_PREFIX= \
      PROFILE=release \
      MULTICALL=y \
      SKIP_UTILS="hostname kill more uptime"
  # add libstdbuf.so
  mkdir -p $pkgdir/usr/lib/coreutils
  cd $srcdir && cd ${pkgname%-uutils}-${pkgver}/target/release/deps
  mv liblibstdbuf.so $pkgdir/usr/lib/coreutils/libstdbuf.so
  # clean conflicts (arch ships these in the bash-completion package)
  rm $pkgdir/usr/share/bash-completion/completions/*
  # symlink missing binaries
  cd $pkgdir/usr/bin
  if [ -f "coreutils" ]; then
    local binaries=(
      "b2sum" "b3sum" "md5sum" "sha1sum" "sha224sum" "sha256sum" "sha3-224sum"
      "sha3-256sum" "sha3-384sum" "sha3-512sum" "sha384sum" "sha3sum"
      "sha512sum" "shake128sum" "shake256sum"
    )
    for bin in "${binaries[@]}"; do
      ln -s coreutils "$bin" || echo "warning: failed to create symlink for $bin"
    done
  else
    echo "coreutils binary not found, skipping symlink creation."
  fi

  # create dummy shell scripts for chcon and runcon
  install -m 755 <(echo "#!/bin/sh
echo \"warning: chcon is no longer built with the coreutils-uutils package\"
exit 1") $pkgdir/usr/bin/chcon
  install -m 755 <(echo "#!/bin/sh
echo \"warning: runcon is no longer built with the coreutils-uutils package\"
exit 1") $pkgdir/usr/bin/runcon
}

# vim: ts=2 sw=2 et: