-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
13 changed files
with
913 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
/config.mak | ||
/config.log | ||
/mpv | ||
/mpv.app | ||
/version.h | ||
/codecs.conf.h | ||
/input/input_conf.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
APPL???? |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.