2 import os
, shutil
, re
, sys
3 from optparse
import OptionParser
6 parser
= OptionParser(usage
="usage: %prog [options]")
7 parser
.add_option("-V", "--version", help="display version information", action
='store_true')
8 (options
, args
) = parser
.parse_args()
11 print "Make-headers (zero-install) " + version
12 print "Copyright (C) 2007 Thomas Leonard"
13 print "This program comes with ABSOLUTELY NO WARRANTY,"
14 print "to the extent permitted by law."
15 print "You may redistribute copies of this program"
16 print "under the terms of the GNU General Public License."
17 print "For more information about these matters, see the file named COPYING."
20 configure
= os
.path
.join(os
.environ
['SRCDIR'], 'configure')
21 prefix
= os
.environ
['DISTDIR']
24 if os
.spawnvp(os
.P_WAIT
, argv
[0], argv
):
25 raise Exception("Command '%s' failed" % repr(argv
))
27 run(configure
, '--prefix', prefix
)
28 run('make', 'install')
31 for path
in ['bin', 'man', 'share']:
35 for x
in os
.listdir('.'):
36 if os
.path
.isfile(x
) or os
.path
.islink(x
):
37 if re
.match('^lib.*\.so[.0-9]*$', x
) or \
38 re
.match('^lib.*\.la', x
):
42 for pc
in os
.listdir('.'):
43 if pc
.endswith('.pc'):
44 data
= file(pc
).read().split('\n')
45 for i
in range(len(data
)):
46 if data
[i
].startswith('prefix='):
47 data
[i
] = 'prefix=${pcfiledir}/../..'
49 out
.write('\n'.join(data
))