1
0
Fork 0
forked from len0rd/rockbox

Add command line option to specify project file for deploying out-of-tree.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22898 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2009-10-03 20:42:02 +00:00
parent 21e349666d
commit 2b05ef77d7

View file

@ -40,6 +40,7 @@ import time
# Windows nees some special treatment. Differentiate between program name # Windows nees some special treatment. Differentiate between program name
# and executable filename. # and executable filename.
program = "rbutilqt" program = "rbutilqt"
project = "rbutilqt.pro"
if sys.platform == "win32": if sys.platform == "win32":
progexe = "Release/rbutilqt.exe" progexe = "Release/rbutilqt.exe"
else: else:
@ -52,6 +53,7 @@ programfiles = [ progexe ]
def usage(myself): def usage(myself):
print "Usage: %s [options]" % myself print "Usage: %s [options]" % myself
print " -q, --qmake=<qmake> path to qmake" print " -q, --qmake=<qmake> path to qmake"
print " -p, --project=<pro> path to .pro file for building out-of-tree"
print " -h, --help this help" print " -h, --help this help"
@ -121,9 +123,9 @@ def removedir(folder):
os.rmdir(folder) os.rmdir(folder)
def qmake(qmake="qmake"): def qmake(qmake="qmake", projfile=project):
print "Running qmake ..." print "Running qmake ..."
output = subprocess.Popen([qmake, "-config", "static", "-config", "release"], output = subprocess.Popen([qmake, "-config", "static", "-config", "release", projfile],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
output.communicate() output.communicate()
if not output.returncode == 0: if not output.returncode == 0:
@ -210,15 +212,18 @@ def tarball(versionstring):
def main(): def main():
startup = time.time() startup = time.time()
try: try:
opts, args = getopt.getopt(sys.argv[1:], "q:h", ["qmake=", "help"]) opts, args = getopt.getopt(sys.argv[1:], "q:p:h", ["qmake=", "project=", "help"])
except getopt.GetoptError, err: except getopt.GetoptError, err:
print str(err) print str(err)
usage(sys.argv[0]) usage(sys.argv[0])
sys.exit(1) sys.exit(1)
qt = "" qt = ""
proj = project
for o, a in opts: for o, a in opts:
if o in ("-q", "--qmake"): if o in ("-q", "--qmake"):
qt = a qt = a
if o in ("-p", "--project"):
proj = a
if o in ("-h", "--help"): if o in ("-h", "--help"):
usage(sys.argv[0]) usage(sys.argv[0])
sys.exit(0) sys.exit(0)
@ -231,15 +236,21 @@ def main():
if qm == "": if qm == "":
print "ERROR: No suitable Qt installation found." print "ERROR: No suitable Qt installation found."
sys.exit(1) sys.exit(1)
# check project file
if not os.path.exists(proj):
print "ERROR: path to project file wrong. You need to specify the path " \
"when building out-of-tree."
sys.exit(1)
# figure version from sources # figure version from sources. Need to take path to project file into account.
ver = findversion("version.h") versionfile = re.subn('[\w\.]+$', "version.h", proj)[0]
ver = findversion(versionfile)
header = "Building %s %s" % (program, ver) header = "Building %s %s" % (program, ver)
print header print header
print len(header) * "=" print len(header) * "="
# build it. # build it.
if not qmake(qm) == 0: if not qmake(qm, proj) == 0:
os.exit(1) os.exit(1)
if not build() == 0: if not build() == 0:
sys.exit(1) sys.exit(1)