1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-15 01:56:54 +01:00

More macos fixes

This commit is contained in:
Jonas Kvinge 2018-07-03 17:51:52 +02:00
parent efdaf57f99
commit ab3569a285
25 changed files with 2393 additions and 106 deletions

View File

@ -132,7 +132,7 @@ public:
[nsButton setButtonType:NSMomentaryPushInButton];
}
// [nsButton setBezelStyle:bezelStyle];
[nsButton setBezelStyle:(__bridge NSBezelStyle)bezelStyle];
}
void clicked()

View File

@ -5,8 +5,8 @@ set(RPM_DISTRO suse CACHE STRING "Suffix of the rpm file")
set(RPM_ARCH x86_64 CACHE STRING "Architecture of the rpm file")
add_custom_target(rpm
COMMAND ${CMAKE_SOURCE_DIR}/dist/maketarball.sh
COMMAND ${CMAKE_SOURCE_DIR}/dist/scripts/maketarball.sh
COMMAND ${CMAKE_COMMAND} -E copy strawberry-${STRAWBERRY_VERSION_PACKAGE}.tar.xz ${RPMBUILD_DIR}/SOURCES/
COMMAND rpmbuild -bs ${CMAKE_SOURCE_DIR}/dist/strawberry.spec
COMMAND rpmbuild -bb ${CMAKE_SOURCE_DIR}/dist/strawberry.spec
COMMAND rpmbuild -bs ${CMAKE_SOURCE_DIR}/dist/rpm/strawberry.spec
COMMAND rpmbuild -bb ${CMAKE_SOURCE_DIR}/dist/rpm/strawberry.spec
)

17
dist/CMakeLists.txt vendored
View File

@ -1,14 +1,19 @@
set(ENV{LC_ALL} "en_US.utf8")
execute_process(COMMAND date "+%a %b %d %Y" OUTPUT_VARIABLE RPM_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/strawberry.spec.in ${CMAKE_CURRENT_SOURCE_DIR}/strawberry.spec @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/maketarball.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/maketarball.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rpm/strawberry.spec.in ${CMAKE_CURRENT_SOURCE_DIR}/rpm/strawberry.spec @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/maketarball.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/scripts/maketarball.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist.in ${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist)
if (UNIX)
if (UNIX AND NOT APPLE)
install(FILES ../data/icons/48x48/strawberry.png DESTINATION share/icons/hicolor/48x48/apps/)
install(FILES ../data/icons/64x64/strawberry.png DESTINATION share/icons/hicolor/64x64/apps/)
install(FILES ../data/icons/128x128/strawberry.png DESTINATION share/icons/hicolor/128x128/apps/)
install(FILES ../data/icons/128x128/strawberry.svg DESTINATION share/icons/hicolor/scalable/apps/)
install(FILES strawberry.desktop DESTINATION share/applications)
install(FILES strawberry.1 strawberry-tagreader.1 DESTINATION share/man/man1)
endif (UNIX)
install(FILES unix/strawberry.desktop DESTINATION share/applications)
install(FILES man/strawberry.1 man/strawberry-tagreader.1 DESTINATION share/man/man1)
endif()
if (APPLE)
install(FILES macos/strawberry.icns DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
endif()

235
dist/macos/Info.plist.in vendored Normal file
View File

@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>strawberry</string>
<key>CFBundleGetInfoString</key>
<string>Strawberry ${STRAWBERRY_VERSION_DISPLAY}</string>
<key>CFBundleIconFile</key>
<string>strawberry</string>
<key>CFBundleIdentifier</key>
<string>org.strawberry.strawberry</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${STRAWBERRY_VERSION_DISPLAY}</string>
<key>CFBundleName</key>
<string>Strawberry</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${STRAWBERRY_VERSION_DISPLAY}</string>
<key>CFBundleVersion</key>
<string>${STRAWBERRY_VERSION_PACKAGE}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>LSMinimumSystemVersion</key>
<string>10.7.0</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
<string>fold</string>
<string>disk</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>xspf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Generic.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/xspf+xml</string>
</array>
<key>CFBundleTypeName</key>
<string>XSPF Playlist</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wav</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/x-wav</string>
</array>
<key>CFBundleTypeName</key>
<string>WAVE Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pls</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>pls.icns</string>
<key>CFBundleTypeName</key>
<string>Shoutcast playlist</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m3u</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>m3u.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/x-mpegurl</string>
</array>
<key>CFBundleTypeName</key>
<string>Playlist file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aac</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>mpeg4.icns</string>
<key>CFBundleTypeName</key>
<string>AAC file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ogg</string>
<string>ogx</string>
<string>ogm</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>ogg.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/ogg</string>
</array>
<key>CFBundleTypeName</key>
<string>Ogg Vorbis File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>oga</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>ogg.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/ogg</string>
</array>
<key>CFBundleTypeName</key>
<string>Ogg Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wma</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>wma.icns</string>
<key>CFBundleTypeName</key>
<string>WIndows Media Audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp3</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>mp3.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/mpeg</string>
</array>
<key>CFBundleTypeName</key>
<string>MPEG Audio Layer 3</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>3gp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>generic.icns</string>
<key>CFBundleTypeName</key>
<string>3GPP File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m4a</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>mpeg4.icns</string>
<key>CFBundleTypeName</key>
<string>MPEG-4 Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mpc</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>generic.icns</string>
<key>CFBundleTypeName</key>
<string>Musepack Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>flac</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>generic.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/flac</string>
</array>
<key>CFBundleTypeName</key>
<string>FLAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
</dict>
</plist>

52
dist/macos/create-dmg.sh vendored Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
# author: max@last.fm, muesli@tomahawk-player.org
# brief: Produces a compressed DMG from a bundle directory
# usage: Pass the bundle directory as the only parameter
# note: This script depends on the Tomahawk build system, and must be run from
# the build directory
################################################################################
#if [ -z $VERSION ]
#then
# echo VERSION must be set
# exit 2
#fi
if [ -z "$1" ]
then
echo "Please pass the bundle.app directory as the first parameter."
exit 3
fi
################################################################################
NAME=$(basename "$1" | perl -pe 's/(.*).app/\1/')
IN="$1"
TMP="dmg/$NAME"
OUT="$NAME.dmg"
mkdir -p "$TMP"
################################################################################
# clean up
rm -rf "$TMP"
rm -f "$OUT"
# create DMG contents and copy files
mkdir -p "$TMP/.background"
#cp ../dist/macos/dmg_background.png "$TMP/.background/background.png"
#cp ../dist/macos/DS_Store.in "$TMP/.DS_Store"
#chmod go-rwx "$TMP/.DS_Store"
ln -s /Applications "$TMP/Applications"
# copies the prepared bundle into the dir that will become the DMG
cp -R "$IN" "$TMP"
# create
hdiutil makehybrid -hfs -hfs-volume-name "$NAME" -hfs-openfolder "$TMP" "$TMP" -o tmp.dmg
hdiutil convert -format UDZO -imagekey zlib-level=9 tmp.dmg -o "$OUT"
#genisoimage -D -V "Strawberry" -no-pad -r -apple -o $NAME.iso $TMP
#dmg dmg $NAME.iso $OUT
# cleanup
#rm tmp.dmg

489
dist/macos/macdeploy.py vendored Executable file
View File

@ -0,0 +1,489 @@
#!/usr/bin/python
# Strawberry Music Player
# This file was part of Clementine.
#
# Strawberry is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Strawberry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
from distutils import spawn
import logging
import os
import re
import subprocess
import commands
import sys
import traceback
LOGGER = logging.getLogger('macdeploy')
LIBRARY_SEARCH_PATH = ['/usr/local/lib']
FRAMEWORK_SEARCH_PATH = [
'/Library/Frameworks',
os.path.join(os.environ['HOME'], 'Library/Frameworks')
]
QT_PLUGINS = [
'platforms/libqcocoa.dylib',
'sqldrivers/libqsqlite.dylib',
'imageformats/libqgif.dylib',
'imageformats/libqicns.dylib',
'imageformats/libqico.dylib',
'imageformats/libqjpeg.dylib',
'imageformats/libqsvg.dylib',
'imageformats/libqtiff.dylib',
]
QT_PLUGINS_SEARCH_PATH = [
'/usr/local/opt/qt/plugins',
]
GSTREAMER_SEARCH_PATH = [
'/usr/local/lib/gstreamer-1.0',
]
GSTREAMER_PLUGINS = [
'libgstapetag.so',
'libgstapp.so',
'libgstaudioconvert.so',
'libgstaudiofx.so',
'libgstaudiomixer.so',
'libgstaudioparsers.so',
'libgstaudiorate.so',
'libgstaudioresample.so',
'libgstaudiotestsrc.so',
'libgstauparse.so',
'libgstautodetect.so',
'libgstcoreelements.so',
'libgstcoretracers.so',
'libgstcutter.so',
'libgstdebug.so',
'libgstequalizer.so',
'libgstgio.so',
'libgsticydemux.so',
'libgstid3demux.so',
'libgstlevel.so',
'libgstosxaudio.so',
'libgstplayback.so',
'libgstrawparse.so',
'libgstrealmedia.so',
'libgstreplaygain.so',
'libgstsoup.so',
'libgstspectrum.so',
'libgsttypefindfunctions.so',
'libgstvolume.so',
'libgstxingmux.so',
'libgstflac.so',
'libgstwavparse.so',
'libgstfaac.so',
'libgstfaad.so',
'libgstlame.so',
'libgstmad.so',
'libgstogg.so',
'libgstopus.so',
'libgstasf.so',
'libgstspeex.so',
'libgsttaglib.so',
'libgstvorbis.so',
'libgstisomp4.so',
]
GIO_MODULES_SEARCH_PATH = ['/usr/local/lib/gio/modules',]
INSTALL_NAME_TOOL_APPLE = 'install_name_tool'
INSTALL_NAME_TOOL_CROSS = 'x86_64-apple-darwin-%s' % INSTALL_NAME_TOOL_APPLE
INSTALL_NAME_TOOL = INSTALL_NAME_TOOL_CROSS if spawn.find_executable(
INSTALL_NAME_TOOL_CROSS) else INSTALL_NAME_TOOL_APPLE
OTOOL_APPLE = 'otool'
OTOOL_CROSS = 'x86_64-apple-darwin-%s' % OTOOL_APPLE
OTOOL = OTOOL_CROSS if spawn.find_executable(OTOOL_CROSS) else OTOOL_APPLE
class Error(Exception):
pass
class CouldNotFindFrameworkError(Error):
pass
class CouldNotFindGioModuleError(Error):
pass
class CouldNotFindQtPluginError(Error):
pass
class CouldNotParseFrameworkNameError(Error):
pass
class InstallNameToolError(Error):
pass
class CouldNotFindGstreamerPluginError(Error):
pass
class CouldNotFindXinePluginError(Error):
pass
class CouldNotFindVLCPluginError(Error):
pass
if len(sys.argv) < 2:
print 'Usage: %s <bundle.app>' % sys.argv[0]
bundle_dir = sys.argv[1]
bundle_name = os.path.basename(bundle_dir).split('.')[0]
commands = []
frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks')
commands.append(['mkdir', '-p', frameworks_dir])
resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources')
commands.append(['mkdir', '-p', resources_dir])
plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns')
binary = os.path.join(bundle_dir, 'Contents', 'MacOS', bundle_name)
fixed_libraries = set()
fixed_frameworks = set()
def GetBrokenLibraries(binary):
#print "Checking libs for binary: %s" % binary
output = subprocess.Popen([OTOOL, '-L', binary], stdout=subprocess.PIPE).communicate()[0]
broken_libs = {'frameworks': [], 'libs': []}
for line in [x.split(' ')[0].lstrip() for x in output.split('\n')[1:]]:
#print "Checking line: %s" % line
if not line: # skip empty lines
continue
if os.path.basename(binary) == os.path.basename(line):
#print "mnope %s-%s" % (os.path.basename(binary), os.path.basename(line))
continue
if re.match(r'^\s*/System/', line):
continue # System framework
elif re.match(r'^\s*/usr/lib/', line):
#print "unix style system lib"
continue # unix style system library
elif re.match(r'^\s*@executable_path', line) or re.match(r'^\s*@loader_path', line):
# 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)
elif re.search(r'\w+\.framework', line):
broken_libs['frameworks'].append(line)
else:
broken_libs['libs'].append(line)
return broken_libs
def FindFramework(path):
for search_path in FRAMEWORK_SEARCH_PATH:
abs_path = os.path.join(search_path, path)
if os.path.exists(abs_path):
LOGGER.debug("Found framework '%s' in '%s'", path, search_path)
return abs_path
raise CouldNotFindFrameworkError(path)
def FindLibrary(path):
if os.path.exists(path):
return path
for search_path in LIBRARY_SEARCH_PATH:
abs_path = os.path.join(search_path, path)
if os.path.exists(abs_path):
LOGGER.debug("Found library '%s' in '%s'", path, search_path)
return abs_path
else: # try harder---look for lib name in library folders
newpath = os.path.join(search_path,os.path.basename(path))
if os.path.exists(newpath):
return newpath
raise CouldNotFindFrameworkError(path)
def FixAllLibraries(broken_libs):
for framework in broken_libs['frameworks']:
FixFramework(framework)
for lib in broken_libs['libs']:
FixLibrary(lib)
def FixFramework(path):
if path in fixed_frameworks:
return
else:
fixed_frameworks.add(path)
abs_path = FindFramework(path)
broken_libs = GetBrokenLibraries(abs_path)
FixAllLibraries(broken_libs)
new_path = CopyFramework(abs_path)
id = os.sep.join(new_path.split(os.sep)[3:])
FixFrameworkId(new_path, id)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, new_path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, new_path)
def FixLibrary(path):
if path in fixed_libraries or FindSystemLibrary(os.path.basename(path)) is not None:
return
else:
fixed_libraries.add(path)
abs_path = FindLibrary(path)
if abs_path == "":
print "Could not resolve %s, not fixing!" % path
return
broken_libs = GetBrokenLibraries(abs_path)
FixAllLibraries(broken_libs)
new_path = CopyLibrary(abs_path)
FixLibraryId(new_path)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, new_path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, new_path)
def FixPlugin(abs_path, subdir):
broken_libs = GetBrokenLibraries(abs_path)
FixAllLibraries(broken_libs)
new_path = CopyPlugin(abs_path, subdir)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, new_path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, new_path)
def FixBinary(path):
broken_libs = GetBrokenLibraries(path)
FixAllLibraries(broken_libs)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, path)
def CopyLibrary(path):
new_path = os.path.join(frameworks_dir, os.path.basename(path))
#args = ['cp', path, new_path]
args = ['ditto', '--arch=i386', '--arch=x86_64', path, new_path]
LOGGER.info("Copying library '%s'", path)
commands.append(args)
args = ['chmod', 'u+w', new_path]
commands.append(args)
return new_path
def CopyPlugin(path, subdir):
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', path, new_path]
args = ['ditto', '--arch=i386', '--arch=x86_64', path, new_path]
commands.append(args)
LOGGER.info("Copying plugin '%s'", path)
args = ['chmod', 'u+w', new_path]
commands.append(args)
return new_path
def CopyFramework(path):
parts = path.split(os.sep)
for i, part in enumerate(parts):
if re.match(r'\w+\.framework', part):
full_path = os.path.join(frameworks_dir, *parts[i:-1])
framework_name = part.split(".framework")[0]
break
def CopyFramework(src_binary):
while os.path.islink(src_binary):
src_binary = os.path.realpath(src_binary)
m = re.match(r'(.*/([^/]+)\.framework)/Versions/([^/]+)/.*', src_binary)
if not m:
raise CouldNotParseFrameworkNameError(src_binary)
src_base = m.group(1)
name = m.group(2)
version = m.group(3)
LOGGER.info('Copying framework %s version %s', name, version)
dest_base = os.path.join(frameworks_dir, '%s.framework' % name)
dest_dir = os.path.join(dest_base, 'Versions', version)
dest_binary = os.path.join(dest_dir, name)
commands.append(['mkdir', '-p', dest_dir])
commands.append(['cp', src_binary, dest_binary])
# Copy special files from various places:
# QtCore has Resources/qt_menu.nib (copy to app's Resources)
# Sparkle has Resources/*
# Qt* have Resources/Info.plist
resources_src = os.path.join(src_base, 'Resources')
menu_nib = os.path.join(resources_src, 'qt_menu.nib')
if os.path.exists(menu_nib):
LOGGER.info("Copying qt_menu.nib '%s'", menu_nib)
commands.append(['cp', '-r', menu_nib, resources_dir])
elif os.path.exists(resources_src):
LOGGER.info("Copying resources dir '%s'", resources_src)
commands.append(['cp', '-r', resources_src, dest_dir])
info_plist = os.path.join(src_base, 'Contents', 'Info.plist')
if os.path.exists(info_plist):
LOGGER.info("Copying special file '%s'", info_plist)
resources_dest = os.path.join(dest_dir, 'Resources')
commands.append(['mkdir', resources_dest])
commands.append(['cp', '-r', info_plist, resources_dest])
# Create symlinks in the Framework to make it look like
# https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
commands.append([
'ln', '-sf', 'Versions/Current/%s' % name, os.path.join(dest_base, name)
])
commands.append([
'ln', '-sf', 'Versions/Current/Resources',
os.path.join(dest_base, 'Resources')
])
commands.append(
['ln', '-sf', version, os.path.join(dest_base, 'Versions/Current')])
return dest_binary
def FixId(path, library_name):
id = '@executable_path/../Frameworks/%s' % library_name
args = [INSTALL_NAME_TOOL, '-id', id, path]
commands.append(args)
def FixLibraryId(path):
library_name = os.path.basename(path)
FixId(path, library_name)
def FixFrameworkId(path, id):
FixId(path, id)
def FixInstallPath(library_path, library, new_path):
args = [INSTALL_NAME_TOOL, '-change', library_path, new_path, library]
commands.append(args)
def FindSystemLibrary(library_name):
for path in ['/lib', '/usr/lib']:
full_path = os.path.join(path, library_name)
if os.path.exists(full_path):
return full_path
return None
def FixLibraryInstallPath(library_path, library):
system_library = FindSystemLibrary(os.path.basename(library_path))
if system_library is None:
new_path = '@executable_path/../Frameworks/%s' % os.path.basename(library_path)
FixInstallPath(library_path, library, new_path)
else:
FixInstallPath(library_path, library, system_library)
def FixFrameworkInstallPath(library_path, library):
parts = library_path.split(os.sep)
for i, part in enumerate(parts):
if re.match(r'\w+\.framework', part):
full_path = os.path.join(*parts[i:])
break
new_path = '@executable_path/../Frameworks/%s' % full_path
FixInstallPath(library_path, library, new_path)
def FindXinePlugin(name):
for path in XINEPLUGIN_SEARCH_PATH:
if os.path.exists(path):
for dir, dirs, files in os.walk(path):
if name in files:
return os.path.join(dir, 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)
def FindGstreamerPlugin(name):
for path in GSTREAMER_SEARCH_PATH:
if os.path.exists(path):
for dir, dirs, files in os.walk(path):
if name in files:
return os.path.join(dir, name)
raise CouldNotFindGstreamerPluginError(name)
def FindGioModule(name):
for path in GIO_MODULES_SEARCH_PATH:
if os.path.exists(path):
for dir, dirs, files in os.walk(path):
if name in files:
return os.path.join(dir, name)
raise CouldNotFindGioModuleError(name)
def main():
logging.basicConfig(filename='macdeploy.log', level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s')
FixBinary(binary)
for plugin in GSTREAMER_PLUGINS:
FixPlugin(FindGstreamerPlugin(plugin), 'gstreamer')
#FixPlugin(FindGstreamerPlugin('gst-plugin-scanner'), '.')
FixPlugin(FindGioModule('libgiognutls.so'), 'gio-modules')
FixPlugin(FindGioModule('libgiognomeproxy.so'), 'gio-modules')
try:
FixPlugin('strawberry-tagreader', '.')
except:
print 'Failed to find blob: %s' % traceback.format_exc()
for plugin in QT_PLUGINS:
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin))
if len(sys.argv) <= 2:
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)
if __name__ == "__main__":
main()

BIN
dist/macos/strawberry.icns vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

114
dist/scripts/gen-icons-resource.sh vendored Executable file
View File

@ -0,0 +1,114 @@
#!/bin/sh
sizes="128x128 64x64 48x48 32x32 22x22"
#
for i in full/*
do
source=$i
file=`basename $i`
id=`identify "$i"` || exit 1
if [ "$id" = "" ] ; then
echo "ERROR: Cannot dermine format and geometry for image: \"$i\"."
continue
fi
g=`echo $id | awk '{print $3}'` || exit 1
if [ "$g" = "" ] ; then
echo "ERROR: Cannot dermine geometry for image: \"$i\"."
continue
fi
# Geometry can be 563x144+0+0 or 75x98
# we need to get rid of the plus (+) and the x characters:
w=`echo $g | sed 's/[^0-9]/ /g' | awk '{print $1}'` || exit 1
if [ "$w" = "" ] ; then
echo "ERROR: Cannot dermine width for image: \"$x\"."
continue
fi
h=`echo $g | sed 's/[^0-9]/ /g' | awk '{print $2}'` || exit 1
if [ "$h" = "" ] ; then
echo "ERROR: Cannot dermine height for image: \"$x\"."
continue
fi
for x in $sizes
do
dest="$x/$file"
if [ -f $dest ]; then
continue
fi
x_w=$(echo $x | cut -d 'x' -f1)
x_h=$(echo $x | cut -d 'x' -f2)
if [ "$w" -lt "$x_w" ] || [ "$h" -lt "$x_h" ]; then
continue
fi
echo "convert -verbose -resize $x $source $dest"
convert -verbose -resize $x $source $dest
done
done
for i in $sizes
do
for x in $i/*
do
file=`basename $x`
if ! [ -f "full/$file" ]; then
echo "Warning: full/$file does not exist, but $x exists."
fi
id=`identify "$x"` || exit 1
if [ "$id" = "" ] ; then
echo "ERROR: Cannot dermine format and geometry for image: \"$x\"."
continue
fi
g=`echo $id | awk '{print $3}'` || exit 1
if [ "$g" = "" ] ; then
echo "ERROR: Cannot dermine geometry for image: \"$x\"."
continue
fi
# Geometry can be 563x144+0+0 or 75x98
# we need to get rid of the plus (+) and the x characters:
w=`echo $g | sed 's/[^0-9]/ /g' | awk '{print $1}'` || exit 1
if [ "$w" = "" ] ; then
echo "ERROR: Cannot dermine width for image: \"$x\"."
continue
fi
h=`echo $g | sed 's/[^0-9]/ /g' | awk '{print $2}'` || exit 1
if [ "$h" = "" ] ; then
echo "ERROR: Cannot dermine height for image: \"$x\"."
continue
fi
if ! [ "${h}x${w}" = "$i" ]; then
echo "Warning: $x is not $i, but ${h}x${w}!"
fi
done
done
file="../icons.qrc"
rm -rf "$file"
echo "<RCC>" >>$file
echo "<qresource prefix=\"/\">" >>$file
for i in full $sizes
do
for x in $i/*
do
f=`basename $x`
echo " <file>icons/$i/$f</file>" >>$file
done
done
echo "</qresource>" >>$file
echo "</RCC>" >>$file

View File

@ -3,7 +3,7 @@
name=strawberry
version="@STRAWBERRY_VERSION_PACKAGE@"
gitrev="@INCLUDE_GIT_REVISION@"
root=$(cd "${0%/*}/.." && echo $PWD/${0##*/})
root=$(cd "${0%/*}/../.." && echo $PWD/${0##*/})
root=`dirname "$root"`
rootnoslash=`echo $root | sed "s/^\///"`

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

676
dist/windows/Capabilities.nsh vendored Normal file
View File

@ -0,0 +1,676 @@
/*
_____________________________________________________________________________
Application Capabilities (Default Programs)
_____________________________________________________________________________
By Joel Spadin
Loosely based on code taken from http://nsis.sourceforge.net/File_Association
These functions register an application with Windows Vista's and Windows 7's
Default Programs window.
Usage:
!include "Capabilities.nsh"
!define CAPABILITIES_NAME "[program name]"
!define CAPABILITIES_DESCRIPTION "[description]"
!define CAPABILITIES_PROGID "[progid]"
!define CAPABILITIES_PATH "[path]"
...
During install, call ${RegisterCapabilities}, then use the other register
macros to create file type, MIME, and protocol associations.
During uninstall, call ${UnRegisterCapabilities}
_______________________________________________________________________________
More information about Default Programs and Client Types can be found here:
http://msdn.microsoft.com/en-us/library/cc144154(VS.85).aspx
http://msdn.microsoft.com/en-us/library/cc144109(v=VS.85).aspx
Defines: All defines not marked [optional] are required.
CAPABILITIES_NAME
The canonical name of the program.
CAPABILITIES_LOCAL_NAME [optional]
The localized name of the program as it appears in Default Programs.
This should be in the format "@FilePath,-StringID" where FilePath is the
path to a .dll or .exe file and StringID is the ID of a resource contained
in the file.
CAPABILITIES_DESCRIPTION
The localized description shown in Default Programs. This can be either a
string or in the same format as CAPABILITIES_LOCAL_NAME
CAPABILITIES_PROGID
An identifier used in file associations. Usually, this is the name of the
program. This should not have any spaces in it.
CAPABILITIES_PATH
The location where capabilities info is stored in the registry.
The "Capabilities" key will automatically be added. If the application is
a client of some sort, (browser, email, media player, etc.) use
"Software\Clients\[ClientType]\[ProgramName]". Otherwise, use
"Software\[CompanyName]\[ProgramName]" or just "Software\[ProgramName]".
CAPABILITIES_ICON [optional]
The icon shown in Default Programs. This should be in the format
"FilePath,IconIndex" where FilePath is the path to a file containing the
icon. If IconIndex is positive, the number is used as the index of the
zero-based array of icons stored in the file. If IconIndex is negative,
the absolute value is used as a resource ID.
CAPABILITIES_REINSTALL [optional]
The command executed when a user uses Set Program Access and Computer
Defaults to select this application as the default for its client type.
This command should launch a program that associates the application with
all the file and protocol types it can handle.
CAPABILITIES_HIDE_ICONS [optional]
The command executed when a user uses Set Program Access and Computer
Defaults to disable access to this application. This command should launch
a program that hides all shortcuts and access points to this application.
It should also prevent the application from being run automatically and
update the IconsVisible registry value to 0.
CAPABILITIES_SHOW_ICONS [optional]
The command executed when a user uses Set Program Access and Computer
Defaults to enable access to this application. This command should launch
a program that restores shortcuts and access points to the application,
allows the program to run, and updates the IconsVisible registry value to 1.
Macros:
${RegisterCapabilities}
Registers the program with Default Programs. Call this once on install
before using any other functions.
${UnRegisterCapabilities}
Un-registers the program and all its associations. Call this once on
uninstall to clean up all installed registry values.
${RegisterFileType} "[extension]" "[executable]" "[icon]" "[description]"
Registers a file type with the program
extension: The file extension to register (ex: .txt)
executable: The executable that opens the file type
icon: The icon shown for the file type
description: Description for the file type shown in Explorer
${RegisterMediaType} "[extension]" "[executable]" "[icon]" "[description]"
Registers a media file type with the program (has a "Play" command)
(arguments are same as RegisterFileType)
${RegisterMimeType} "[mime type]" "[shortname]" "[clsid]"
Registers a mime type with the program
mime type: The MIME type to register (ex: audio/mp3)
shortname: A short identifier for the type (ex: mp3)
clsid: The CLSID of the program to handle files of this type
${RegisterProtocol} "[protocol]" "[executable]" "[icon]" "[description]"
Registers a URL protocol with the program
protocol: The protocol to register (ex: http)
(other arguments are same as RegisterFileType)
${UnRegisterFileType} "[extension]"
Un-registers a previously registered file type
extension: The file extension to un-register
${UnRegisterMimeType} "[mime type]"
Un-registers a previously registered MEME type
mime type: The MIME type to un-register
${UnRegisterProtocol} "[protocol]"
Un-registers a previously registered URL protocol
protocol: The URL protocol to un-register
*/
!ifndef Capabilities_INCLUDED
!define Capabilities_INCLUDED
!include "Util.nsh"
!include "StrFunc.nsh"
${StrCase}
!verbose push
!verbose 3
!ifndef _Capabilities_VERBOSE
!define _Capabilities_VERBOSE 3
!endif
!verbose ${_Capabilities_VERBOSE}
!define Capabilities_VERBOSE `!insertmacro Capabilities_VERBOSE`
!verbose pop
!macro Capabilities_VERBOSE _VERBOSE
!verbose push
!verbose 3
!undef _Capabilities_VERBOSE
!define _Capabilities_VERBOSE ${_VERBOSE}
!verbose pop
!macroend
!macro RegisterCapabilitiesCall
!verbose push
!verbose ${_Capabilities_VERBOSE}
${CallArtificialFunction} RegisterCapabilities_
!verbose pop
!macroend
!macro UnRegisterCapabilitiesCall
!verbose push
!verbose ${_Capabilities_VERBOSE}
${CallArtificialFunction} UnRegisterCapabilities_
!verbose pop
!macroend
!macro RegisterFileTypeCall _EXTENSION _EXECUTABLE _ICON _DESCRIPTION
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_DESCRIPTION}`
Push `${_ICON}`
Push `${_EXECUTABLE}`
Push `${_EXTENSION}`
${CallArtificialFunction} RegisterFileType_
!verbose pop
!macroend
!macro RegisterMediaTypeCall _EXTENSION _EXECUTABLE _ICON _DESCRIPTION
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_DESCRIPTION}`
Push `${_ICON}`
Push `${_EXECUTABLE}`
Push `${_EXTENSION}`
${CallArtificialFunction} RegisterMediaType_
!verbose pop
!macroend
!macro RegisterMimeTypeCall _MIMETYPE _SHORTNAME _CLSID
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_CLSID}`
Push `${_SHORTNAME}`
Push `${_MIMETYPE}`
${CallArtificialFunction} RegisterMimeType_
!verbose pop
!macroend
!macro RegisterProtocolCall _PROTOCOL _EXECUTABLE _ICON _DESCRIPTION
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_DESCRIPTION}`
Push `${_ICON}`
Push `${_EXECUTABLE}`
Push `${_PROTOCOL}`
${CallArtificialFunction} RegisterProtocol_
!verbose pop
!macroend
!macro UnRegisterFileTypeCall _EXTENSION
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_EXTENSION}`
${CallArtificialFunction} UnRegisterFileType_
!verbose pop
!macroend
!macro UnRegisterMimeTypeCall _MIMETYPE
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_MIMETYPE}`
${CallArtificialFunction} UnRegisterMimeType_
!verbose pop
!macroend
!macro UnRegisterProtocolCall _PROTOCOL
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push `${_MIMETYPE}`
${CallArtificialFunction} UnRegisterProtocol_
!verbose pop
!macroend
!define RegisterCapabilities `!insertmacro RegisterCapabilitiesCall`
!define un.RegisterCapabilities `!insertmacro RegisterCapabilitiesCall`
!macro RegisterCapabilities
!macroend
!macro un.RegisterCapabilities
!macroend
!macro RegisterCapabilities_
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push $0
!ifndef CAPABILITIES_PATH
!error "CAPABILITIES_PATH not defined"
!endif
!ifndef CAPABILITIES_NAME
!error "CAPABILITIES_NAME not defined"
!endif
!ifndef CAPABILITIES_PROGID
!error "CAPABILITIES_PROGID not defined"
!endif
!ifndef CAPABILITIES_DESCRIPTION
!error "CAPABILITIES_DESCRIPTION not defined"
!endif
StrCpy $0 "${CAPABILITIES_PATH}\Capabilities"
; add the application to RegisteredApplications
WriteRegStr HKLM "Software\RegisteredApplications" "${CAPABILITIES_NAME}" "$0"
; write application info
WriteRegStr HKLM "${CAPABILITIES_PATH}" "" "${CAPABILITIES_NAME}"
!ifdef CAPABILITIES_LOCAL_NAME
WriteRegStr HKLM "${CAPABILITIES_PATH}" "LocalizedString" "${CAPABILITIES_LOCAL_NAME}"
!endif
!ifdef CAPABILITIES_ICON
WriteRegStr HKLM "${CAPABILITIES_PATH}\DefaultIcon" "" "${CAPABILITIES_ICON}"
!endif
; write installinfo if defined
!ifdef CAPABILITIES_REINSTALL
WriteRegStr HKLM "${CAPABILITIES_PATH}\InstallInfo" "ReinstallCommand" "${CAPABILITIES_REINSTALL}"
!endif
!ifdef CAPABILITIES_HIDE_ICONS
WriteRegStr HKLM "${CAPABILITIES_PATH}\InstallInfo" "HideIconsCommand" "${CAPABILITIES_HIDE_ICONS}"
WriteRegDWORD HKLM "${CAPABILITIES_PATH}\InstallInfo" "IconsVisible" 0x1
!endif
!ifdef CAPABILITIES_SHOW_ICONS
WriteRegStr HKLM "${CAPABILITIES_PATH}\InstallInfo" "ShowIconsCommand" "${CAPABILITIES_SHOW_ICONS}"
WriteRegDWORD HKLM "${CAPABILITIES_PATH}\InstallInfo" "IconsVisible" 0x1
!endif
; write application capabilities info
!ifdef CAPABILITIES_LOCAL_NAME
WriteRegStr HKLM "$0" "ApplicationName" "${CAPABILITIES_LOCAL_NAME}"
!else
WriteRegStr HKLM "$0" "ApplicationName" "${CAPABILITIES_NAME}"
!endif
WriteRegStr HKLM "$0" "ApplicationDescription" "${CAPABILITIES_DESCRIPTION}"
Pop $0
!verbose pop
!macroend
!define UnRegisterCapabilities `!insertmacro UnRegisterCapabilitiesCall`
!define un.UnRegisterCapabilities `!insertmacro UnRegisterCapabilitiesCall`
!macro UnRegisterCapabilities
!macroend
!macro un.UnRegisterCapabilities
!macroend
!macro UnRegisterCapabilities_
!define MacroID ${__LINE__}
!verbose push
!verbose ${_Capabilities_VERBOSE}
Push $0
Push $1
; remove all file associations
FileTypeLoop_${MacroID}:
EnumRegValue $0 HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" 0
StrCmp $0 "" FileTypeDone_${MacroID}
ReadRegStr $1 HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" "$0"
DeleteRegKey HKCR $1
DeleteRegValue HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" "$0"
Goto FileTypeLoop_${MacroID}
FileTypeDone_${MacroID}:
; remove all MIME associations
MimeTypeLoop_${MacroID}:
EnumRegValue $0 HKLM "${CAPABILITIES_PATH}\Capabilities\MimeAssociations" 0
StrCmp $0 "" MimeTypeDone_${MacroID}
ReadRegStr $1 HKLM "${CAPABILITIES_PATH}\Capabilities\MimeAssociations" "$0"
DeleteRegKey HKCR "$1"
DeleteRegValue HKLM "${CAPABILITIES_PATH}\Capabilities\MimeAssociations" "$0"
Goto MimeTypeLoop_${MacroID}
MimeTypeDone_${MacroID}:
; remove all protocol associations
ProtocolLoop_${MacroID}:
EnumRegValue $0 HKLM "${CAPABILITIES_PATH}\Capabilities\UrlAssociations" 0
StrCmp $0 "" ProtocolDone_${MacroID}
ReadRegStr $1 HKLM "${CAPABILITIES_PATH}\Capabilities\UrlAssociations" "$0"
DeleteRegKey HKCR "$1"
DeleteRegValue HKLM "${CAPABILITIES_PATH}\Capabilities\UrlAssociations" "$0"
Goto ProtocolLoop_${MacroID}
ProtocolDone_${MacroID}:
; remove capabilities keys
DeleteRegValue HKLM "Software\RegisteredApplications" "${CAPABILITIES_NAME}"
DeleteRegKey HKLM ${CAPABILITIES_PATH}
Pop $1
Pop $0
!verbose pop
!undef MacroID
!macroend
!define RegisterFileType `!insertmacro RegisterFileTypeCall`
!define un.RegisterFileType `!insertmacro RegisterFileTypeCall`
!macro RegisterFileType
!macroend
!macro un.RegisterFileType
!macroend
!macro RegisterFileType_
!verbose push
!verbose ${_Capabilities_VERBOSE}
Exch $R3 ;ext
Exch
Exch $R2 ;exe
Exch 2
Exch $R1 ;icon
Exch
Exch 3
Exch $R0 ;desc
Push $0
; create an association name
; ex: .mp3 becomes ProgID.AssocFile.MP3
${StrCase} $0 "$R3" "U"
StrCpy $0 "${CAPABILITIES_PROGID}.AssocFile$0"
; link capabilities to association in classes root
WriteRegStr HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" "$R3" "$0"
; write file association in classes root
WriteRegStr HKCR "$0" "" "$R0"
WriteRegStr HKCR "$0\DefaultIcon" "" "$R1"
WriteRegStr HKCR "$0\shell" "" "Open"
WriteRegStr HKCR "$0\shell\open" "" "&Open"
WriteRegStr HKCR "$0\shell\open\command" "" '"$R2" "%1"'
Pop $0
Pop $R0
Pop $R1
Pop $R2
Pop $R3
!verbose pop
!macroend
!define RegisterMediaType `!insertmacro RegisterMediaTypeCall`
!define un.RegisterMediaType `!insertmacro RegisterMediaTypeCall`
!macro RegisterMediaType
!macroend
!macro un.RegisterMediaType
!macroend
!macro RegisterMediaType_
!verbose push
!verbose ${_Capabilities_VERBOSE}
Exch $R3 ;ext
Exch
Exch $R2 ;exe
Exch 2
Exch $R1 ;icon
Exch
Exch 3
Exch $R0 ;desc
Push $0
; create an association name
; ex: .mp3 becomes ProgID.AssocFile.MP3
${StrCase} $0 "$R3" "U"
StrCpy $0 "${CAPABILITIES_PROGID}.AssocFile$0"
; link capabilities to association in classes root
WriteRegStr HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" "$R3" "$0"
; write file association in classes root
WriteRegStr HKCR "$0" "" "$R0"
WriteRegStr HKCR "$0\DefaultIcon" "" "$R1"
WriteRegStr HKCR "$0\shell" "" "Play"
WriteRegStr HKCR "$0\shell\open" "" "&Open"
WriteRegStr HKCR "$0\shell\open\command" "" '"$R2" "%1"'
WriteRegStr HKCR "$0\shell\play" "" "&Play"
WriteRegStr HKCR "$0\shell\play\command" "" '"$R2" "%L"'
Pop $0
Pop $R0
Pop $R1
Pop $R2
Pop $R3
!verbose pop
!macroend
!define RegisterMimeType `!insertmacro RegisterMimeTypeCall`
!define un.RegisterMimeType `!insertmacro RegisterMimeTypeCall`
!macro RegisterMimeType
!macroend
!macro un.RegisterMimeType
!macroend
!macro RegisterMimeType_
!verbose push
!verbose ${_Capabilities_VERBOSE}
Exch $R2 ;mime
Exch
Exch $R1 ;shortname
Exch
Exch 2
Exch $R0 ;clsid
Push $0
; create an association name
; ex: audio/mp3 becomes ProgID.AssocMIME.MP3
${StrCase} $0 "$R1" "U"
StrCpy $0 "${CAPABILITIES_PROGID}.AssocMIME.$0"
; link capabilities to association in classes root
WriteRegStr HKLM "${CAPABILITIES_PATH}\Capabilities\MimeAssociations" "$R2" "$0"
; write file association in classes root
WriteRegStr HKCR "$0\CLSID" "" "$R0"
Pop $0
Pop $R0
Pop $R1
!verbose pop
!macroend
!define RegisterProtocol `!insertmacro RegisterProtocolCall`
!define un.RegisterProtocol `!insertmacro RegisterProtocolCall`
!macro RegisterProtocol
!macroend
!macro un.RegisterProtocol
!macroend
!macro RegisterProtocol_
!verbose push
!verbose ${_Capabilities_VERBOSE}
Exch $R3 ;protocol
Exch
Exch $R2 ;exe
Exch 2
Exch $R1 ;icon
Exch
Exch 3
Exch $R0 ;desc
Push $0
; create an association name
; ex: http becomes ProgID.AssocProtocol.HTTP
${StrCase} $0 "$R3" "U"
StrCpy $0 "${CAPABILITIES_PROGID}.AssocProtocol.$0"
; link capabilities to association in classes root
WriteRegStr HKLM "${CAPABILITIES_PATH}\Capabilities\UrlAssociations" "$R3" "$0"
; write file association in classes root
WriteRegStr HKCR "$0" "" "$R0"
WriteRegStr HKCR "$0\DefaultIcon" "" "$R1"
WriteRegStr HKCR "$0\shell\open" "" "&Open"
WriteRegStr HKCR "$0\shell\open\command" "" '"$R2" "%1"'
Pop $0
Pop $R0
Pop $R1
Pop $R2
Pop $R3
!verbose pop
!macroend
!define UnRegisterFileType `!insertmacro UnRegisterFileTypeCall`
!define un.UnRegisterFileType `!insertmacro UnRegisterFileTypeCall`
!macro UnRegisterFileType
!macroend
!macro un.UnRegisterFileType
!macroend
!macro UnRegisterFileType_
!define MacroID ${__LINE__}
!verbose push
!verbose ${_Capabilities_VERBOSE}
Exch $R0 ;ext
Push $0
ReadRegStr $0 HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" "$R0"
StrCmp $0 "" skip_${MacroID}
DeleteRegKey HKCR "$0"
DeleteRegValue HKLM "${CAPABILITIES_PATH}\Capabilities\FileAssociations" "$R0"
skip_${MacroID}:
Pop $0
Pop $R0
!verbose pop
!undef MacroID
!macroend
!define UnRegisterMimeType `!insertmacro UnRegisterMimeTypeCall`
!define un.UnRegisterMimeType `!insertmacro UnRegisterMimeTypeCall`
!macro UnRegisterMimeType
!macroend
!macro un.UnRegisterMimeType
!macroend
!macro UnRegisterMimeType_
!define MacroID ${__LINE__}
!verbose push
!verbose ${_Capabilities_VERBOSE}
Exch $R0 ;mime
Push $0
ReadRegStr $0 HKLM "${CAPABILITIES_PATH}\Capabilities\MimeAssociations" "$R0"
StrCmp $0 "" skip_${MacroID}
DeleteRegKey HKCR "$0"
DeleteRegValue HKLM "${CAPABILITIES_PATH}\Capabilities\MimeAssociations" "$R0"
skip_${MacroID}: