Merge lp:~hile/mixxx/osxbuildfixes into lp:~mixxxdevelopers/mixxx/trunk

Proposed by Ilkka Tuohela
Status: Needs review
Proposed branch: lp:~hile/mixxx/osxbuildfixes
Merge into: lp:~mixxxdevelopers/mixxx/trunk
Diff against target: 253 lines (+112/-43)
4 files modified
mixxx/build/depends.py (+39/-34)
mixxx/build/mixxx.py (+55/-5)
mixxx/build/osx/otool.py (+9/-2)
mixxx/src/SConscript (+9/-2)
To merge this branch: bzr merge lp:~hile/mixxx/osxbuildfixes
Reviewer Review Type Date Requested Status
Mixxx Development Team Pending
Review via email: mp+106120@code.launchpad.net

Description of the change

This patch branch fixes library linking issues building the OS/X version when Qt is not installed to the default version expected, by giving qtdir= variable. Without this patch, qtdir= does not work at all on OS/X (without the patch you must link Qt to now obsolete /Developer/Frameworks path).

Also fixes some minor issues in 'bundle package' scons target, specifically install_name_tool failing because the copied file permissions seem to be 0444.

To post a comment you must log in.
lp:~hile/mixxx/osxbuildfixes updated
3166. By Ilkka Tuohela

Merged from trunk

3167. By Ilkka Tuohela

Add explicit -L for qt library directory for commercial Qt compilations

3168. By Ilkka Tuohela

Look for Qt frameworks in Frameworks and lib under QTDIR

3169. By Ilkka Tuohela

Imported from trunk

3170. By Ilkka Tuohela

Improved Qt build directory detection

Unmerged revisions

3170. By Ilkka Tuohela

Improved Qt build directory detection

3169. By Ilkka Tuohela

Imported from trunk

3168. By Ilkka Tuohela

Look for Qt frameworks in Frameworks and lib under QTDIR

3167. By Ilkka Tuohela

Add explicit -L for qt library directory for commercial Qt compilations

3166. By Ilkka Tuohela

Merged from trunk

3165. By Ilkka Tuohela

Fix permissions before running install_name_tool

3164. By Ilkka Tuohela

Removed accidentally added presetinfo

3163. By Ilkka Tuohela

