qtecomplugins/install.py
changeset 1 2b40d63a9c3d
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 #
       
     2 # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 # All rights reserved.
       
     4 #
       
     5 # This program is free software: you can redistribute it and/or modify
       
     6 # it under the terms of the GNU Lesser General Public License as published by
       
     7 # the Free Software Foundation, version 2.1 of the License.
       
     8 # 
       
     9 # This program is distributed in the hope that it will be useful,
       
    10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 # GNU Lesser General Public License for more details.
       
    13 #
       
    14 # You should have received a copy of the GNU Lesser General Public License
       
    15 # along with this program.  If not, 
       
    16 # see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 #
       
    18 # Description:  The configure script of ecomext-qt
       
    19 #
       
    20 
       
    21 import sys
       
    22 import getopt
       
    23 import os
       
    24 from optparse import OptionParser
       
    25 
       
    26 def showHelp():
       
    27 	print "Usage: 'compile [--help|-h] [--clean|-c] [--target|-t <target>] [--tool|-o]'"
       
    28 	print ""
       
    29 	print "Options:"
       
    30 	print "  --help,-h              Show help and quit"
       
    31 	print "  --clean,-c             Clean ecomext-qt"
       
    32 	print "  --target,-t <target>   Build only for specific target. Target syntax from makefiles has to be used,"
       
    33 	print "                         eg.: \'release-armv5\' \'debug-winscw\'. Default is to build without target specified. "
       
    34 	print "  --tool,-o              Compile xqecom tool instead of copying precompiled xqecom.exe (win32 version)."
       
    35 	print "                         Warning: Compilation uses qt sources directly and is very probable to broke on other qt versions."
       
    36 	
       
    37 def copyPRF():
       
    38 	os.system("qmake 1>>&0 2>&1")
       
    39 	os.system("make installprf") #this will clean exe
       
    40 
       
    41 def copyEXE():
       
    42 	os.system("qmake 1>>&0 2>&1")
       
    43 	os.system("make installtool") #this will clean exe
       
    44 	
       
    45 def compileTOOL():
       
    46 	print "compile xqecom"
       
    47 	os.chdir("xqecom")	
       
    48 	os.system("qmake -platform win32-g++")
       
    49 	os.system("make release")
       
    50 	os.chdir('..')
       
    51 	
       
    52 def compileXQPLUGINFRAMEWORK(buildArg):
       
    53 	print "compile xqplugins	",buildArg
       
    54 	os.chdir("xqplugins")
       
    55 	os.system("qmake")
       
    56 	mcommand = "make "+buildArg
       
    57 	os.system(mcommand)
       
    58 	os.chdir('..')
       
    59 	
       
    60 def cleanME():
       
    61 	os.system("qmake 1>>&0 2>&1")
       
    62 	print "Clean tool"
       
    63 	os.system("make cleantool") #this will clean exe
       
    64 	print "Clean prf"
       
    65 	os.system("make cleanprf") #this will clean prf
       
    66 	os.system("make clean 1>>&0 2>&1")
       
    67 	os.system("make distclean 1>>&0 2>&1")
       
    68 
       
    69 	
       
    70 def main(argv):
       
    71 	try:
       
    72 		opts, args = getopt.getopt(argv, "hct:o", ["help", "clean","target=","tool"])
       
    73 	except getopt.GetoptError:
       
    74 		showHelp()
       
    75 		sys.exit(2)
       
    76 	
       
    77 	buildArg = ""	
       
    78 	buildTool = 0
       
    79 	
       
    80 	for opt, arg in opts:
       
    81 #		print opt,arg
       
    82 		if opt in ("-h", "--help"):
       
    83 			showHelp()
       
    84 			sys.exit()
       
    85 		elif opt in ("-c", "--clean"):
       
    86 			cleanME()
       
    87 			sys.exit()
       
    88 		elif opt in ("-t", "--target"):
       
    89 			buildArg = arg
       
    90 		elif opt in ("-o", "--tool"):
       
    91 			buildTool = 1
       
    92 	
       
    93 	copyPRF()
       
    94 	if buildTool == 1:
       
    95 		compileTOOL()
       
    96 	else:
       
    97 		copyEXE()
       
    98 	compileXQPLUGINFRAMEWORK(buildArg)
       
    99 	
       
   100 if __name__ == "__main__":
       
   101     main(sys.argv[1:])
       
   102 #eof