projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c8120a7
)
BuildExecutable: use correct executable extension, build dynamically instead of stati...
author
Stefan Behnel
<scoder@users.berlios.de>
Sat, 23 Apr 2011 07:15:55 +0000
(09:15 +0200)
committer
Stefan Behnel
<scoder@users.berlios.de>
Sat, 23 Apr 2011 07:15:55 +0000
(09:15 +0200)
Cython/Build/BuildExecutable.py
patch
|
blob
|
history
diff --git
a/Cython/Build/BuildExecutable.py
b/Cython/Build/BuildExecutable.py
index fa0d20d7d99a6f152e4b497e3e337577fea87440..492c24269ec72417e59712aa4092f872dec28e8a 100755
(executable)
--- a/
Cython/Build/BuildExecutable.py
+++ b/
Cython/Build/BuildExecutable.py
@@
-20,6
+20,12
@@
INCDIR = sysconfig.get_python_inc()
LIBDIR1 = get_config_var('LIBDIR')
LIBDIR2 = get_config_var('LIBPL')
PYLIB = get_config_var('LIBRARY')
LIBDIR1 = get_config_var('LIBDIR')
LIBDIR2 = get_config_var('LIBPL')
PYLIB = get_config_var('LIBRARY')
+PYLIB_DYN = get_config_var('LDLIBRARY')
+if PYLIB_DYN == PYLIB:
+ # no shared library
+ PYLIB_DYN = ''
+else:
+ PYLIB_DYN = os.path.splitext(PYLIB_DYN[3:])[0] # 'lib(XYZ).so' -> XYZ
CC = get_config_var('CC')
CFLAGS = get_config_var('CFLAGS') + ' ' + os.environ.get('CFLAGS', '')
CC = get_config_var('CC')
CFLAGS = get_config_var('CFLAGS') + ' ' + os.environ.get('CFLAGS', '')
@@
-27,6
+33,7
@@
LINKCC = get_config_var('LINKCC')
LINKFORSHARED = get_config_var('LINKFORSHARED')
LIBS = get_config_var('LIBS')
SYSLIBS = get_config_var('SYSLIBS')
LINKFORSHARED = get_config_var('LINKFORSHARED')
LIBS = get_config_var('LIBS')
SYSLIBS = get_config_var('SYSLIBS')
+EXE_EXT = sysconfig.get_config_var('EXE')
def _debug(msg, *args):
if DEBUG:
def _debug(msg, *args):
if DEBUG:
@@
-39,12
+46,14
@@
def dump_config():
_debug('LIBDIR1: %s', LIBDIR1)
_debug('LIBDIR2: %s', LIBDIR2)
_debug('PYLIB: %s', PYLIB)
_debug('LIBDIR1: %s', LIBDIR1)
_debug('LIBDIR2: %s', LIBDIR2)
_debug('PYLIB: %s', PYLIB)
+ _debug('PYLIB_DYN: %s', PYLIB_DYN)
_debug('CC: %s', CC)
_debug('CFLAGS: %s', CFLAGS)
_debug('LINKCC: %s', LINKCC)
_debug('LINKFORSHARED: %s', LINKFORSHARED)
_debug('LIBS: %s', LIBS)
_debug('SYSLIBS: %s', SYSLIBS)
_debug('CC: %s', CC)
_debug('CFLAGS: %s', CFLAGS)
_debug('LINKCC: %s', LINKCC)
_debug('LINKFORSHARED: %s', LINKFORSHARED)
_debug('LIBS: %s', LIBS)
_debug('SYSLIBS: %s', SYSLIBS)
+ _debug('EXE_EXT: %s', EXE_EXT)
def runcmd(cmd, shell=True):
if shell:
def runcmd(cmd, shell=True):
if shell:
@@
-64,8
+73,8
@@
def runcmd(cmd, shell=True):
sys.exit(returncode)
def clink(basename):
sys.exit(returncode)
def clink(basename):
- runcmd([LINKCC, '-o', basename
, basename+'.o', '-L'+LIBDIR1, '-L'+LIBDIR2,
- os.path.join(LIBDIR1, PYLIB)]
+ runcmd([LINKCC, '-o', basename
+ EXE_EXT, basename+'.o', '-L'+LIBDIR1, '-L'+LIBDIR2]
+
+ [PYLIB_DYN and ('-l'+PYLIB_DYN) or
os.path.join(LIBDIR1, PYLIB)]
+ LIBS.split() + SYSLIBS.split() + LINKFORSHARED.split())
def ccompile(basename):
+ LIBS.split() + SYSLIBS.split() + LINKFORSHARED.split())
def ccompile(basename):
@@
-79,8
+88,8
@@
def cycompile(input_file, options=()):
if result.num_errors > 0:
sys.exit(1)
if result.num_errors > 0:
sys.exit(1)
-def exec_file(
base
name, args=()):
- runcmd([os.path.abspath(
base
name)] + list(args), shell=False)
+def exec_file(
program_
name, args=()):
+ runcmd([os.path.abspath(
program_
name)] + list(args), shell=False)
def build(input_file, compiler_args=()):
"""
def build(input_file, compiler_args=()):
"""
@@
-92,7
+101,7
@@
def build(input_file, compiler_args=()):
cycompile(input_file, compiler_args)
ccompile(basename)
clink(basename)
cycompile(input_file, compiler_args)
ccompile(basename)
clink(basename)
- return basename
+ return basename
+ EXE_EXT
def build_and_run(args):
"""
def build_and_run(args):
"""