summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6f0526cca575e54b30d925b3b3d29108d1a681b2 (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
# Maintainer: Shalygin Konstantin <k0ste@k0ste.ru>
# Contributor: Shalygin Konstantin <k0ste@k0ste.ru>

pkgname='frr'
pkgver=2.0_rc1.5113.1b4ae82d
pkgrel=1
pkgdesc='FreeRangeRouting (quagga fork) supports BGP4/OSPF/RIP/PIM-SM/MSDP and LDP as well as very early support for IS-IS.'
arch=('any')
url="https://github.com/freerangerouting/${pkgname}"
license=('GPL2')
depends=('libcap' 'libnl' 'readline' 'ncurses' 'perl' 'json-c' 'net-snmp')
makedepends=('git' 'patch' 'gcc' 'grep' 'net-snmp' 'json-c')
conflicts=("quagga" "quagga_cumulus")
provides=("quagga" "quagga_cumulus")
source=("${pkgname}::git+${url}"
        "${pkgname}.sysusers"
        "${pkgname}.tmpfiles"
        "${pkgname}_systemd_arch.patch")
sha256sums=('SKIP'
            '3cea17f98f4091ec8b55a482ef094abaf5e254fd50ddbdad8d83fffd52e2fcd1'
            '6f8dd86ef9c600763faead3052908531e8dc8ef67058e6f7f8da01bf0fe4eb89'
            '85f3396b49e3a3c84c344ee548bb2d185152356ca8a7bdcb5a850dc2e477665d')

pkgver() {
  cd "${srcdir}/${pkgname}"
  git checkout stable/2.0 >/dev/null 2>&1
  package_version=`gawk 'match($0, /^(AC_INIT)\((frr)\,\s([a-z0-9\-.]+)(.*)$/, a) {print a[3]}' configure.ac`
  git_num=`git log --pretty=oneline | wc -l | tr -d '[[:space:]]'`
  git_tag=`git log -1 --format=%h`
  echo -e "${package_version}.${git_num}.${git_tag}" | sed -e 's:v::' -e 's|-|_|g'
}

prepare() {
  cd "${srcdir}/${pkgname}"
  git checkout stable/2.0
  patch -p1 -i "${srcdir}/${pkgname}_systemd_arch.patch"

  autoreconf -fvi
  ./configure \
    --prefix="/usr" \
    --sbindir="/usr/bin" \
    --sysconfdir="/etc/${pkgname}" \
    --localstatedir="/run/${pkgname}" \
    --enable-exampledir="/usr/share/doc/${pkgname}/examples" \
    --enable-ldpd \
    --disable-watchfrr \
    --enable-snmp \
    --enable-tcp-zebra \
    --enable-multipath=256 \
    --enable-user="${pkgname}" \
    --enable-group="${pkgname}" \
    --enable-vty-group="${pkgname}vty" \
    --enable-configfile-mask="0640" \
    --enable-logfile-mask="0640" \
    --enable-shell-access \
    --enable-pcreposix \
    --enable-systemd \
    --enable-poll
}

build() {
  cd "${srcdir}/${pkgname}"
  make
}

package() {
  cd "${srcdir}/${pkgname}"
  make DESTDIR="${pkgdir}" install

  cd "redhat"
  sed -ri 's|/var/run/frr|/run/frr|g' "${pkgname}.logrotate"
  install -Dm0644 "${pkgname}.logrotate" "${pkgdir}/etc/logrotate.d/${pkgname}"

  for d in zebra ripd ripngd bgpd ospfd ospfd-instance@ ospf6d isisd pimd ldpd; do
    install -Dm0644 ${d}.service "${pkgdir}/usr/lib/systemd/system/${d}.service"
  done

  install -Dm0644 "${srcdir}/${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
  install -Dm0644 "${srcdir}/${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
  rm -rfv "${pkgdir}/usr/bin/${pkgname}"
  rm -rfv "${pkgdir}/usr/bin/${pkgname}-reload.py"
}