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

https://bitbucket.org/h_morita_dbcls/galaxy-central · Python · 81 lines · 51 code · 18 blank · 12 comment · 5 complexity · 009fe106bac4e6eb471cfb9e5425ffd5 MD5 · raw file

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