updated on Fri Jan 13 20:02:10 UTC 2012
[aur-mirror.git] / openvpn-git / PKGBUILD
blob4b41f6868c9376fbdfb01c56984e5736f01ac220
1 # Maintainer: Christian Hesse <mail@eworm.de>
2 # Contributor: Thomas Bächler <thomas@archlinux.org> ([core] package)
4 pkgname=openvpn-git
5 pkgver=20111121
6 pkgrel=1
7 pkgdesc="An easy-to-use, robust, and highly configurable VPN (Virtual Private Network) - git checkout"
8 arch=(i686 x86_64)
9 url="http://openvpn.net/index.php/open-source.html"
10 depends=('openssl' 'lzo2' 'iproute2')
11 conflicts=('openvpn')
12 provides=('openvpn')
13 license=('custom')
14 backup=(usr/share/openvpn/easy-rsa/vars
15         usr/share/openvpn/easy-rsa/openssl-1.0.0.cnf
16         etc/conf.d/openvpn-tapdev)
17 source=(openvpn.rc
18         openvpn-tapdev.rc
19         openvpn-tapdev.conf)
21 _gitroot="git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn.git"
22 _gitname="openvpn"
24 build() {
25   cd "${srcdir}"
26   msg "Connecting to GIT server...."
28   if [ -d ${_gitname} ] ; then
29     cd ${_gitname} && git pull origin
30     msg "The local files are updated."
31   else
32     git clone ${_gitroot} ${_gitname}
33   fi
35   msg "GIT checkout done or server timeout"
36   msg "Starting make..."
38   rm -rf "${srcdir}/${_gitname}-build"
39   git clone "${srcdir}/${_gitname}" "${srcdir}/${_gitname}-build"
40   cd "${srcdir}/${_gitname}-build"
42   # Build openvpn
43   autoreconf -vi
44   CFLAGS="$CFLAGS -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn\\\"" ./configure \
45     --prefix=/usr \
46     --enable-password-save \
47     --mandir=/usr/share/man \
48     --enable-iproute2
49   make
51   # Build plugins
52   for plug in auth-pam down-root; do
53     cd ${srcdir}/${_gitname}-build/plugin/${plug}
54     make
55   done
58 package() {
59   cd ${srcdir}/${_gitname}-build
60   # Install openvpn
61   make DESTDIR=${pkgdir} install
62   install -d -m755 ${pkgdir}/etc/openvpn
63   # Install examples
64   install -d -m755 ${pkgdir}/usr/share/openvpn
65   cp -r sample-config-files ${pkgdir}/usr/share/openvpn/examples
66   find ${pkgdir}/usr/share/openvpn -type f -exec chmod 644 {} \;
67   find ${pkgdir}/usr/share/openvpn -type d -exec chmod 755 {} \;
68   # Install license
69   install -D -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/COPYING
70   # Install plugins
71   for plug in auth-pam down-root; do
72     cd ${srcdir}/${_gitname}-build/plugin/${plug}
73     install -D -m755 openvpn-${plug}.so ${pkgdir}/usr/lib/openvpn/openvpn-${plug}.so
74     cd -
75   done
76   # Install contrib
77   install -d -m755 ${pkgdir}/usr/share/openvpn/contrib
78   cp -r contrib ${pkgdir}/usr/share/openvpn
79   # Install easy-rsa
80   cd ${srcdir}/${_gitname}-build
81   make -C easy-rsa/2.0 install DESTDIR=${pkgdir} PREFIX=usr/share/openvpn/easy-rsa
82   rm -f ${pkgdir}/usr/share/openvpn/easy-rsa/openssl-0.9.?.cnf
83   # Install rc scripts
84   install -D -m755 ${srcdir}/openvpn.rc ${pkgdir}/etc/rc.d/openvpn
85   install -D -m755 ${srcdir}/openvpn-tapdev.rc ${pkgdir}/etc/rc.d/openvpn-tapdev
86   install -D -m644 ${srcdir}/openvpn-tapdev.conf ${pkgdir}/etc/conf.d/openvpn-tapdev
88 md5sums=('a3809b9727f0c2af2d0770f5c7442db2'
89          'd2c48e970088d679dd3c2afd914ff731'
90          '722f483c9e3ce2ec66d3301aaf7cf3d5')