Imported OS/X build fixes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mixxx/build/depends.py'
2--- mixxx/build/depends.py 2012-07-08 07:30:32 +0000
3+++ mixxx/build/depends.py 2012-08-14 05:15:28 +0000
4@@ -105,11 +105,6 @@
5 return ['soundsourceflac.cpp',]
6
7 class Qt(Dependence):
8- DEFAULT_QTDIRS = {'linux': '/usr/share/qt4',
9- 'bsd': '/usr/local/lib/qt4',
10- 'osx': '/Library/Frameworks',
11- 'windows': 'C:\\qt\\4.6.0'}
12-
13 def satisfy(self):
14 pass
15
16@@ -118,36 +113,43 @@
17 build.env.Append(CPPDEFINES = ['QT_SHARED',
18 'QT_TABLET_SUPPORT'])
19
20+ qt_modules = [
21+ 'QtCore', 'QtGui', 'QtOpenGL', 'QtXml', 'QtSvg',
22+ 'QtSql', 'QtScript', 'QtXmlPatterns', 'QtWebKit',
23+ 'QtNetwork'
24+ #'QtUiTools', #'QtDesigner',
25+ ]
26+
27 # Enable Qt include paths
28 if build.platform_is_linux:
29 if not conf.CheckForPKG('QtCore', '4.6'):
30 raise Exception('QT >= 4.6 not found')
31
32- #Try using David's qt4.py's Qt4-module finding thingy instead of pkg-config.
33 #(This hopefully respects our qtdir=blah flag while linking now.)
34- build.env.EnableQt4Modules(['QtCore',
35- 'QtGui',
36- 'QtOpenGL',
37- 'QtXml',
38- 'QtSvg',
39- 'QtSql',
40- 'QtScript',
41- 'QtXmlPatterns',
42- 'QtWebKit'
43- #'QtUiTools',
44- #'QtDesigner',
45- ],
46- debug=False)
47+ build.env.EnableQt4Modules(qt_modules,debug=False)
48+
49 elif build.platform_is_osx:
50- build.env.Append(LINKFLAGS = '-framework QtCore -framework QtOpenGL -framework QtGui -framework QtSql -framework QtXml -framework QtXmlPatterns -framework QtNetwork -framework QtSql -framework QtScript -framework QtWebKit')
51- build.env.Append(CPPPATH = ['/Library/Frameworks/QtCore.framework/Headers/',
52- '/Library/Frameworks/QtOpenGL.framework/Headers/',
53- '/Library/Frameworks/QtGui.framework/Headers/',
54- '/Library/Frameworks/QtXml.framework/Headers/',
55- '/Library/Frameworks/QtNetwork.framework/Headers/',
56- '/Library/Frameworks/QtSql.framework/Headers/',
57- '/Library/Frameworks/QtWebKit.framework/Headers/',
58- '/Library/Frameworks/QtScript.framework/Headers/'])
59+ qtdir = build.env['QTDIR']
60+ build.env.Append(
61+ LINKFLAGS=' '.join('-framework %s' % m for m in qt_modules)
62+ )
63+ found_frameworks = False
64+ for d in [os.path.join(qtdir,x) for x in ['Frameworks','lib']]:
65+ core = os.path.join(d,'QtCore.framework')
66+ if not os.path.isdir(core):
67+ continue
68+ build.env.Append(CPPPATH = [
69+ os.path.join(d,'%s.framework' % m,'Headers') for m in qt_modules
70+ ])
71+ build.env.Append(LINKFLAGS = [
72+ '-F%s' % os.path.join(d)
73+ ])
74+ found_frameworks = True
75+ break
76+ if not found_frameworks:
77+ raise Exception(
78+ 'Could not find frameworks in Qt directory: %s' % qtdir
79+ )
80
81 # Setup Qt library includes for non-OSX
82 if build.platform_is_linux or build.platform_is_bsd:
83@@ -742,16 +744,19 @@
84
85 elif build.platform_is_osx:
86 #Stuff you may have compiled by hand
87- build.env.Append(LIBPATH = ['/usr/local/lib'])
88- build.env.Append(CPPPATH = ['/usr/local/include'])
89+ if os.path.isdir('/usr/local/include'):
90+ build.env.Append(LIBPATH = ['/usr/local/lib'])
91+ build.env.Append(CPPPATH = ['/usr/local/include'])
92
93 #Non-standard libpaths for fink and certain (most?) darwin ports
94- build.env.Append(LIBPATH = ['/sw/lib'])
95- build.env.Append(CPPPATH = ['/sw/include'])
96+ if os.path.isdir('/sw/include'):
97+ build.env.Append(LIBPATH = ['/sw/lib'])
98+ build.env.Append(CPPPATH = ['/sw/include'])
99
100 #Non-standard libpaths for darwin ports
101- build.env.Append(LIBPATH = ['/opt/local/lib'])
102- build.env.Append(CPPPATH = ['/opt/local/include'])
103+ if os.path.isdir('/opt/local/include'):
104+ build.env.Append(LIBPATH = ['/opt/local/lib'])
105+ build.env.Append(CPPPATH = ['/opt/local/include'])
106
107 elif build.platform_is_bsd:
108 build.env.Append(CPPDEFINES='__BSD__')
109
110=== modified file 'mixxx/build/mixxx.py'
111--- mixxx/build/mixxx.py 2012-07-08 07:30:32 +0000
112+++ mixxx/build/mixxx.py 2012-08-14 05:15:28 +0000
113@@ -4,14 +4,68 @@
114 import sys
115 import os
116 import re
117+import glob
118
119 import SCons
120 from SCons import Script
121
122 import util
123
124+# Note: for globs, last entry matching from match list is selected
125+DEFAULT_PLATFORM_QTDIRS = {
126+ 'linux': [
127+ '/usr/share/qt4'
128+ ],
129+ 'bsd': [
130+ '/usr/local/lib/qt4'
131+ ],
132+ 'osx': [
133+ '/Library/Frameworks',
134+ glob.glob('/usr/local/lib/qt-4*'),
135+ glob.glob('/usr/local/Cellar/qt/4*'),
136+ ],
137+ 'windows': [
138+ glob.glob('C:\\qt\\4*'),
139+ ]
140+}
141+
142 class MixxxBuild(object):
143
144+ def locate_qtdir(self):
145+ """
146+ Try to locate Qt directory
147+ """
148+ qtdir = Script.ARGUMENTS.get('qtdir')
149+ try:
150+ default_dirs = DEFAULT_PLATFORM_QTDIRS[self.platform]
151+ except KeyError:
152+ raise Exception(
153+ 'QT directories for platform not configured: %s' % self.platform
154+ )
155+ for option in default_dirs:
156+ if isinstance(option,list):
157+ # Grab last entry from glob matches
158+ try:
159+ option = option[-1]
160+ except IndexError:
161+ continue
162+ if not os.path.isdir(option):
163+ continue
164+
165+ moc = os.path.join(option,"bin","moc")
166+ moc = self.platform == 'windows' and '%s.exe'%moc or moc
167+ if not os.path.isfile(moc):
168+ continue
169+ qtdir = option
170+ break
171+
172+ if not qtdir or not os.path.isdir(qtdir):
173+ raise Exception('QT directory not found')
174+ if Script.ARGUMENTS.get('qtdir')!=qtdir:
175+ Script.ARGUMENTS['qtdir'] = qtdir
176+ print 'QT directory detected: %s' % qtdir
177+ return qtdir
178+
179 def __init__(self, target, machine, build, toolchain, available_features=[]):
180 self.available_features = available_features
181 self.host_platform = self.detect_platform()
182@@ -118,11 +172,7 @@
183 tools.append('qt4')
184 tools.append('protoc')
185
186- # Ugly hack to check the qtdir argument
187- import depends
188- default_qtdir = depends.Qt.DEFAULT_QTDIRS.get(self.platform, '')
189- qtdir = Script.ARGUMENTS.get('qtdir',
190- os.environ.get('QTDIR', default_qtdir))
191+ qtdir = self.locate_qtdir()
192
193 # Validate the specified qtdir exists
194 if not os.path.exists(qtdir):
195
196=== modified file 'mixxx/build/osx/otool.py'
197--- mixxx/build/osx/otool.py 2012-05-16 15:19:32 +0000
198+++ mixxx/build/osx/otool.py 2012-08-14 05:15:28 +0000
199@@ -51,8 +51,15 @@
200 SYSTEM_FRAMEWORKS = ["/System/Library/Frameworks"]
201 SYSTEM_LIBPATH = ["/usr/lib"] #anything else?
202 #paths to libs that we should copy in
203-LOCAL_FRAMEWORKS = [os.path.expanduser("~/Library/Frameworks"), "/Library/Frameworks", "/Network/Library/Frameworks"]
204-LOCAL_LIBPATH = ["/usr/local/lib", "/opt/local/lib", "/sw/local/lib"]
205+LOCAL_FRAMEWORKS = [
206+ os.path.expanduser("~/Library/Frameworks"),
207+ "/Library/Frameworks",
208+ "/Network/Library/Frameworks"
209+]
210+LOCAL_LIBPATH = filter(lambda x:
211+ os.path.isdir(x),
212+ ["/usr/local/lib", "/opt/local/lib", "/sw/local/lib"]
213+)
214
215 #however
216 FRAMEWORKS = LOCAL_FRAMEWORKS + SYSTEM_FRAMEWORKS
217
218=== modified file 'mixxx/src/SConscript'
219--- mixxx/src/SConscript 2012-07-07 23:09:24 +0000
220+++ mixxx/src/SConscript 2012-08-14 05:15:28 +0000
221@@ -274,7 +274,13 @@
222 for tfile in translation_files:
223 resource_map[str(tfile)] = 'translations'
224
225+ qt_frameworks = os.path.join(build.env['QTDIR'],'Frameworks')
226+ #qt_menu.nib for Cocoa Qt 4.7+
227+ menu_nib = os.path.join(
228+ qt_frameworks,'QtGui.framework','Resources','qt_menu.nib'
229+ )
230 otool_local_paths = [os.path.expanduser("~/Library/Frameworks"),
231+ qt_frameworks,
232 "/Library/Frameworks",
233 "/Network/Library/Frameworks",
234 "/usr/local/lib",
235@@ -289,7 +295,8 @@
236
237 qtplugindir = SCons.ARGUMENTS.get('qtplugindir', None)
238 if not qtplugindir:
239- qtplugindir = '/Developer/Applications/Qt/'
240+ #qtplugindir = '/Developer/Applications/Qt/'
241+ qtplugindir = build.env['QTDIR']
242 bundle = env.App(
243 "Mixxx",
244 [mixxx_bin, '#res/osx/application.icns',
245@@ -301,7 +308,7 @@
246 Dir('#res/ladspa_presets'),
247 Dir('#res/doc/'),
248 Dir('#res/promo/'),
249- Dir('/Library/Frameworks/QtGui.framework/Resources/qt_menu.nib'), #qt_menu.nib for Cocoa Qt 4.7+
250+ Dir(menu_nib),
251 File("#README"),
252 File("#LICENSE")],
253 PLUGINS=plugins, ##XXX test what happens if we don't pass any plugins