Benny Prijono | 844653c | 2008-12-23 17:27:53 +0000 | [diff] [blame] | 1 | # $Id$ |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 2 | # |
| 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 Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 21 | from distutils.core import setup, Extension |
| 22 | import os |
| 23 | import sys |
| 24 | |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 25 | # find pjsip version |
| 26 | pj_version="" |
| 27 | f = open('../../../pjlib/src/pj/config.c', 'r') |
| 28 | for line in f: |
| 29 | if line.find("PJ_VERSION") != -1: |
| 30 | pj_version= line.split(" = ")[1].strip('";\r\n') |
| 31 | break |
| 32 | f.close() |
| 33 | if pj_version=="": |
| 34 | print 'Unable to get PJ_VERSION' |
| 35 | sys.exit(1) |
| 36 | #print 'PJ_VERSION = "'+ pj_version + '"' |
| 37 | |
Benny Prijono | b85ba65 | 2008-07-11 00:55:22 +0000 | [diff] [blame] | 38 | |
Benny Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 39 | # Fill in pj_inc_dirs |
| 40 | pj_inc_dirs = [] |
| 41 | f = os.popen("make -f helper.mak inc_dir") |
| 42 | for line in f: |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 43 | pj_inc_dirs.append(line.rstrip("\r\n")) |
Benny Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 44 | f.close() |
| 45 | |
| 46 | # Fill in pj_lib_dirs |
| 47 | pj_lib_dirs = [] |
| 48 | f = os.popen("make -f helper.mak lib_dir") |
| 49 | for line in f: |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 50 | pj_lib_dirs.append(line.rstrip("\r\n")) |
Benny Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 51 | f.close() |
| 52 | |
| 53 | # Fill in pj_libs |
| 54 | pj_libs = [] |
| 55 | f = os.popen("make -f helper.mak libs") |
| 56 | for line in f: |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 57 | pj_libs.append(line.rstrip("\r\n")) |
Benny Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 58 | f.close() |
| 59 | |
| 60 | # Mac OS X depedencies |
| 61 | if sys.platform == 'darwin': |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 62 | extra_link_args = ["-framework", "CoreFoundation", |
| 63 | "-framework", "AudioToolbox"] |
Benny Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 64 | else: |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 65 | extra_link_args = [] |
Benny Prijono | 9c46114 | 2008-07-10 22:41:20 +0000 | [diff] [blame] | 66 | |
| 67 | |
Benny Prijono | 1a19db4 | 2008-07-24 12:20:08 +0000 | [diff] [blame] | 68 | setup(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 Prijono | b85ba65 | 2008-07-11 00:55:22 +0000 | [diff] [blame] | 83 | |
| 84 | |