summaryrefslogtreecommitdiffstats
path: root/coreutils-uutils-kj_sh604/PKGBUILD
blob: f2a3d4d511d9f08be4989e0a748a86a730aa73a9 (plain) (blame)
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
# Maintainer: kj_sh604 <406hs_jk@proton.me>

pkgname=coreutils-uutils-kj_sh604
pkgver=0.7.0
pkgrel=1
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"
)
sha256sums=('dc56a3c4632742357d170d60a7dcecb9693de710daeaafa3ad925750b1905522')

# this line inside prepare does not work without clean build
export RUSTONIG_DYNAMIC_LIBONIG=1

package() {
  cd ${pkgname%-uutils-kj_sh604}-${pkgver}
  make install \
      DESTDIR="$pkgdir" \
      PREFIX=/usr \
      MANDIR=/share/man/man1 \
      LIBSTDBUF_DIR=/usr/lib/${pkgname%-uutils-kj_sh604} \
      PROG_PREFIX= \
      PROFILE=release \
      MULTICALL=y \
      SKIP_UTILS="hostname kill more uptime"
  # clean conflicts (arch ships these in the bash-completion package)
  rm $pkgdir/usr/share/bash-completion/completions/*
  # remove locales as a temporary workaround for uutils-coreutils conflict
  rm -r "$pkgdir/usr/share/locales" || {
    echo 'ERROR: SOMETHING VERY WRONG JUST HAPPENED'
    exit 1
  }
  # symlink missing binaries
  cd $pkgdir/usr/bin
  if [ -f "coreutils" ]; then
    local binaries=( "b3sum" "sha3-224sum" "sha3-256sum" "sha3-384sum"
      "sha3-512sum" "sha3sum" "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-kj_sh604 package\"
exit 1") $pkgdir/usr/bin/chcon
  install -m 755 <(echo "#!/bin/sh
echo \"warning: runcon is no longer built with the coreutils-uutils-kj_sh604 package\"
exit 1") $pkgdir/usr/bin/runcon
}

# vim: ts=2 sw=2 et: