qt: playlist: use item title if available
[vlc.git] / extras / package / macosx / package.mak
1 macos_destdir=$(abs_top_builddir)/macos-install
2
3
4 if HAVE_DARWIN
5 noinst_DATA = pseudo-bundle
6 endif
7
8 # Symlink a pseudo-bundle
9 pseudo-bundle:
10         $(MKDIR_P) $(top_builddir)/bin/Contents/Resources/
11         $(LN_S) -nf $(abs_top_builddir)/modules/gui/macosx/UI $(top_builddir)/bin/Contents/Resources/Base.lproj
12         $(LN_S) -nf $(abs_top_builddir)/share/macosx/Info.plist $(top_builddir)/bin/Contents/Info.plist
13         $(LN_S) -nf $(CONTRIB_DIR)/Frameworks
14         cd $(top_builddir)/bin/Contents/Resources/ && find $(abs_top_srcdir)/modules/gui/macosx/Resources/ -type f -not -path "*.lproj/*" -exec $(LN_S) -f {} \;
15
16 macos-install:
17         rm -Rf "$(macos_destdir)"
18         mkdir "$(macos_destdir)"
19         DESTDIR="$(macos_destdir)" $(MAKE) install
20         touch "$(macos_destdir)"
21
22 # VLC.app for packaging and giving it to your friends
23 # use package-macosx to get a nice dmg
24 VLC.app: macos-install
25         rm -Rf $@
26         ## Copy Contents
27         cp -R "$(macos_destdir)$(datadir)/macosx/" $@
28         ## Copy .strings file and .nib files
29         cp -R "$(srcdir)/modules/gui/macosx/Resources/"*.lproj $@/Contents/Resources/
30         cp -R "$(top_builddir)/modules/gui/macosx/UI/." $@/Contents/Resources/Base.lproj/
31         ## Copy Info.plist and convert to binary
32         cp -R "$(top_builddir)/share/macosx/Info.plist" $@/Contents/
33         xcrun plutil -convert binary1 $@/Contents/Info.plist
34         ## Create Frameworks dir and copy required ones
35         mkdir -p $@/Contents/Frameworks
36 if HAVE_SPARKLE
37         cp -R "$(CONTRIB_DIR)/Frameworks/Sparkle.framework" $@/Contents/Frameworks
38 endif
39 if HAVE_BREAKPAD
40         cp -R "$(CONTRIB_DIR)/Frameworks/Breakpad.framework" $@/Contents/Frameworks
41 endif
42         mkdir -p $@/Contents/Resources/share/
43         mkdir -p $@/Contents/MacOS/
44 if BUILD_LUA
45         ## Copy lua scripts
46         cp -r "$(macos_destdir)$(pkgdatadir)/lua" $@/Contents/Resources/share/
47         cp -r "$(macos_destdir)$(pkglibexecdir)/lua" $@/Contents/Frameworks/
48 endif
49         ## HRTFs
50         cp -r "$(srcdir)/share/hrtfs" $@/Contents/Resources/share/
51         ## Copy translations
52         -cp -a "$(macos_destdir)$(datadir)/locale" $@/Contents/Resources/share/
53         printf "APPLVLC#" >| $@/Contents/PkgInfo
54         ## Copy libs
55         cp -a "$(macos_destdir)$(libdir)"/libvlc*.dylib $@/Contents/Frameworks/
56         ## Copy plugins
57         mkdir -p $@/Contents/Frameworks/plugins
58         find "$(macos_destdir)$(pkglibdir)/plugins" -name 'lib*_plugin.dylib' -maxdepth 2 -exec cp -a {} $@/Contents/Frameworks/plugins \;
59         ## Copy libbluray jar
60         -cp -a "$(CONTRIB_DIR)"/share/java/libbluray*.jar $@/Contents/Frameworks/plugins/
61         ## Install binary
62         cp "$(macos_destdir)$(prefix)/bin/vlc" $@/Contents/MacOS/VLC
63         install_name_tool -rpath "$(libdir)" "@executable_path/../Frameworks/" $@/Contents/MacOS/VLC
64         ## Generate plugin cache
65         if test "$(build)" = "$(host)"; then \
66                 VLC_LIB_PATH="$@/Contents/Frameworks" bin/vlc-cache-gen $@/Contents/Frameworks/plugins ; \
67         else \
68                 echo "Cross-compilation: cache generation skipped!" ; \
69         fi
70         find $@ -type d -exec chmod ugo+rx '{}' \;
71         find $@ -type f -exec chmod ugo+r '{}' \;
72
73 package-macosx-sdk: macos-install
74         rm -f "$(top_builddir)/vlc-macos-sdk-$(VERSION).tar.gz"
75         tar -cf - --exclude "share/macosx" -C "$(macos_destdir)" . \
76                 | gzip -c > "$(top_builddir)/vlc-macos-sdk-$(VERSION).tar.gz"
77
78 package-macosx: VLC.app
79         rm -f "$(top_builddir)/vlc-$(VERSION).dmg"
80 if HAVE_DMGBUILD
81         @echo "Packaging fancy DMG using dmgbuild"
82         cd "$(top_srcdir)/extras/package/macosx/dmg" && dmgbuild -s "dmg_settings.py" \
83                 -D app="$(abs_top_builddir)/VLC.app" "VLC Media Player" "$(abs_top_builddir)/vlc-$(VERSION).dmg"
84 else !HAVE_DMGBUILD
85         @echo "Packaging non-fancy DMG"
86         ## Create directory for DMG contents
87         mkdir -p "$(top_builddir)/vlc-$(VERSION)"
88         ## Copy contents
89         cp -Rp "$(top_builddir)/VLC.app" "$(top_builddir)/vlc-$(VERSION)/VLC.app"
90         ## Symlink to Applications so users can easily drag-and-drop the App to it
91         $(LN_S) -f /Applications "$(top_builddir)/vlc-$(VERSION)/"
92         ## Create DMG
93         hdiutil create -srcfolder "$(top_builddir)/vlc-$(VERSION)" -volname "VLC Media Player" \
94                 -format UDBZ -fs HFS+ -o "$(top_builddir)/vlc-$(VERSION).dmg"
95         ## Cleanup
96         rm -rf "$(top_builddir)/vlc-$(VERSION)"
97 endif
98
99 package-macosx-zip: VLC.app
100         rm -f "$(top_builddir)/vlc-$(VERSION).zip"
101         mkdir -p $(top_builddir)/vlc-$(VERSION)/Goodies/
102         cp -Rp $(top_builddir)/VLC.app $(top_builddir)/vlc-$(VERSION)/VLC.app
103         cd $(srcdir); cp -R AUTHORS COPYING README THANKS NEWS $(abs_top_builddir)/vlc-$(VERSION)/Goodies/
104         zip -r -y -9 $(top_builddir)/vlc-$(VERSION).zip $(top_builddir)/vlc-$(VERSION)
105         rm -rf "$(top_builddir)/vlc-$(VERSION)"
106
107 package-macosx-release:
108         rm -f "$(top_builddir)/vlc-$(VERSION)-release.zip"
109         mkdir -p $(top_builddir)/vlc-$(VERSION)-release
110         cp -Rp $(top_builddir)/VLC.app $(top_builddir)/vlc-$(VERSION)-release/
111         cp $(srcdir)/extras/package/macosx/dmg/* $(top_builddir)/vlc-$(VERSION)-release/
112         cp "$(srcdir)/extras/package/macosx/codesign.sh" $(top_builddir)/vlc-$(VERSION)-release/
113         cp "$(srcdir)/extras/package/macosx/vlc-hardening.entitlements" $(top_builddir)/vlc-$(VERSION)-release/
114         cp "$(pkglibexecdir)/vlc-cache-gen" $(top_builddir)/vlc-$(VERSION)-release/
115         install_name_tool -add_rpath "@executable_path/VLC.app/Contents/Frameworks" $(top_builddir)/vlc-$(VERSION)-release/vlc-cache-gen
116         zip -r -y -9 $(top_builddir)/vlc-$(VERSION)-release.zip $(top_builddir)/vlc-$(VERSION)-release
117         rm -rf "$(top_builddir)/vlc-$(VERSION)-release"
118
119 package-translations:
120         mkdir -p "$(srcdir)/vlc-translations-$(VERSION)"
121         for i in `cat "$(top_srcdir)/po/LINGUAS"`; do \
122           cp "$(srcdir)/po/$${i}.po" "$(srcdir)/vlc-translations-$(VERSION)/" ; \
123         done
124         cp "$(srcdir)/doc/translations.txt" "$(srcdir)/vlc-translations-$(VERSION)/README.txt"
125
126         echo "#!/bin/sh" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
127         echo "" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
128         echo 'if test $$# != 1; then' >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
129         echo "  echo \"Usage: convert-po.sh <.po file>\"" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
130         echo "  exit 1" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
131         echo "fi" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
132         echo "" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
133         echo 'msgfmt --statistics -o vlc.mo $$1' >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
134
135         $(AMTAR) chof - $(srcdir)/vlc-translations-$(VERSION) \
136           | GZIP=$(GZIP_ENV) gzip -c >$(srcdir)/vlc-translations-$(VERSION).tar.gz
137
138 .PHONY: package-macosx package-macosx-zip package-macosx-release package-translations pseudo-bundle macos-install package-macosx-sdk
139
140 ###############################################################################
141 # Mac OS X project
142 ###############################################################################
143
144 EXTRA_DIST += \
145         extras/package/macosx/env.build.sh \
146         extras/package/macosx/build.sh \
147         extras/package/macosx/codesign.sh \
148         extras/package/macosx/configure.sh \
149         extras/package/macosx/dmg/dmg_settings.py \
150         extras/package/macosx/dmg/disk_image.icns \
151         extras/package/macosx/dmg/background.tiff \
152         extras/package/macosx/asset_sources/vlc_app_icon.svg \
153         extras/package/macosx/VLC.entitlements \
154         extras/package/macosx/VLC.xcodeproj/project.pbxproj