--- SConstruct.orig 2012-02-13 18:17:02.000000000 +1100 +++ SConstruct 2012-03-08 15:57:06.000000000 +1100 @@ -353,6 +353,7 @@ fileOptions.Add('customLIBS') fileOptions.Add('customLIBPATH') fileOptions.Add('customSHLINKFLAGS') +fileOptions.Add('customLINKFLAGS') fileOptions.Add('customSWIGFLAGS') fileOptions.Update(commonEnvironment) @@ -368,6 +369,8 @@ commonEnvironment.Prepend(LIBPATH = customLIBPATH) customSHLINKFLAGS = commonEnvironment['customSHLINKFLAGS'] commonEnvironment.Prepend(SHLINKFLAGS = customSHLINKFLAGS) +customLINKFLAGS = commonEnvironment['customLINKFLAGS'] +commonEnvironment.Prepend(LINKFLAGS = customLINKFLAGS) customSWIGFLAGS = commonEnvironment['customSWIGFLAGS'] commonEnvironment.Prepend(SWIGFLAGS = customSWIGFLAGS) @@ -475,7 +478,7 @@ else: commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/local/lib64']) else: - commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/local/lib']) + commonEnvironment.Prepend(LIBPATH = ['.', '#.']) if commonEnvironment['Word64'] == '1': if compilerSun(): @@ -510,7 +513,6 @@ commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic']) elif getPlatform() == 'darwin': commonEnvironment.Append(CCFLAGS = "-DMACOSX") - commonEnvironment.Append(CPPPATH = '/usr/local/include') commonEnvironment.Append(CCFLAGS = "-DPIPES") if commonEnvironment['useAltivec'] == '1': print 'CONFIGURATION DECISION: Using Altivec optimisation' @@ -929,7 +931,7 @@ s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp csoundLibraryEnvironment.Append(CPPFLAGS = [s]) elif buildOSXFramework != 0: - tmp = '/Library/Frameworks/%s' % OSXFrameworkCurrentVersion + tmp = '__FRAMEWORKS_DIR__/%s' % OSXFrameworkCurrentVersion tmp += '/Resources/Opcodes' if commonEnvironment['useDouble'] != '0': tmp += '64' @@ -1026,7 +1028,7 @@ os.symlink(i[1], '%s/%s' % (OSXFrameworkBaseDir, i[0])) def MacOSX_InstallHeader(headerName): - if not buildOSXFramework: + if not buildOSXFramework or commonEnvironment['install'] != '1': return baseName = headerName[(headerName.rfind('/') + 1):] targetName = '%s/Headers/%s' % (OSXFrameworkCurrentVersion, baseName) @@ -1038,8 +1040,8 @@ csoundFrameworkEnvironment.Command(targetName, headerName, cmd) def MacOSX_InstallPlugin(fileName): - if buildOSXFramework: - print "COPYINNG plugin" + if buildOSXFramework and commonEnvironment['install'] == '1': + print "COPYING plugin" pluginDir = '%s/Resources/Opcodes' % OSXFrameworkCurrentVersion if commonEnvironment['useDouble'] != '0': pluginDir += '64' @@ -1227,6 +1229,7 @@ libCsoundSources += newParserSources csoundLibraryEnvironment.Append(CCFLAGS='-fPIC') +append_csoundLibrary_to_libs = True if commonEnvironment['dynamicCsoundLibrary'] == '1': print 'CONFIGURATION DECISION: Building dynamic Csound library' if getPlatform() == 'linux' or getPlatform() == 'sunos': @@ -1256,7 +1259,7 @@ -Xlinker -current_version -Xlinker %s ''' % libVersion)) csoundFrameworkEnvironment.Append(SHLINKFLAGS = Split(''' - -install_name /Library/Frameworks/%s/%s + -install_name __FRAMEWORKS_DIR__/%s/%s ''' % (OSXFrameworkCurrentVersion, libName))) csoundLibraryFile = csoundFrameworkEnvironment.SharedLibrary( libName, libCsoundSources, SHLIBPREFIX = '', SHLIBSUFFIX = '') @@ -1266,10 +1269,16 @@ 'cp -f %s %s/' % (libName, OSXFrameworkCurrentVersion)) for i in headers: MacOSX_InstallHeader(i) + CsoundLib_install_path = '%s__FRAMEWORKS_DIR__/%s' % (commonEnvironment['instdir'], OSXFrameworkBaseDir) + if commonEnvironment['install'] == '1': + CsoundLib_install_cmd = 'rm -r CsoundLib_install_path; cp -R %s %s__FRAMEWORKS_DIR__/' % (OSXFrameworkBaseDir, commonEnvironment['instdir']) + else: + CsoundLib_install_cmd = 'true' csoundLibrary = csoundFrameworkEnvironment.Command( - 'CsoundLib_install', + 'CsoundLib.framework', libName, - 'rm -r /Library/Frameworks/%s; cp -R %s /Library/Frameworks/' % (OSXFrameworkBaseDir, OSXFrameworkBaseDir)) + CsoundLib_install_cmd) + append_csoundLibrary_to_libs = False libCsoundLinkFlags += ['-F.', '-framework', libName, '-lsndfile'] libCsoundLibs = [] elif getPlatform() == 'win32': @@ -1290,15 +1299,16 @@ libCsoundLibs.insert(0,csoundLibrary) elif getPlatform() == 'win32' or (getPlatform() == 'darwin' and commonEnvironment['dynamicCsoundLibrary']=='0'): libCsoundLibs.append(csoundLibraryName) -libs.append(csoundLibrary) +if append_csoundLibrary_to_libs: + libs.append(csoundLibrary) pluginEnvironment = commonEnvironment.Clone() pluginEnvironment.Append(LIBS = Split('sndfile')) if getPlatform() == 'darwin': - pluginEnvironment.Append(LINKFLAGS = Split(''' - -framework CoreMidi -framework CoreFoundation -framework CoreServices -framework CoreAudio - ''')) + # Append is behaving like AppendUnique and eating "duplicate" -framework args for some reason... + for f in ['CoreMIDI', 'CoreFoundation', 'CoreServices', 'CoreAudio']: + pluginEnvironment.Append(FRAMEWORKS = [f]) # pluginEnvironment.Append(LINKFLAGS = ['-dynamiclib']) pluginEnvironment['SHLIBSUFFIX'] = '.dylib' # pluginEnvironment.Prepend(CXXFLAGS = "-fno-rtti") @@ -1402,14 +1412,14 @@ csoundInterfacesEnvironment.Append(SHLINKFLAGS = Split( '''-Xlinker -current_version -Xlinker %s''' % ilibVersion)) tmp = '''-install_name - /Library/Frameworks/%s/%s''' + __FRAMEWORKS_DIR__/%s/%s''' csoundInterfacesEnvironment.Append(SHLINKFLAGS = Split( tmp % (OSXFrameworkCurrentVersion,ilibName))) csnd = csoundInterfacesEnvironment.SharedLibrary( '_csnd', csoundInterfacesSources) try: os.symlink('lib_csnd.dylib', 'libcsnd.dylib') except: pass - csoundInterfacesEnvironment.Command('interfaces install', csnd, "cp lib_csnd.dylib /Library/Frameworks/%s/lib_csnd.dylib" % (OSXFrameworkCurrentVersion)) + csoundInterfacesEnvironment.Command('interfaces install', csnd, "cp lib_csnd.dylib __FRAMEWORKS_DIR__/%s/lib_csnd.dylib" % (OSXFrameworkCurrentVersion)) else: csnd = csoundInterfacesEnvironment.Library('csnd', csoundInterfacesSources) elif getPlatform() == 'linux': @@ -1826,7 +1836,8 @@ vstEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm']) guiProgramEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm']) if getPlatform() == 'darwin': - csoundProgramEnvironment.Append(LINKFLAGS = Split('''-framework Carbon -framework CoreAudio -framework CoreMidi''')) + for f in ['Carbon', 'CoreAudio', 'CoreMIDI']: + csoundProgramEnvironment.Append(FRAMEWORKS = [f]) if (not (commonEnvironment['useFLTK'] == '1' and fltkFound)): print 'CONFIGURATION DECISION: Not building with FLTK graphs and widgets.' @@ -2009,7 +2020,7 @@ vst4Environment = vstEnvironment.Clone() vst4Environment.Append(LIBS = ['fltk']) vst4Environment.Append(LIBS = ['stdc++']) - vst4Environment.Append(LINKFLAGS=['-framework', 'carbon', '-framework', + vst4Environment.Append(LINKFLAGS=['-framework', 'Carbon', '-framework', 'ApplicationServices']) vst4Environment.Append(CPPPATH = ['frontends/CsoundVST']) vst4Environment.Append(CPPFLAGS = ['-DCS_VSTHOST']) @@ -2193,7 +2204,6 @@ luaEnvironment['ENV']['PATH'] = os.environ['PATH'] elif getPlatform() == 'darwin': luaEnvironment.Append(LIBS = 'luajit-51') - luaEnvironment.Append(CPPPATH = '/usr/local/include/luajit-2.0') luaEnvironment.Append(CPPFLAGS = '-fopenmp') luaOpcodes = makePlugin(luaEnvironment, 'LuaCsound', ['Opcodes/LuaCsound.cpp']) @@ -2753,7 +2763,7 @@ csWinEnvironment.Append(CXXFLAGS = ['-fno-rtti']) csWinEnvironment.Append(LIBS = ['fltk', 'stdc++', 'pthread', 'm']) csWinEnvironment.Append(LINKFLAGS = Split(''' - -framework Carbon -framework CoreAudio -framework CoreMidi + -framework Carbon -framework CoreAudio -framework CoreMIDI -framework ApplicationServices ''')) appDir = 'frontends/winsound/Winsound.app/Contents/MacOS'