1
# $Id: setup.py 4756 2014-02-21 07:49:37Z nanang $
5
# Copyright (C)2012 Teluu Inc. (http://www.teluu.com)
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.
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.
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
21
from distutils.core import setup, Extension
32
f = open('../../../../version.mak', 'r')
34
if line.find("export PJ_VERSION_MAJOR") != -1:
35
tokens=line.split("=")
37
pj_version_major= tokens[1].strip()
38
elif line.find("export PJ_VERSION_MINOR") != -1:
39
tokens=line.split("=")
41
pj_version_minor= line.split("=")[1].strip()
42
elif line.find("export PJ_VERSION_REV") != -1:
43
tokens=line.split("=")
45
pj_version_rev= line.split("=")[1].strip()
46
elif line.find("export PJ_VERSION_SUFFIX") != -1:
47
tokens=line.split("=")
49
pj_version_suffix= line.split("=")[1].strip()
52
if not pj_version_major:
53
print 'Unable to get PJ_VERSION_MAJOR'
56
pj_version = pj_version_major + "." + pj_version_minor
58
pj_version += "." + pj_version_rev
60
pj_version += "-" + pj_version_suffix
62
#print 'PJ_VERSION = "'+ pj_version + '"'
65
f = os.popen("make --no-print-directory -f helper.mak target_name")
66
pj_target_name = f.read().rstrip("\r\n")
69
# Fill in extra_compile_args
70
extra_compile_args = []
71
f = os.popen("make --no-print-directory -f helper.mak cflags")
73
extra_compile_args.append(line.rstrip("\r\n"))
78
f = os.popen("make --no-print-directory -f helper.mak libs")
80
libraries.append(line.rstrip("\r\n"))
83
# Fill in extra_link_args
85
f = os.popen("make --no-print-directory -f helper.mak ldflags")
87
extra_link_args.append(line.rstrip("\r\n"))
90
# MinGW specific action: put current working dir to PATH, so Python distutils
91
# will invoke our dummy gcc/g++ instead, which is in the current working dir.
92
if platform.system()=='Windows' and os.environ["MSYSTEM"].find('MINGW')!=-1:
93
os.environ["PATH"] = "." + os.pathsep + os.environ["PATH"]
97
description='SIP User Agent Library based on PJSIP',
98
url='http://www.pjsip.org',
99
ext_modules = [Extension("_pjsua2",
102
extra_compile_args=extra_compile_args,
103
extra_link_args=extra_link_args
106
py_modules=["pjsua2"]