# Maintainer: Mark Wagie # Co-Maintainer: Joost Bremmer # Contributor: Bogdan # Contributor: Quan Guo pkgname=cheat-git pkgver=4.2.1.r0.g1eb44e8 pkgrel=1 pkgdesc="Allows you to create and view interactive cheatsheets on the command-line" arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h') url="https://github.com/cheat/cheat" license=('MIT' 'CC0 1.0 Universal') makedepends=('git' 'go' 'pandoc') optdepends=('fzf: for Fuzzy Finder integration' 'bash-completion: for bash completions') provides=("${pkgname%-git}") conflicts=("${pkgname%-git}" "${pkgname%-git}-bash-git" "python-${pkgname%-git}") backup=("etc/${pkgname%-git}/conf.yml") source=('git+https://github.com/cheat/cheat.git' 'conf.yml' 'git+https://github.com/cheat/cheatsheets.git' "https://raw.githubusercontent.com/${pkgname%-git}/cheatsheets/master/.github/LICENSE.txt") sha256sums=('SKIP' 'a0aa691a318219d048107b835fe0e8cddfa734618fc5ccbb800b5bb463e00ea5' 'SKIP' 'a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499') pkgver() { cd "$srcdir/${pkgname%-git}" git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' } prepare() { # Prevent creation of a `go` directory in one's home. # Sometimes this directory cannot be removed with even `rm -rf` unless # one becomes root or changes the write permissions. export GOPATH="$srcdir/gopath" go clean -modcache } build() { cd "$srcdir/${pkgname%-git}" export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" go build -v "./cmd/${pkgname%-git}" # Generate man page pandoc -s -t man "doc/${pkgname%-git}.1.md" -o "doc/${pkgname%-git}.1" # Clean mod cache for makepkg -C go clean -modcache } package() { cd "$srcdir/${pkgname%-git}" install -Dm755 "${pkgname%-git}" -t "$pkgdir/usr/bin" install -Dm755 "scripts/${pkgname%-git}.bash" \ "$pkgdir/usr/share/bash-completion/completions/${pkgname%-git}" install -Dm755 "scripts/${pkgname%-git}.fish" -t \ "$pkgdir/usr/share/fish/completions" # Conflicts with zsh-suggestions, copy or symlink from the doc folder # install -Dm755 "scripts/${pkgname%-git}.zsh" "$pkgdir/usr/share/zsh/site-functions/_${pkgname%-git}" install -Dm755 "scripts/${pkgname%-git}.zsh" "$pkgdir/usr/share/doc/${pkgname%-git}/_${pkgname%-git}" install -Dm644 LICENSE.txt \ "$pkgdir/usr/share/licenses/${pkgname%-git}/${pkgname%-git}-LICENSE" install -Dm644 "doc/${pkgname%-git}.1" -t "$pkgdir/usr/share/man/man1" install -dm755 "$pkgdir/usr/share/${pkgname%-git}/cheatsheets/community" find "$srcdir/cheatsheets" \ -maxdepth 1 \ -type f \ -perm 644 \ -exec \ install -m644 "{}" \ "$pkgdir/usr/share/${pkgname%-git}/cheatsheets/community/" \; install -Dm644 "$srcdir/conf.yml" -t "$pkgdir/etc/${pkgname%-git}" install -Dm644 "$srcdir/LICENSE.txt" \ "$pkgdir/usr/share/licenses/${pkgname%-git}/cheatsheets-LICENSE" }