blob: 98b2d786bbd5b056ae6a07f47a30bd01e18feea0 [file] [log] [blame]
Benny Prijono844653c2008-12-23 17:27:53 +00001# $Id$
Benny Prijono1a19db42008-07-24 12:20:08 +00002#
3# pjsua Setup script.
4#
5# Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20#
Benny Prijono9c461142008-07-10 22:41:20 +000021from distutils.core import setup, Extension
22import os
23import sys
24
Benny Prijono1a19db42008-07-24 12:20:08 +000025# find pjsip version
26pj_version=""
27f = open('../../../pjlib/src/pj/config.c', 'r')
28for line in f:
29 if line.find("PJ_VERSION") != -1:
30 pj_version= line.split(" = ")[1].strip('";\r\n')
31 break
32f.close()
33if pj_version=="":
34 print 'Unable to get PJ_VERSION'
35 sys.exit(1)
36#print 'PJ_VERSION = "'+ pj_version + '"'
37
Benny Prijonob85ba652008-07-11 00:55:22 +000038
Benny Prijono9c461142008-07-10 22:41:20 +000039# Fill in pj_inc_dirs
40pj_inc_dirs = []
41f = os.popen("make -f helper.mak inc_dir")
42for line in f:
Benny Prijono1a19db42008-07-24 12:20:08 +000043 pj_inc_dirs.append(line.rstrip("\r\n"))
Benny Prijono9c461142008-07-10 22:41:20 +000044f.close()
45
46# Fill in pj_lib_dirs
47pj_lib_dirs = []
48f = os.popen("make -f helper.mak lib_dir")
49for line in f:
Benny Prijono1a19db42008-07-24 12:20:08 +000050 pj_lib_dirs.append(line.rstrip("\r\n"))
Benny Prijono9c461142008-07-10 22:41:20 +000051f.close()
52
53# Fill in pj_libs
54pj_libs = []
55f = os.popen("make -f helper.mak libs")
56for line in f:
Benny Prijono1a19db42008-07-24 12:20:08 +000057 pj_libs.append(line.rstrip("\r\n"))
Benny Prijono9c461142008-07-10 22:41:20 +000058f.close()
59
60# Mac OS X depedencies
61if sys.platform == 'darwin':
Benny Prijono1a19db42008-07-24 12:20:08 +000062 extra_link_args = ["-framework", "CoreFoundation",
63 "-framework", "AudioToolbox"]
Benny Prijono9c461142008-07-10 22:41:20 +000064else:
Benny Prijono1a19db42008-07-24 12:20:08 +000065 extra_link_args = []
Benny Prijono9c461142008-07-10 22:41:20 +000066
67
Benny Prijono1a19db42008-07-24 12:20:08 +000068setup(name="pjsua",
69 version=pj_version,
70 description='SIP User Agent Library based on PJSIP',
71 url='http://trac.pjsip.org/repos/wiki/Python_SIP_Tutorial',
72 ext_modules = [Extension("_pjsua",
73 ["_pjsua.c"],
74 define_macros=[('PJ_AUTOCONF', '1'),],
75 include_dirs=pj_inc_dirs,
76 library_dirs=pj_lib_dirs,
77 libraries=pj_libs,
78 extra_link_args=extra_link_args
79 )
80 ],
81 py_modules=["pjsua"]
82 )
Benny Prijonob85ba652008-07-11 00:55:22 +000083
84