mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 12:28:31 +01:00
Mac build & deploy updates.
This commit is contained in:
parent
42fd8c6f1e
commit
461157bbc9
@ -31,6 +31,10 @@ endif (LIBNOTIFY_FOUND)
|
|||||||
find_library(LASTFM_LIBRARY_DIRS lastfm)
|
find_library(LASTFM_LIBRARY_DIRS lastfm)
|
||||||
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
|
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
find_library(GROWL Growl)
|
||||||
|
endif (APPLE)
|
||||||
|
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||||
add_definitions(-DNDEBUG)
|
add_definitions(-DNDEBUG)
|
||||||
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
||||||
|
89
macdeploy.py
89
macdeploy.py
@ -5,12 +5,12 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
FRAMEWORK_SEARCH_PATH=['/Library/Frameworks', '~/Library/Frameworks']
|
FRAMEWORK_SEARCH_PATH=['/Library/Frameworks', os.path.join(os.environ['HOME'], 'Library/Frameworks')]
|
||||||
LIBRARY_SEARCH_PATH=['/usr/local/lib', '/sw/lib']
|
LIBRARY_SEARCH_PATH=['/usr/local/lib', '/sw/lib']
|
||||||
|
|
||||||
XINE_PLUGINS = [
|
XINE_PLUGINS = [
|
||||||
#'xineplug_decode_vorbis.so',
|
'xineplug_decode_vorbis.so',
|
||||||
#'xineplug_dmx_ogg.so',
|
'xineplug_dmx_ogg.so',
|
||||||
'xineplug_ao_out_coreaudio.so',
|
'xineplug_ao_out_coreaudio.so',
|
||||||
'xineplug_decode_a52.so',
|
'xineplug_decode_a52.so',
|
||||||
'xineplug_decode_dts.so',
|
'xineplug_decode_dts.so',
|
||||||
@ -32,6 +32,25 @@ XINEPLUGIN_SEARCH_PATH=[
|
|||||||
'/sw/lib/xine/plugins',
|
'/sw/lib/xine/plugins',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
QT_PLUGINS = [
|
||||||
|
'accessible/libqtaccessiblewidgets.dylib',
|
||||||
|
'codecs/libqcncodecs.dylib',
|
||||||
|
'codecs/libqjpcodecs.dylib',
|
||||||
|
'codecs/libqkrcodecs.dylib',
|
||||||
|
'codecs/libqtwcodecs.dylib',
|
||||||
|
'iconengines/libqsvgicon.dylib',
|
||||||
|
'imageformats/libqgif.dylib',
|
||||||
|
'imageformats/libqico.dylib',
|
||||||
|
'imageformats/libqjpeg.dylib',
|
||||||
|
'imageformats/libqmng.dylib',
|
||||||
|
'imageformats/libqsvg.dylib',
|
||||||
|
'imageformats/libqtiff.dylib',
|
||||||
|
'sqldrivers/libqsqlite.dylib',
|
||||||
|
]
|
||||||
|
QT_PLUGINS_SEARCH_PATH=[
|
||||||
|
'/Developer/Applications/Qt/plugins',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
pass
|
pass
|
||||||
@ -49,6 +68,10 @@ class CouldNotFindXinePluginError(Error):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class CouldNotFindQtPluginError(Error):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print 'Usage: %s <bundle.app>' % sys.argv[0]
|
print 'Usage: %s <bundle.app>' % sys.argv[0]
|
||||||
|
|
||||||
@ -56,15 +79,18 @@ bundle_dir = sys.argv[1]
|
|||||||
|
|
||||||
bundle_name = bundle_dir.split('.')[0]
|
bundle_name = bundle_dir.split('.')[0]
|
||||||
|
|
||||||
|
commands = []
|
||||||
|
|
||||||
frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks')
|
frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks')
|
||||||
|
commands.append(['mkdir', '-p', frameworks_dir])
|
||||||
resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources')
|
resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources')
|
||||||
|
commands.append(['mkdir', '-p', resources_dir])
|
||||||
plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns')
|
plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns')
|
||||||
binary = os.path.join(bundle_dir, 'Contents', 'MacOS', bundle_name)
|
binary = os.path.join(bundle_dir, 'Contents', 'MacOS', bundle_name)
|
||||||
|
|
||||||
fixed_libraries = []
|
fixed_libraries = []
|
||||||
fixed_frameworks = []
|
fixed_frameworks = []
|
||||||
|
|
||||||
|
|
||||||
def GetBrokenLibraries(binary):
|
def GetBrokenLibraries(binary):
|
||||||
output = subprocess.Popen(['otool', '-L', binary], stdout=subprocess.PIPE).communicate()[0]
|
output = subprocess.Popen(['otool', '-L', binary], stdout=subprocess.PIPE).communicate()[0]
|
||||||
broken_libs = {
|
broken_libs = {
|
||||||
@ -82,7 +108,10 @@ def GetBrokenLibraries(binary):
|
|||||||
elif re.match(r'^\s*\w+\.framework', line):
|
elif re.match(r'^\s*\w+\.framework', line):
|
||||||
broken_libs['frameworks'].append(line)
|
broken_libs['frameworks'].append(line)
|
||||||
elif re.match(r'^\s*@executable_path', line):
|
elif re.match(r'^\s*@executable_path', line):
|
||||||
continue # Already fixed library
|
# Potentially already fixed library
|
||||||
|
relative_path = os.path.join(*line.split('/')[3:])
|
||||||
|
if not os.path.exists(os.path.join(frameworks_dir, relative_path)):
|
||||||
|
broken_libs['frameworks'].append(relative_path)
|
||||||
else:
|
else:
|
||||||
broken_libs['libs'].append(line)
|
broken_libs['libs'].append(line)
|
||||||
|
|
||||||
@ -144,13 +173,11 @@ def FixLibrary(path):
|
|||||||
for library in broken_libs['libs']:
|
for library in broken_libs['libs']:
|
||||||
FixLibraryInstallPath(library, new_path)
|
FixLibraryInstallPath(library, new_path)
|
||||||
|
|
||||||
def FixPlugin(path):
|
def FixPlugin(abs_path, subdir):
|
||||||
abs_path = FindXinePlugin(path)
|
|
||||||
broken_libs = GetBrokenLibraries(abs_path)
|
broken_libs = GetBrokenLibraries(abs_path)
|
||||||
FixAllLibraries(broken_libs)
|
FixAllLibraries(broken_libs)
|
||||||
|
|
||||||
new_path = CopyPlugin(abs_path)
|
new_path = CopyPlugin(abs_path, subdir)
|
||||||
FixLibraryId(new_path)
|
|
||||||
for framework in broken_libs['frameworks']:
|
for framework in broken_libs['frameworks']:
|
||||||
FixFrameworkInstallPath(framework, new_path)
|
FixFrameworkInstallPath(framework, new_path)
|
||||||
for library in broken_libs['libs']:
|
for library in broken_libs['libs']:
|
||||||
@ -167,13 +194,15 @@ def FixBinary(path):
|
|||||||
def CopyLibrary(path):
|
def CopyLibrary(path):
|
||||||
new_path = os.path.join(frameworks_dir, os.path.basename(path))
|
new_path = os.path.join(frameworks_dir, os.path.basename(path))
|
||||||
args = ['cp', '-f', path, new_path]
|
args = ['cp', '-f', path, new_path]
|
||||||
print ' '.join(args)
|
commands.append(args)
|
||||||
return new_path
|
return new_path
|
||||||
|
|
||||||
def CopyPlugin(path):
|
def CopyPlugin(path, subdir):
|
||||||
new_path = os.path.join(plugins_dir, os.path.basename(path))
|
new_path = os.path.join(plugins_dir, subdir, os.path.basename(path))
|
||||||
|
args = ['mkdir', '-p', os.path.dirname(new_path)]
|
||||||
|
commands.append(args)
|
||||||
args = ['cp', '-f', path, new_path]
|
args = ['cp', '-f', path, new_path]
|
||||||
print ' '.join(args)
|
commands.append(args)
|
||||||
return new_path
|
return new_path
|
||||||
|
|
||||||
def CopyFramework(path):
|
def CopyFramework(path):
|
||||||
@ -183,15 +212,15 @@ def CopyFramework(path):
|
|||||||
full_path = os.path.join(frameworks_dir, *parts[i:-1])
|
full_path = os.path.join(frameworks_dir, *parts[i:-1])
|
||||||
break
|
break
|
||||||
args = ['mkdir', '-p', full_path]
|
args = ['mkdir', '-p', full_path]
|
||||||
print ' '.join(args)
|
commands.append(args)
|
||||||
args = ['cp', '-fR', path, full_path]
|
args = ['cp', '-f', path, full_path]
|
||||||
print ' '.join(args)
|
commands.append(args)
|
||||||
return os.path.join(frameworks_dir, path)
|
return os.path.join(frameworks_dir, path)
|
||||||
|
|
||||||
def FixId(path, library_name):
|
def FixId(path, library_name):
|
||||||
id = '@executable_path/../Frameworks/%s' % library_name
|
id = '@executable_path/../Frameworks/%s' % library_name
|
||||||
args = ['install_name_tool', '-id', id, path]
|
args = ['install_name_tool', '-id', id, path]
|
||||||
print ' '.join(args)
|
commands.append(args)
|
||||||
|
|
||||||
def FixLibraryId(path):
|
def FixLibraryId(path):
|
||||||
library_name = os.path.basename(path)
|
library_name = os.path.basename(path)
|
||||||
@ -202,7 +231,7 @@ def FixFrameworkId(path, id):
|
|||||||
|
|
||||||
def FixInstallPath(library_path, library, new_path):
|
def FixInstallPath(library_path, library, new_path):
|
||||||
args = ['install_name_tool', '-change', library_path, new_path, library]
|
args = ['install_name_tool', '-change', library_path, new_path, library]
|
||||||
print ' '.join(args)
|
commands.append(args)
|
||||||
|
|
||||||
def FixLibraryInstallPath(library_path, library):
|
def FixLibraryInstallPath(library_path, library):
|
||||||
new_path = '@executable_path/../Frameworks/%s' % os.path.basename(library_path)
|
new_path = '@executable_path/../Frameworks/%s' % os.path.basename(library_path)
|
||||||
@ -221,10 +250,32 @@ def FindXinePlugin(name):
|
|||||||
raise CouldNotFindXinePluginError(name)
|
raise CouldNotFindXinePluginError(name)
|
||||||
|
|
||||||
|
|
||||||
|
def FindQtPlugin(name):
|
||||||
|
for path in QT_PLUGINS_SEARCH_PATH:
|
||||||
|
if os.path.exists(path):
|
||||||
|
if os.path.exists(os.path.join(path, name)):
|
||||||
|
return os.path.join(path, name)
|
||||||
|
raise CouldNotFindQtPluginError(name)
|
||||||
|
|
||||||
|
|
||||||
FixBinary(binary)
|
FixBinary(binary)
|
||||||
|
|
||||||
for plugin in XINE_PLUGINS:
|
for plugin in XINE_PLUGINS:
|
||||||
FixPlugin(plugin)
|
FixPlugin(FindXinePlugin(plugin), 'xine')
|
||||||
|
|
||||||
|
for plugin in QT_PLUGINS:
|
||||||
|
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin))
|
||||||
|
|
||||||
|
print 'Would run %d commands:' % len(commands)
|
||||||
|
for command in commands:
|
||||||
|
print ' '.join(command)
|
||||||
|
|
||||||
|
print 'OK?'
|
||||||
|
raw_input()
|
||||||
|
|
||||||
|
for command in commands:
|
||||||
|
p = subprocess.Popen(command)
|
||||||
|
os.waitpid(p.pid, 0)
|
||||||
|
|
||||||
qtconf = open(os.path.join(resources_dir, 'qt.conf'), 'w')
|
qtconf = open(os.path.join(resources_dir, 'qt.conf'), 'w')
|
||||||
qtconf.write('''[Paths]
|
qtconf.write('''[Paths]
|
||||||
|
@ -168,6 +168,7 @@ if (APPLE)
|
|||||||
target_link_libraries(clementine_lib
|
target_link_libraries(clementine_lib
|
||||||
${GROWL}
|
${GROWL}
|
||||||
)
|
)
|
||||||
|
include_directories(${GROWL}/Headers)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
add_dependencies(clementine_lib qtsingleapplication qxt)
|
add_dependencies(clementine_lib qtsingleapplication qxt)
|
||||||
|
|
||||||
@ -180,7 +181,7 @@ target_link_libraries(clementine clementine_lib)
|
|||||||
|
|
||||||
set_property(TARGET clementine
|
set_property(TARGET clementine
|
||||||
PROPERTY COMPILE_FLAGS
|
PROPERTY COMPILE_FLAGS
|
||||||
"-Werror=non-virtual-dtor -Woverloaded-virtual -Wall"
|
"-Wnon-virtual-dtor -Woverloaded-virtual -Wall"
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(clementine PROPERTIES
|
set_target_properties(clementine PROPERTIES
|
||||||
@ -189,14 +190,5 @@ set_target_properties(clementine PROPERTIES
|
|||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
|
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bundle
|
|
||||||
mkdir -p Frameworks/
|
|
||||||
COMMAND mkdir -p PlugIns/xine
|
|
||||||
COMMAND mkdir -p Resources/
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../clementine.app/Contents/
|
|
||||||
)
|
|
||||||
add_dependencies(bundle clementine)
|
|
||||||
|
|
||||||
install(TARGETS clementine
|
install(TARGETS clementine
|
||||||
BUNDLE DESTINATION bin
|
BUNDLE DESTINATION bin)
|
||||||
RUNTIME DESTINATION bin)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user