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