mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
Add support for OS X.
- make the deploy script work on OS X. - use macdeployqt for copying Frameworks macdeployqt is part of Qt, at least since 4.5. - add a workaround for Qt not copying icons and plist file correctly when building out of tree. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23789 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2bfcb6e86c
commit
5f7a846b97
1 changed files with 46 additions and 13 deletions
|
|
@ -65,12 +65,19 @@ except ImportError:
|
||||||
# and executable filename.
|
# and executable filename.
|
||||||
program = "rbutilqt"
|
program = "rbutilqt"
|
||||||
project = "rbutil/rbutilqt/rbutilqt.pro"
|
project = "rbutil/rbutilqt/rbutilqt.pro"
|
||||||
|
environment = os.environ
|
||||||
|
make = "make"
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
progexe = "Release/rbutilqt.exe"
|
progexe = "Release/rbutilqt.exe"
|
||||||
make = "mingw32-make"
|
make = "mingw32-make"
|
||||||
|
elif sys.platform == "darwin":
|
||||||
|
progexe = "rbutilqt.app"
|
||||||
|
# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
|
||||||
|
# compatible with 10.4 requires using gcc-4.0.
|
||||||
|
if not "QMAKESPEC" in environment:
|
||||||
|
environment["QMAKESPEC"] = "macx-g++40"
|
||||||
else:
|
else:
|
||||||
progexe = program
|
progexe = program
|
||||||
make = "make"
|
|
||||||
|
|
||||||
programfiles = [ progexe ]
|
programfiles = [ progexe ]
|
||||||
|
|
||||||
|
|
@ -105,7 +112,8 @@ def usage(myself):
|
||||||
print " -a, --add=<file> add file to build folder before building"
|
print " -a, --add=<file> add file to build folder before building"
|
||||||
print " -s, --source-only only create source archive"
|
print " -s, --source-only only create source archive"
|
||||||
print " -b, --binary-only only create binary archive"
|
print " -b, --binary-only only create binary archive"
|
||||||
print " -d, --dynamic link dynamically instead of static"
|
if sys.platform != "darwin":
|
||||||
|
print " -d, --dynamic link dynamically instead of static"
|
||||||
print " -h, --help this help"
|
print " -h, --help this help"
|
||||||
print " If neither a project file nor tag is specified trunk will get downloaded"
|
print " If neither a project file nor tag is specified trunk will get downloaded"
|
||||||
print " from svn."
|
print " from svn."
|
||||||
|
|
@ -120,7 +128,6 @@ def getsources(svnsrv, filelist, dest):
|
||||||
destpath = re.subn('/$', '', dest + elem)[0]
|
destpath = re.subn('/$', '', dest + elem)[0]
|
||||||
# make sure the destination path does exist
|
# make sure the destination path does exist
|
||||||
d = os.path.dirname(destpath)
|
d = os.path.dirname(destpath)
|
||||||
print d
|
|
||||||
if not os.path.exists(d):
|
if not os.path.exists(d):
|
||||||
os.makedirs(d)
|
os.makedirs(d)
|
||||||
# get from svn
|
# get from svn
|
||||||
|
|
@ -204,7 +211,7 @@ def qmake(qmake="qmake", projfile=project, wd=".", static=True):
|
||||||
command.append("-config")
|
command.append("-config")
|
||||||
command.append("static")
|
command.append("static")
|
||||||
command.append(projfile)
|
command.append(projfile)
|
||||||
output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd)
|
output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd, env=environment)
|
||||||
output.communicate()
|
output.communicate()
|
||||||
if not output.returncode == 0:
|
if not output.returncode == 0:
|
||||||
print "qmake returned an error!"
|
print "qmake returned an error!"
|
||||||
|
|
@ -227,13 +234,14 @@ def build(wd="."):
|
||||||
print "Build failed!"
|
print "Build failed!"
|
||||||
return -1
|
return -1
|
||||||
break
|
break
|
||||||
# strip
|
if sys.platform != "darwin":
|
||||||
print "Stripping binary."
|
# strip. OS X handles this via macdeployqt.
|
||||||
output = subprocess.Popen(["strip", progexe], stdout=subprocess.PIPE, cwd=wd)
|
print "Stripping binary."
|
||||||
output.communicate()
|
output = subprocess.Popen(["strip", progexe], stdout=subprocess.PIPE, cwd=wd)
|
||||||
if not output.returncode == 0:
|
output.communicate()
|
||||||
print "Stripping failed!"
|
if not output.returncode == 0:
|
||||||
return -1
|
print "Stripping failed!"
|
||||||
|
return -1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -296,6 +304,26 @@ def tarball(versionstring, buildfolder):
|
||||||
return archivename
|
return archivename
|
||||||
|
|
||||||
|
|
||||||
|
def macdeploy(versionstring, buildfolder):
|
||||||
|
'''package created binary to dmg'''
|
||||||
|
dmgfile = program + "-" + versionstring + ".dmg"
|
||||||
|
appbundle = buildfolder + "/" + progexe
|
||||||
|
|
||||||
|
# workaround to Qt issues when building out-of-tree. Hardcoded for simplicity.
|
||||||
|
sourcebase = buildfolder + re.sub('rbutilqt.pro$', '', project)
|
||||||
|
shutil.copy(sourcebase + "icons/rbutilqt.icns", appbundle + "/Contents/Resources/")
|
||||||
|
shutil.copy(sourcebase + "Info.plist", appbundle + "/Contents/")
|
||||||
|
# end of Qt workaround
|
||||||
|
|
||||||
|
output = subprocess.Popen(["macdeployqt", progexe, "-dmg"], stdout=subprocess.PIPE, cwd=buildfolder)
|
||||||
|
output.communicate()
|
||||||
|
if not output.returncode == 0:
|
||||||
|
print "macdeployqt failed!"
|
||||||
|
return -1
|
||||||
|
# copy dmg to output folder
|
||||||
|
shutil.copy(buildfolder + "/" + program + ".dmg", dmgfile)
|
||||||
|
return dmgfile
|
||||||
|
|
||||||
def filehashes(filename):
|
def filehashes(filename):
|
||||||
'''Calculate md5 and sha1 hashes for a given file.'''
|
'''Calculate md5 and sha1 hashes for a given file.'''
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
|
|
@ -341,7 +369,10 @@ def main():
|
||||||
cleanup = True
|
cleanup = True
|
||||||
binary = True
|
binary = True
|
||||||
source = True
|
source = True
|
||||||
static = True
|
if sys.platform != "darwin":
|
||||||
|
static = True
|
||||||
|
else:
|
||||||
|
static = False
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
if o in ("-q", "--qmake"):
|
if o in ("-q", "--qmake"):
|
||||||
qt = a
|
qt = a
|
||||||
|
|
@ -357,7 +388,7 @@ def main():
|
||||||
binary = False
|
binary = False
|
||||||
if o in ("-b", "--binary-only"):
|
if o in ("-b", "--binary-only"):
|
||||||
source = False
|
source = False
|
||||||
if o in ("-d", "--dynamic"):
|
if o in ("-d", "--dynamic") and sys.platform != "darwin":
|
||||||
static = False
|
static = False
|
||||||
if o in ("-h", "--help"):
|
if o in ("-h", "--help"):
|
||||||
usage(sys.argv[0])
|
usage(sys.argv[0])
|
||||||
|
|
@ -438,6 +469,8 @@ def main():
|
||||||
if not upxfile(sourcefolder) == 0:
|
if not upxfile(sourcefolder) == 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
archive = zipball(ver, sourcefolder)
|
archive = zipball(ver, sourcefolder)
|
||||||
|
elif sys.platform == "darwin":
|
||||||
|
archive = macdeploy(ver, sourcefolder)
|
||||||
else:
|
else:
|
||||||
archive = tarball(ver, sourcefolder)
|
archive = tarball(ver, sourcefolder)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue