summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2012-08-13 12:08:22 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2012-10-16 07:15:12 +0200
commitc4f68de1456ddb561f322b84e2ba1b790eec4c28 (patch)
treec5d9c9ae8e3be85edbbef4bdd0fe4324d601ad68 /TOOLS
parent6557f206efeb4569a42f1e4810172bc97fd64619 (diff)
downloadmpv-c4f68de1456ddb561f322b84e2ba1b790eec4c28.tar.bz2
mpv-c4f68de1456ddb561f322b84e2ba1b790eec4c28.tar.xz
TOOLS: add script for osx bundle generation
Add a make task and python script to create a Mac OS X Application Bundle to be used when compiling with the --enable-macosx-finder and --enable-macosx-bundle configure flags. The main svg icon was created by me and heavily inspired by Apple's iTunes and AppStore icon designs. We are still looking for something better. For the audio, movie and subtitles icons I added the main logo to MPlayer OSX Extended icons. Use with `make osxbundle` after running configure and make.
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/osxbundle.py89
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Info.plist248
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep0
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep0
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/PkgInfo1
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icnsbin0 -> 64076 bytes
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icnsbin0 -> 142486 bytes
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icnsbin0 -> 157126 bytes
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icnsbin0 -> 63323 bytes
-rwxr-xr-xTOOLS/osxbundle/version.sh15
10 files changed, 353 insertions, 0 deletions
diff --git a/TOOLS/osxbundle.py b/TOOLS/osxbundle.py
new file mode 100755
index 0000000000..9f2f29d88b
--- /dev/null
+++ b/TOOLS/osxbundle.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+import os
+import re
+import shutil
+import sys
+
+def sh(command):
+ return os.popen(command).read()
+
+def dylib_lst(input_file):
+ return sh("otool -L %s | grep -e '\t' | awk '{ print $1 }'" % input_file)
+
+sys_re = re.compile("/System")
+exe_re = re.compile("@executable_path")
+binary_name = sys.argv[1]
+
+def is_user_lib(libname, input_file):
+ return not sys_re.match(libname) and \
+ not exe_re.match(libname) and \
+ not "libobjc" in libname and \
+ not "libSystem" in libname and \
+ not "libgcc" in libname and \
+ not os.path.basename(input_file) in libname and \
+ not libname == ''
+
+def user_dylib_lst(input_file):
+ return [lib for lib in dylib_lst(input_file).split("\n") if
+ is_user_lib(lib, input_file)]
+
+def bundle_name():
+ return "%s.app" % binary_name
+
+def target_plist():
+ return os.path.join(bundle_name(), 'Contents', 'Info.plist')
+
+def target_directory():
+ return os.path.join(bundle_name(), 'Contents', 'MacOS')
+
+def target_binary():
+ return os.path.join(target_directory(), binary_name)
+
+def copy_bundle():
+ if os.path.isdir(bundle_name()):
+ shutil.rmtree(bundle_name())
+ shutil.copytree(
+ os.path.join('TOOLS', 'osxbundle', bundle_name()),
+ bundle_name())
+
+def copy_binary():
+ shutil.copy(binary_name, target_binary())
+
+def run_install_name_tool(target_file, dylib_path, destination_directory):
+ new_dylib_path = os.path.join("@executable_path", "lib",
+ os.path.basename(dylib_path))
+
+ sh("install_name_tool -change %s %s %s" % \
+ (dylib_path, new_dylib_path, target_file))
+ sh("install_name_tool -id %s %s" % \
+ (new_dylib_path, os.path.join(destination_directory,
+ os.path.basename(dylib_path))))
+
+def cp_dylibs(target_file, destination_directory):
+ for dylib_path in user_dylib_lst(target_file):
+ dylib_destination_path = os.path.join(destination_directory,
+ os.path.basename(dylib_path))
+ shutil.copy(dylib_path, dylib_destination_path)
+ os.chmod(dylib_destination_path, 0o755)
+ cp_dylibs(dylib_destination_path, destination_directory)
+
+def fix_dylibs_paths(target_file, destination_directory):
+ for dylib_path in user_dylib_lst(target_file):
+ dylib_destination_path = os.path.join(destination_directory,
+ os.path.basename(dylib_path))
+ run_install_name_tool(target_file, dylib_path, destination_directory)
+ fix_dylibs_paths(dylib_destination_path, destination_directory)
+
+def apply_plist_template(plist_file, version):
+ sh("sed -i -e 's/{{VERSION}}/%s/g' %s" % (version, plist_file))
+
+version = sh("TOOLS/osxbundle/version.sh").strip()
+
+print("Creating Mac OS X application bundle (version: %s)..." % version)
+
+copy_bundle()
+copy_binary()
+apply_plist_template(target_plist(), version)
+cp_dylibs(sys.argv[1], os.path.join(target_directory(), "lib"))
+fix_dylibs_paths(target_binary(), os.path.join(target_directory(), "lib"))
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Info.plist b/TOOLS/osxbundle/mpv.app/Contents/Info.plist
new file mode 100644
index 0000000000..472542fe92
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Info.plist
@@ -0,0 +1,248 @@
+<?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>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>AAC</string>
+ <string>AC3</string>
+ <string>AIFF</string>
+ <string>M4A</string>
+ <string>MKA</string>
+ <string>MP3</string>
+ <string>OGG</string>
+ <string>PCM</string>
+ <string>VAW</string>
+ <string>WAV</string>
+ <string>WAW</string>
+ <string>WMA</string>
+ <string>aac</string>
+ <string>ac3</string>
+ <string>aiff</string>
+ <string>m4a</string>
+ <string>mka</string>
+ <string>mp3</string>
+ <string>ogg</string>
+ <string>pcm</string>
+ <string>vaw</string>
+ <string>wav</string>
+ <string>waw</string>
+ <string>wma</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Audio file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ <string>*</string>
+ <string>3GP</string>
+ <string>3IV</string>
+ <string>3gp</string>
+ <string>3iv</string>
+ <string>ASF</string>
+ <string>AVI</string>
+ <string>CPK</string>
+ <string>DAT</string>
+ <string>DIVX</string>
+ <string>DV</string>
+ <string>FLAC</string>
+ <string>FLI</string>
+ <string>FLV</string>
+ <string>H264</string>
+ <string>I263</string>
+ <string>M2TS</string>
+ <string>M4V</string>
+ <string>MKV</string>
+ <string>MOV</string>
+ <string>MP2</string>
+ <string>MP4</string>
+ <string>MPEG</string>
+ <string>MPG</string>
+ <string>MPG2</string>
+ <string>MPG4</string>
+ <string>NSV</string>
+ <string>NUT</string>
+ <string>NUV</string>
+ <string>OGG</string>
+ <string>OGM</string>
+ <string>QT</string>
+ <string>RM</string>
+ <string>RMVB</string>
+ <string>VCD</string>
+ <string>VFW</string>
+ <string>VOB</string>
+ <string>WMV</string>
+ <string>asf</string>
+ <string>avi</string>
+ <string>cpk</string>
+ <string>dat</string>
+ <string>divx</string>
+ <string>dv</string>
+ <string>flac</string>
+ <string>fli</string>
+ <string>flv</string>
+ <string>h264</string>
+ <string>i263</string>
+ <string>m2ts</string>
+ <string>m4v</string>
+ <string>mkv</string>
+ <string>mov</string>
+ <string>mp2</string>
+ <string>mp4</string>
+ <string>mpeg</string>
+ <string>mpg</string>
+ <string>mpg2</string>
+ <string>mpg4</string>
+ <string>nsv</string>
+ <string>nut</string>
+ <string>nuv</string>
+ <string>ogg</string>
+ <string>ogm</string>
+ <string>qt</string>
+ <string>rm</string>
+ <string>rmvb</string>
+ <string>vcd</string>
+ <string>vfw</string>
+ <string>vob</string>
+ <string>wmv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>movie.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Movie file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>AQT</string>
+ <string>ASS</string>
+ <string>JSS</string>
+ <string>RT</string>
+ <string>SMI</string>
+ <string>SRT</string>
+ <string>SSA</string>
+ <string>SUB</string>
+ <string>TXT</string>
+ <string>UTF</string>
+ <string>aqt</string>
+ <string>ass</string>
+ <string>jss</string>
+ <string>rt</string>
+ <string>smi</string>
+ <string>srt</string>
+ <string>ssa</string>
+ <string>sub</string>
+ <string>txt</string>
+ <string>utf</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>subtitles.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Subtitles file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>mpv</string>
+ <key>CFBundleIconFile</key>
+ <string>icon</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.mpv-player.standalone</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>mpv</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>{{VERSION}}</string>
+ <key>NSHighResolutionCapable</key>
+ <true/>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>Real Time (Streaming) Protocol</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>rtp</string>
+ <string>rtsp</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>File over HTTP/FTP/UDP</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>icyx</string>
+ <string>udp</string>
+ <string>ftp</string>
+ <string>http_proxy</string>
+ <string>http</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>Microsoft Media Services</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>mms</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>Cuesheet</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>cue</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>CD/DVD Media</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>dvdnav</string>
+ <string>dvd</string>
+ <string>vcd</string>
+ </array>
+ </dict>
+ </array>
+ </dict>
+</plist>
diff --git a/TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep b/TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep
diff --git a/TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep b/TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep
diff --git a/TOOLS/osxbundle/mpv.app/Contents/PkgInfo b/TOOLS/osxbundle/mpv.app/Contents/PkgInfo
new file mode 100644
index 0000000000..bd04210fb4
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPL???? \ No newline at end of file
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icns
new file mode 100644
index 0000000000..239b9bab12
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icns
Binary files differ
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns
new file mode 100644
index 0000000000..eb056f5a15
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns
Binary files differ
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icns
new file mode 100644
index 0000000000..8c495894a4
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icns
Binary files differ
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icns
new file mode 100644
index 0000000000..f4c7270691
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icns
Binary files differ
diff --git a/TOOLS/osxbundle/version.sh b/TOOLS/osxbundle/version.sh
new file mode 100755
index 0000000000..ff6bb1b5fd
--- /dev/null
+++ b/TOOLS/osxbundle/version.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Extract revision number from file used by daily tarball snapshots
+# or from "git describe" output
+git_revision=$(cat snapshot_version 2> /dev/null)
+test $git_revision || test ! -d .git || \
+git_revision=`git describe --match "v[0-9]*" --always`
+git_revision=$(expr "$git_revision" : v*'\(.*\)')
+test $git_revision || git_revision=UNKNOWN
+
+# releases extract the version number from the VERSION file
+version=$(cat VERSION 2> /dev/null)
+test $version || version=$git_revision
+
+echo $version