summaryrefslogtreecommitdiff
path: root/community/opensips/PKGBUILD
blob: 5ca813cacb178496d3076c2e26b484648e3bdef6 (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
# $Id: PKGBUILD 87012 2013-03-25 19:16:53Z bpiotrowski $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=opensips
pkgver=1.8.1
pkgrel=5
pkgdesc="An Open Source SIP Server able to act as a SIP proxy, registrar, location server, redirect server ..."
url="http://www.opensips.org"
depends=('gcc-libs' 'openssl' 'db' 'attr' 'libxml2')
makedepends=('postgresql-libs>=8.4.1' 'unixodbc' 'libldap>=2.4.18' 'libmariadbclient'
	     'lynx' 'libxslt')
optdepends=('postgresql-libs'
	    'unixodbc'
	    'libldap'
	    'libmariadbclient'
	    'libsasl'
	    'python2'
	    'pcre')
backup=("etc/opensips/opensips.cfg"
	"etc/opensips/dictionary.radius"
	"etc/opensips/opensipsctlrc")
arch=('i686' 'x86_64' 'mips64el')
license=('GPL')
install=opensips.install
options=('!emptydirs' 'zipman' '!makeflags' 'docs')
source=(http://opensips.org/pub/opensips/$pkgver/src/opensips-${pkgver}_src.tar.gz
	opensips.init
	opensips.service)
md5sums=('4a7cc708a5fba6ab3d1a3aa0aaa85d77'
         '685fbe00826df1285b410d4610dcbb0c'
         '7b786d758fe3174af34e2ced44b549e7')

build()
{
  cd $srcdir/$pkgname-$pkgver-tls/

  # python2 fix
  for file in $(find . -name '*.py' -print); do
    sed -i 's_^#!.*/usr/bin/python_#!/usr/bin/python2_' $file
    sed -i 's_^#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' $file
  done

  make \
	include_modules="ldap db_mysql db_postgres db_unixodbc presence presence_xml h350" \
	TLS=1 LIBDIR=lib
}

package() {
  cd $srcdir/$pkgname-$pkgver-tls/

  make \
	include_modules="ldap db_mysql db_postgres db_unixodbc presence presence_xml h350" \
	TLS=1 DESTDIR=$pkgdir/usr LIBDIR=lib install

  # Conforms to the arch packaging standards (http://wiki.archlinux.org/index.php/Arch_Packaging_Standards)
  mkdir -p $pkgdir/etc/
  mv $pkgdir/usr/etc/opensips/ $pkgdir/etc/
  sed -i 's#mpath=".*lib/opensips/modules/"#mpath="/usr/lib/opensips/modules/"#' $pkgdir/etc/opensips/opensips.cfg

  # Install starting script
  mkdir -p $pkgdir/etc/rc.d/
  cp ../opensips.init $pkgdir/etc/rc.d/opensips
  chmod 755 $pkgdir/etc/rc.d/opensips

  # fix bad paths
  cd $pkgdir/usr/share
  find -type f -exec sed -i "s#$pkgdir##" {} \;

  cd $pkgdir/usr/lib/opensips/opensipsctl
  find -type f -exec sed -i "s#$pkgdir##" {} \;

  cd $pkgdir/usr/sbin
  sed -i "s#$pkgdir##" opensipsctl opensipsdbctl osipsconsole

  cd $pkgdir/etc
  find -type f -exec sed -i "s#$pkgdir##" {} \;

  install -Dm0644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
}