summaryrefslogtreecommitdiff
path: root/pcr/librevpn-git/PKGBUILD
blob: 6efa1f9a2ec400eecc7486b5061e8971f1aa947d (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Maintainer: Márcio Silva <coadde@hyperbola.info>

 _branch=master
#_branch=feature/empaquetable

if [[ $_branch == master ]]; then
  # committer     Nicolás Reynolds <fauno@endefensadelsl.org>     2013-07-30 17:16:33 (GMT)
  _srcver=20130730
  _commit=fb7d07789398d7b68ed437db75c68a24b0c17905
  _sha512sums=4dc77346fe6294d3bcfc47ead15f722bee628daf2a28d3fef9a15960038395140ee98918a4502ed1ed186bedbe2a83d9e68a202323523c8461476776bd3fdb2b
fi

if [[ $_branch == feature/empaquetable ]]; then
  # committer     Nicolás Reynolds <fauno@endefensadelsl.org>     2013-07-29 02:41:53 (GMT)
  _srcver=20130729
  _commit=5ee3d723da187d85f8b789998f98c8aebec843f7
  _sha512sums=f4c62b6bda67ce97eff9b35223f6c8d03c813e0151e81289006d8303e3296ed6346c2fb2b3835309d0902d9ea2ea73d4536636f544039ada5ae3d737600b0ebc
fi

_srcname=lvpn
_pkgname=librevpn
pkgname=$_pkgname-git
pkgver=$_srcver
pkgrel=3
pkgdesc='Free Virtual Network with tinc2dot and generate-ipv6-address'
url=http://$_pkgname.org.ar/
license=('AGPL3:(lvpn, tinc2dot)' 'MIT:(generate-ipv6-address)')
arch=(x86_64 i686)
depends=(avahi bash tinc)
optdepends=(
  'graphviz: for graph and tinc2dot'
  'libnatpmp: (AUR)'
  miniupnpc
  'python2: for avahi-publish-alias'
  python2-bottle
  'ruby: for graph'
  sudo
)
provides=($_pkgname)
conflicts=($_pkgname)
source=($_srcname-$_commit.tar.xz::http://repo.hackcoop.com.ar/$_pkgname.git/snapshot/$_commit.tar.xz)
sha512sums=($_sha512sums)

build() {
  cd $srcdir/$_commit

  if [[ $_branch == feature/empaquetable ]]; then
    sed -i '\|generate-ipv6-address|d;\|natpmp|d;\|upnpc|d' Makefile
    sed -i '\|LVPN_DIR=| s|${PWD}|/usr/share/lvpn|' $_srcname.in
    sed -i 's|${LVPN_DIR}/bin|/usr/bin|;
            s|$(uname -m)-||;
           ' lib/common
    make PREFIX=/usr
  fi

  cd $srcdir/$_commit/etc/generate-ipv6-address-0.1
  sed -i 's|`uname -m`-||;s|/man/man8|/share/man/man8|' Makefile
  make PREFIX=/usr
}

package() {
  cd $srcdir/$_commit

  if [[ $_branch == feature/empaquetable ]]; then
    make PREFIX=$pkgdir/usr TEXTDOMAINDIR=$pkgdir/usr/share/locale install

    msg 'Installing scripts files'
    install -vm755 bin/avahi-publish-alias $pkgdir/usr/share/$_srcname
    install -vm755 bin/graph               $pkgdir/usr/share/$_srcname # conflicts with plotutils on /usr/bin
    install -vm755 bin/tinc2dot            $pkgdir/usr/share/$_srcname # tinc2dot 0.2.1 script
    install -vm755 bin/cronjob             $pkgdir/usr/share/$_srcname/fauno-cronjob # fauno script

    msg 'Removing dirs'
    rmdir -v $pkgdir/usr/share/locale/pacman-scripts

    msg 'Fixing beagle patch'
    rmdir -v $pkgdir/usr/share/$_srcname/beadle
    ln -vs hosts $pkgdir/usr/share/$_srcname/beadle

    msg 'Adding doc patch'
    install -vd $pkgdir/usr/share/doc
    ln -vs ../$_srcname $pkgdir/usr/share/doc/$_srcname

    msg 'Installing locale files'
    _locales=(en)
    for _po in ${_locales[@]}; do
      install -vd $pkgdir/usr/share/locale/$_po/LC_MESSAGES
      msgfmt -o $pkgdir/usr/share/locale/$_po/LC_MESSAGES/$_srcname.mo locale/$_po.po
    done
  fi

  if [[ $_branch == master ]]; then
    cd $srcdir/$_commit

    msg 'Fixing patchs with sed'
    sed -i '\|LVPN=|        s|$(readlink -f $0)|lvpn|;
            \|LVPN_DIR=|    s|$(dirname "$LVPN")|/usr/share/lvpn|;
            \|LVPN_BIN=|    s|${LVPN_DIR}|/usr|;
            \|LVPN_LIBDIR=| s|${LVPN_DIR}/lib|/usr/lib/lvpn|;
           ' $_srcname
    sed -i 's|${LVPN_DIR}/bin|/usr/bin|;
            s|$(uname -m)-||;
           ' lib/{common,lvpn-init}

    msg 'Copying doc, hosts and lib dirs'
    install -vd $pkgdir/usr/{lib,share/$_srcname}
    cp -va doc   $pkgdir/usr/share/$_srcname
    cp -va hosts $pkgdir/usr/share/$_srcname
    cp -va lib   $pkgdir/usr/lib/$_srcname

    msg 'Installing scripts files'
    install -vd $pkgdir/usr/bin
    install -vm755 $_srcname               $pkgdir/usr/bin
    install -vm755 bin/avahi-publish-alias $pkgdir/usr/share/$_srcname
    install -vm755 bin/graph               $pkgdir/usr/share/$_srcname # conflicts with plotutils on /usr/bin
    install -vm755 bin/tinc2dot            $pkgdir/usr/share/$_srcname # tinc2dot 0.2.1 script
    install -vm755 bin/cronjob             $pkgdir/usr/share/$_srcname/fauno-cronjob # fauno script

    msg 'Fixing beagle patch'
    ln -vs hosts $pkgdir/usr/share/$_srcname/beadle

    msg 'Adding doc patch'
    install -vd $pkgdir/usr/share/doc
    ln -vs ../$_srcname $pkgdir/usr/share/doc/$_srcname

    msg 'Installing locale files'
    _locales=(en)
    for _po in ${_locales[@]}; do
      install -vd $pkgdir/usr/share/locale/$_po/LC_MESSAGES
      msgfmt -o $pkgdir/usr/share/locale/$_po/LC_MESSAGES/$_srcname.mo locale/$_po.po
    done
  fi

  msg 'Creating dirs'
  install -d $pkgdir/{usr/share/$_srcname/nodos,etc/{logrotate.d,NetworkManager/dispatcher.d}}

  msg 'Installing license files'
  install -vDm644 LICENSE $pkgdir/usr/share/licenses/$_srcname/COPYING

  msg 'Installing "generate-ipv6-address" files'
  cd etc/generate-ipv6-address-0.1
  make PREFIX=$pkgdir/usr TEXTDOMAINDIR=$pkgdir/usr/share/locale install
}

# vim:set ts=2 sw=2 et: