-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_codecs.py
82 lines (71 loc) · 2.11 KB
/
setup_codecs.py
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/env python
import sys, config
from distutils.core import setup, Extension
def disable_fPIC():
"""Disable -fPIC in the c compiler command line.
Some unix setups need -fPIC turned off to successfully compile
video/libavcodec/i386/dsputil_mmx.c (and other files). Distutils
gets the flag by parsing python2.3/config/Makefile and storing the
result in a cache.
This function is a hack that depends on that internal distutils
behavior, so it may someday stop working or corrupt distutils in an
unexpected way."""
import distutils.sysconfig
distutils.sysconfig.get_config_vars() # parse Makefile and fill the _config_vars cache
cv = distutils.sysconfig._config_vars
for var in "CCSHARED","GCCSHARED","CFLAGS","OPT":
if var in cv:
cv[var] = cv[var].replace('-fPIC','')
for var in ("CXX",):
if var in cv:
cv[var] = cv[var].replace('gcc','g++')
MODULE_NAME= 'pymedia'
CLE266_HW= {
'video.ext_codecs.cle266':
{
'#dir': 'video',
'':
(
'mem.c',
'common.c'
),
'vcodec':
[
'hw_vcodec.c',
'hw_mpeg.c',
'cle266/cle266_hw_dec.c',
],
},
}
if sys.platform == 'win32':
print 'No external codecs at this time exists for windows\n'
else:
print 'Using UNIX configuration...\n'
disable_fPIC()
LIB_DIRS = [ '/usr/lib', '/usr/local/lib', ]
INC_DIRS= [ '/usr/include', '/usr/local/include', '.' ]
LIBS= []
DEFINES= [
('_FILE_OFFSET_BITS',64),
('ACCEL_DETECT',1),
('HAVE_MMX', '1' ),
('HAVE_AV_CONFIG_H', None ),
]
FILES= CLE266_HW
METADATA = {
"name": "pymedia-codecs",
"version": "1.2.3.0",
"license": "LGPL",
"url": "http://pymedia.sourceforge.net/",
"author": "Dmitry Borisov",
"author_email": "jbors@pymedia.org",
"description": "External video codecs for PyMedia"
}
PACKAGEDATA = {
"packages": ['pymedia.video.ext_codecs'],
"package_dir":
{'pymedia.video.ext_codecs': 'inst_lib/video/ext_codecs'},
"ext_modules": config.extensions( MODULE_NAME, FILES, INC_DIRS, LIB_DIRS, DEFINES, LIBS )
}
PACKAGEDATA.update(METADATA)
apply(setup, [], PACKAGEDATA)