summaryrefslogtreecommitdiff
path: root/pcr/openchange/PKGBUILD
blob: c3e2c753f7044aa89852d473d6157875fa425a7e (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
# Maintainer: Michael Hansen <zrax0111 gmail com>
# Contributor: ngoonee <ngoonee.talk@gmail.com>
# Contributor: Adam Russell <adamlr6+arch@gmail.com>
pkgname=openchange
_codename=BORG
_dlid=180
pkgver=1.0
pkgrel=6
pkgdesc="Library for MAPI connectivity with Microsoft Exchange. This package was SPECIFICALLY created to support evolution-mapi and may not work for any other purpose."
arch=('i686' 'x86_64')
url="http://www.openchange.org"
license=('GPL3')
depends=('samba4>=4.0.0B1' 'popt' 'libical' 'sqlite3' 'file' 'boost' 'zlib')
makedepends=('ccache' 'python2' 'subversion' 'docbook-xsl' 'libxslt' 'flex' 'bison' 'autoconf' 'automake')
options=(!makeflags)
# Releases are mirrored at http://tracker.openchange.org/projects/openchange/files
source=("http://tracker.openchange.org/attachments/download/${_dlid}/${pkgname}-${pkgver}-${_codename}.tar.gz"
        "bugzilla_682449.patch")

md5sums=('9b57a325e90e5ad3a702ddc6e8762ab6'
         '7521f89f8ffaa733ed72532334951b90')
_prefix="/opt/samba4"

build() {
	cd ${srcdir}/${pkgname}-${pkgver}-${_codename}

	patch -i ../bugzilla_682449.patch

	SAVEIFS=${IFS}
	IFS=$(echo -en "\n\b")
	PYTHON_CALLERS="$(find ${srcdir}/${pkgname}-${pkgver}-${_codename} -name '*.py')
$(find ${srcdir}/${pkgname}-${pkgver}-${_codename}/  -type f)
$(find ${srcdir}/${pkgname}-${pkgver}-${_codename}/ -name 'configure.ac')"
	sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
	       -e "s|python-config$|python2-config|" \
	       -e "s|bin/python$|bin/python2|" \
	    ${PYTHON_CALLERS}

	# Patch for samba4-alpha19+
	SRC_FILES="$(find ${srcdir}/${pkgname}-${pkgver}-${_codename} -name '*.c')"
	sed -i -e "s|#include <samba/popt.h>|#include <popt.h>|" ${SRC_FILES}
	IFS=${SAVEIFS}

	export PYTHON=/usr/bin/python2

	export PKG_CONFIG_PATH="${_prefix}/samba/lib/pkgconfig:${_prefix}/lib/pkgconfig"
	export BOOST_LIB_SUFFIX="-mt"
	./autogen.sh

  sed -i -e "s|python-config|python2-config|g" configure
	./configure --prefix=${_prefix} --with-samba=${_prefix}
	make FLEX=/usr/bin/flex BISON=/usr/bin/bison || return 1
}

package() {
	_pyver=`python2 -c 'import sys; print(sys.version[:3])'`

	cd ${srcdir}/${pkgname}-${pkgver}-${_codename}
	make DESTDIR="$pkgdir/" install

	cd ${pkgdir}/${_prefix}/lib/
	ln -s libmapi.so libmapi.so.0
	ln -s libocpf.so libocpf.so.0

	find ${pkgdir}/${_prefix}/lib/python${_pyver}/site-packages/ -name '*.py' | \
	     xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|"
}