PageRenderTime 33ms CodeModel.GetById 16ms app.highlight 15ms RepoModel.GetById 0ms app.codeStats 1ms

/scripts/scramble/scripts/MySQL_python-solaris.py

https://bitbucket.org/h_morita_dbcls/galaxy-central
Python | 81 lines | 65 code | 10 blank | 6 comment | 3 complexity | 009fe106bac4e6eb471cfb9e5425ffd5 MD5 | raw file
 1import os, sys, shutil
 2from distutils.sysconfig import get_config_var
 3
 4def prep_mysql( prepped, args ):
 5
 6    my_version = args['version']
 7    my_srcdir = os.path.join( os.getcwd(), "mysql-%s" % my_version )
 8
 9    # set up environment
10    os.environ['CC'] = get_config_var('CC')
11    os.environ['CFLAGS'] = get_config_var('CFLAGS')
12    os.environ['LDFLAGS'] = get_config_var('LDFLAGS')
13
14    cc = get_solaris_compiler()
15    if cc == 'cc':
16        os.environ['CFLAGS'] += ' -KPIC'
17    elif cc == 'gcc':
18        os.environ['CFLAGS'] += ' -fPIC -DPIC'
19
20    # run configure
21    run( "./configure --prefix=%s/mysql --disable-dependency-tracking --enable-static --disable-shared --without-server --without-uca " %os.getcwd() + \
22         "--without-libwrap --without-ssl --without-docs --without-man --enable-thread-safe-client --with-named-curses-libs=''",
23         my_srcdir, "Configuring mysql (./configure)" )
24
25    # compile
26    run( "make", os.path.join( my_srcdir, 'include' ), "Preparing mysql includes (cd include; make)" )
27    run( "make link_sources", os.path.join( my_srcdir, 'libmysql' ), "Preparing libmysql (cd libmysql; make link_sources)" )
28    run( "make link_sources", os.path.join( my_srcdir, 'libmysql_r' ), "Preparing libmysql_r (cd libmysql_r; make link_sources)" )
29    run( "make", os.path.join( my_srcdir, 'libmysql_r' ), "Compiling libmysql_r (cd libmysql_r; make)" )
30    run( "make", os.path.join( my_srcdir, 'scripts' ), "Preparing scripts (cd scripts; make)" )
31
32    # install
33    run( "make install", os.path.join( my_srcdir, 'include' ), "Installing mysql includes (cd include; make install)" )
34    run( "make install", os.path.join( my_srcdir, 'libmysql_r' ), "Installing libmysql_r (cd libmysql_r; make install)" )
35    run( "make install", os.path.join( my_srcdir, 'scripts' ), "Installing mysql scripts (cd scripts; make install)" )
36    shutil.copy( os.path.join( my_srcdir, 'include', 'mysqld_error.h' ), os.path.join( 'mysql', 'include', 'mysql' ) )
37
38    # create prepped archive
39    print "%s(): Creating prepped archive for future builds at:" % sys._getframe().f_code.co_name
40    print " ", prepped
41    compress( prepped,
42           'mysql/bin/mysql_config',
43           'mysql/include',
44           'mysql/lib' )
45
46if __name__ == '__main__':
47
48    # change back to the build dir
49    if os.path.dirname( sys.argv[0] ) != "":
50        os.chdir( os.path.dirname( sys.argv[0] ) )
51
52    # find setuptools
53    sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
54    from scramble_lib import *
55
56    tag = get_tag()
57
58    my_version = ( tag.split( '_' ) )[1]
59    my_archive_base = os.path.join( archives, 'mysql-%s' % my_version )
60    my_archive = get_archive( my_archive_base )
61    my_archive_prepped = os.path.join( archives, 'mysql-%s-%s.tar.gz' % ( my_version, platform_noucs ) )
62
63    # clean up any existing stuff (could happen if you run scramble.py by hand)
64    clean( [ 'mysql-%s' % my_version, 'mysql' ] )
65
66    # unpack mysql
67    unpack_dep( my_archive, my_archive_prepped, prep_mysql, dict( version=my_version ) )
68
69    # get site.cfg
70    shutil.copy( os.path.join( patches, 'MySQL_python', 'site.cfg' ), 'site.cfg' )
71
72    # tag
73    me = sys.argv[0]
74    sys.argv = [ me ]
75    if tag is not None:
76        sys.argv.append( "egg_info" )
77        sys.argv.append( "--tag-build=%s" %tag )
78    sys.argv.append( "bdist_egg" )
79
80    # go
81    execfile( "setup.py", globals(), locals() )