summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7709fcd0986beb8ab794982588069a1e56b49021 (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
88
89
90
91
92
93
94
95
96
# Maintainer:
# Contributor: Ahmad Hasan Mubashshir <ahmubashshir@gmail.com>
# Contributor: Konstantin Stepanov <me@kstep.me>

_pkgname="systemd-cron-next"
pkgname="$_pkgname-git"
pkgver=1.0.2.r18.gd69afa9
pkgrel=1
pkgdesc="Systemd generator to generate timers/services from crontab and anacrontab files"
arch=('i686' 'x86_64')
url="https://github.com/systemd-cron/systemd-cron-next"
license=('MIT')

depends=(
  'run-parts'
  'systemd'
)
makedepends=(
  'rust'
)
optdepends=(
  'smtp-forwarder: sending emails'
)

provides=(
  'anacron'
  'cron'
  'systemd-cron'
)
conflicts=(
  'anacron'
  'cron'
)

source=(
  "0002-makefile.patch"
)
sha256sums=(
  '095f20fd780717da18c0251df0ff702a5953816120f3040a317ccc9dc3e1572b'
)

if [ x"$pkgname" == x"$_pkgname" ] ; then
  # normal package
  _pkgsrc="$_pkgname-${pkgver%.r*}"
  _pkgext="zip"
  source+=(
    "0001-d69afa94.patch"
    "$_pkgsrc.$_pkgext"::"https://github.com/systemd-cron/systemd-crontab-generator/archive/v${pkgver%.r*}.$_pkgext"
  )
  sha256sums+=(
    '236cbbaa3cc56176874d96162ba49c5f642615596f9d50056c04ed65347fbf80'
    '455d1ea09ecb29efaec44255f6439794d2118d63133936b389fd3afd9c60cc2f'
  )
else
  # git package
  makedepends+=('git')

  provides+=("$_pkgname")
  conflicts+=("$_pkgname")

  _pkgsrc="$_pkgname"
  source+=(
    "$_pkgsrc"::"git+$url.git"
  )
  sha256sums+=(
    'SKIP'
  )

  pkgver() {
    cd "$_pkgsrc"
    git describe --long --tags | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
  }
fi

prepare() {
  cd "$_pkgsrc"

  for patch in "$srcdir"/*.patch ; do
    if [ -f "$patch" ] ; then
      printf 'Applying patch: %s\n' "${patch##*/}"
      patch -Np1 -F100 -i "$patch"
    fi
  done
}

build() {
  cd "$_pkgsrc"
   ./configure --prefix="/usr" --confdir="/etc"
   DESTDIR="${pkgdir:?}" make build
}

package() {
  cd "$_pkgsrc"
  DESTDIR="${pkgdir:?}" make install
  install -d -m 775 "${pkgdir:?}/var/spool/cron"
}