macOS: Simplify buildsystem, fix VLC.app
[vlc.git] / extras / package / macosx / package.mak
1 if HAVE_DARWIN
2 noinst_DATA = pseudo-bundle
3 endif
4
5 # Symlink a pseudo-bundle
6 pseudo-bundle:
7         $(MKDIR_P) $(top_builddir)/bin/Contents/Resources/
8         $(LN_S) -hf $(abs_top_builddir)/modules/gui/macosx/UI $(top_builddir)/bin/Contents/Resources/English.lproj
9         $(LN_S) -hf $(abs_top_builddir)/share/macosx/Info.plist $(top_builddir)/bin/Contents/Info.plist
10         $(LN_S) -hf $(CONTRIB_DIR)/Frameworks
11         cd $(top_builddir)/bin/Contents/Resources/ && find $(abs_top_srcdir)/modules/gui/macosx/Resources/ -type f -exec $(LN_S) -f {} \;
12
13 # VLC.app for packaging and giving it to your friends
14 # use package-macosx to get a nice dmg
15 VLC.app: install
16         rm -Rf $@
17         ## Copy Contents
18         cp -R $(prefix)/share/macosx/ $@
19         ## Copy .strings file
20         cp -R $(top_builddir)/modules/gui/macosx/UI/InfoPlist.strings $@/Contents/Resources/UI
21         ## Rename interface files (UI) folder
22         mv $@/Contents/Resources/UI $@/Contents/Resources/English.lproj
23         ## Copy Info.plist and convert to binary
24         cp -R $(top_builddir)/share/macosx/Info.plist $@/Contents/
25         xcrun plutil -convert binary1 $@/Contents/Info.plist
26         ## Create Frameworks dir and copy required ones
27         mkdir -p $@/Contents/Frameworks
28         cp -R $(CONTRIB_DIR)/Frameworks/Growl.framework $@/Contents/Frameworks
29 if HAVE_SPARKLE
30         cp -R $(CONTRIB_DIR)/Frameworks/Sparkle.framework $@/Contents/Frameworks
31 endif
32 if HAVE_BREAKPAD
33         cp -R $(CONTRIB_DIR)/Frameworks/Breakpad.framework $@/Contents/Frameworks
34 endif
35         mkdir -p $@/Contents/MacOS/share/locale/
36 if BUILD_LUA
37         ## Copy lua scripts
38         cp -r "$(prefix)/lib/vlc/lua" "$(prefix)/share/vlc/lua" $@/Contents/MacOS/share/
39 endif
40         ## Copy some other stuff (?)
41         mkdir -p $@/Contents/MacOS/include/
42         (cd "$(prefix)/include" && $(AMTAR) -c --exclude "plugins" vlc) | $(AMTAR) -x -C $@/Contents/MacOS/include/
43         ## Copy translations
44         cat $(top_srcdir)/po/LINGUAS | while read i; do \
45           $(INSTALL) -d $@/Contents/MacOS/share/locale/$${i}/LC_MESSAGES ; \
46           $(INSTALL) $(srcdir)/po/$${i}.gmo $@/Contents/MacOS/share/locale/$${i}/LC_MESSAGES/vlc.mo; \
47           mkdir -p $@/Contents/Resources/$${i}.lproj/ ; \
48           $(LN_S) -f ../English.lproj/InfoPlist.strings ../English.lproj/MainMenu.nib \
49                 $@/Contents/Resources/$${i}.lproj/ ; \
50         done
51         printf "APPLVLC#" >| $@/Contents/PkgInfo
52         PRODUCT="$@" ACTION="release-makefile" src_dir=$(srcdir) build_dir=$(top_builddir) sh $(srcdir)/extras/package/macosx/build-package.sh
53         ## Generate plugin cache
54         bin/vlc-cache-gen $@/Contents/MacOS/plugins
55         find $@ -type d -exec chmod ugo+rx '{}' \;
56         find $@ -type f -exec chmod ugo+r '{}' \;
57
58
59 package-macosx: VLC.app
60         mkdir -p "$(top_builddir)/vlc-$(VERSION)/Goodies/"
61         cp -R "$(top_builddir)/VLC.app" "$(top_builddir)/vlc-$(VERSION)/VLC.app"
62         cd $(srcdir); cp AUTHORS COPYING README THANKS NEWS $(abs_top_builddir)/vlc-$(VERSION)/Goodies/
63         $(LN_S) -f /Applications $(top_builddir)/vlc-$(VERSION)/
64         rm -f "$(top_builddir)/vlc-$(VERSION)-rw.dmg"
65         hdiutil create -verbose -srcfolder "$(top_builddir)/vlc-$(VERSION)" "$(top_builddir)/vlc-$(VERSION)-rw.dmg" -scrub -format UDRW
66         mkdir -p ./mount
67         hdiutil attach -readwrite -noverify -noautoopen -mountRoot ./mount "vlc-$(VERSION)-rw.dmg"
68         -osascript "$(srcdir)"/extras/package/macosx/dmg_setup.scpt "vlc-$(VERSION)"
69         hdiutil detach ./mount/"vlc-$(VERSION)"
70 # Make sure the image is not writable
71 # Note: We can't directly create a read only dmg as we do the bless stuff
72         rm -f "$(top_builddir)/vlc-$(VERSION).dmg"
73         hdiutil convert "$(top_builddir)/vlc-$(VERSION)-rw.dmg" -format UDBZ -o "$(top_builddir)/vlc-$(VERSION).dmg"
74         ls -l "$(top_builddir)/vlc-$(VERSION).dmg"
75         rm -f "$(top_builddir)/vlc-$(VERSION)-rw.dmg"
76         rm -rf "$(top_builddir)/vlc-$(VERSION)"
77
78 package-macosx-zip: VLC.app
79         mkdir -p $(top_builddir)/vlc-$(VERSION)/Goodies/
80         cp -R $(top_builddir)/VLC.app $(top_builddir)/vlc-$(VERSION)/VLC.app
81         cd $(srcdir); cp -R AUTHORS COPYING README THANKS NEWS $(abs_top_builddir)/vlc-$(VERSION)/Goodies/
82         zip -r -y -9 $(top_builddir)/vlc-$(VERSION).zip $(top_builddir)/vlc-$(VERSION)
83         rm -rf "$(top_builddir)/vlc-$(VERSION)"
84
85 package-translations:
86         mkdir -p "$(srcdir)/vlc-translations-$(VERSION)"
87         for i in `cat "$(top_srcdir)/po/LINGUAS"`; do \
88           cp "$(srcdir)/po/$${i}.po" "$(srcdir)/vlc-translations-$(VERSION)/" ; \
89         done
90         cp "$(srcdir)/doc/translations.txt" "$(srcdir)/vlc-translations-$(VERSION)/README.txt"
91
92         echo "#!/bin/sh" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
93         echo "" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
94         echo 'if test $$# != 1; then' >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
95         echo "  echo \"Usage: convert-po.sh <.po file>\"" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
96         echo "  exit 1" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
97         echo "fi" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
98         echo "" >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
99         echo 'msgfmt --statistics -o vlc.mo $$1' >>"$(srcdir)/vlc-translations-$(VERSION)/convert.po.sh"
100
101         $(AMTAR) chof - $(srcdir)/vlc-translations-$(VERSION) \
102           | GZIP=$(GZIP_ENV) gzip -c >$(srcdir)/vlc-translations-$(VERSION).tar.gz
103
104 .PHONY: package-macosx package-macosx-zip package-translations pseudo-bundle
105
106 ###############################################################################
107 # Mac OS X project
108 ###############################################################################
109
110 EXTRA_DIST += \
111         extras/package/macosx/build-package.sh \
112         extras/package/macosx/build.sh \
113         extras/package/macosx/codesign.sh \
114         extras/package/macosx/configure.sh \
115         extras/package/macosx/dmg_setup.scpt \
116         extras/package/macosx/fullscreen_panel.svg \
117         extras/package/macosx/vlc_status_icon.svg \
118         extras/package/macosx/vlc_app_icon.svg \
119         extras/package/macosx/VLC.entitlements \
120         extras/package/macosx/VLC.xcodeproj/project.pbxproj