[vlc-devel] [PATCH 1/3] macOS packaging: Use DESTDIR install for packaging

david.fuhrmann at gmail.com david.fuhrmann at gmail.com
Mon Dec 2 10:05:15 CET 2019


From: David Fuhrmann <dfuhrmann at videolan.org>

This gets rid of a prefix inside our build dir, and uses DESTDIR
when installing the content. This way, the install directory
can be reused for further packaging introduced in the next commits.
---
 bin/Makefile.am                    |  2 +-
 extras/package/macosx/configure.sh |  2 +-
 extras/package/macosx/package.mak  | 27 ++++++++++++++++++---------
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/bin/Makefile.am b/bin/Makefile.am
index 0bfa668806e0..699fbd4bf0b2 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -132,7 +132,7 @@ MOSTLYCLEANFILES = $(noinst_DATA)
 if HAVE_OSX
 if BUILD_VLC
 install-data-local:
-	cd $(bindir); mv vlc-osx vlc
+	cd "$(DESTDIR)$(bindir)"; mv vlc-osx vlc
 
 endif
 endif
diff --git a/extras/package/macosx/configure.sh b/extras/package/macosx/configure.sh
index 92f0218a25e1..d2746e61d76f 100755
--- a/extras/package/macosx/configure.sh
+++ b/extras/package/macosx/configure.sh
@@ -15,7 +15,7 @@ case "${ARCH}" in
 esac
 
 OPTIONS="
-        --prefix=`pwd`/vlc_install_dir
+        --prefix=/usr
         --enable-macosx
         --enable-merge-ffmpeg
         --enable-osx-notifications
diff --git a/extras/package/macosx/package.mak b/extras/package/macosx/package.mak
index e7c660e31426..9be48169a4ea 100644
--- a/extras/package/macosx/package.mak
+++ b/extras/package/macosx/package.mak
@@ -1,3 +1,6 @@
+macos_destdir=$(abs_top_builddir)/macos-install
+
+
 if HAVE_DARWIN
 noinst_DATA = pseudo-bundle
 endif
@@ -10,12 +13,18 @@ pseudo-bundle:
 	$(LN_S) -hf $(CONTRIB_DIR)/Frameworks
 	cd $(top_builddir)/bin/Contents/Resources/ && find $(abs_top_srcdir)/modules/gui/macosx/Resources/ -type f -exec $(LN_S) -f {} \;
 
+macos-install:
+	rm -Rf "$(macos_destdir)"
+	mkdir "$(macos_destdir)"
+	DESTDIR="$(macos_destdir)" $(MAKE) install
+	touch "$(macos_destdir)"
+
 # VLC.app for packaging and giving it to your friends
 # use package-macosx to get a nice dmg
-VLC.app: install
+VLC.app: macos-install
 	rm -Rf $@
 	## Copy Contents
-	cp -R "$(datadir)/macosx/" $@
+	cp -R "$(macos_destdir)$(datadir)/macosx/" $@
 	## Copy .strings file and .nib files
 	cp -R "$(top_builddir)/modules/gui/macosx/UI" $@/Contents/Resources/Base.lproj
 	## Copy Info.plist and convert to binary
@@ -33,23 +42,23 @@ endif
 	mkdir -p $@/Contents/MacOS/
 if BUILD_LUA
 	## Copy lua scripts
-	cp -r "$(pkgdatadir)/lua" $@/Contents/Resources/share/
-	cp -r "$(pkglibexecdir)/lua" $@/Contents/Frameworks/
+	cp -r "$(macos_destdir)$(pkgdatadir)/lua" $@/Contents/Resources/share/
+	cp -r "$(macos_destdir)$(pkglibexecdir)/lua" $@/Contents/Frameworks/
 endif
 	## HRTFs
 	cp -r "$(srcdir)/share/hrtfs" $@/Contents/Resources/share/
 	## Copy translations
-	-cp -a "$(datadir)/locale" $@/Contents/Resources/share/
+	-cp -a "$(macos_destdir)$(datadir)/locale" $@/Contents/Resources/share/
 	printf "APPLVLC#" >| $@/Contents/PkgInfo
 	## Copy libs
-	cp -a "$(libdir)"/libvlc*.dylib $@/Contents/Frameworks/
+	cp -a "$(macos_destdir)$(libdir)"/libvlc*.dylib $@/Contents/Frameworks/
 	## Copy plugins
 	mkdir -p $@/Contents/Frameworks/plugins
-	find "$(pkglibdir)/plugins" -name 'lib*_plugin.dylib' -maxdepth 2 -exec cp -a {} $@/Contents/Frameworks/plugins \;
+	find "$(macos_destdir)$(pkglibdir)/plugins" -name 'lib*_plugin.dylib' -maxdepth 2 -exec cp -a {} $@/Contents/Frameworks/plugins \;
 	## Copy libbluray jar
 	-cp -a "$(CONTRIB_DIR)"/share/java/libbluray*.jar $@/Contents/Frameworks/plugins/
 	## Install binary
-	cp "$(prefix)/bin/vlc" $@/Contents/MacOS/VLC
+	cp "$(macos_destdir)$(prefix)/bin/vlc" $@/Contents/MacOS/VLC
 	install_name_tool -rpath "$(libdir)" "@executable_path/../Frameworks/" $@/Contents/MacOS/VLC
 	## Generate plugin cache
 	VLC_LIB_PATH="$@/Contents/Frameworks" bin/vlc-cache-gen $@/Contents/Frameworks/plugins
@@ -117,7 +126,7 @@ package-translations:
 	$(AMTAR) chof - $(srcdir)/vlc-translations-$(VERSION) \
 	  | GZIP=$(GZIP_ENV) gzip -c >$(srcdir)/vlc-translations-$(VERSION).tar.gz
 
-.PHONY: package-macosx package-macosx-zip package-macosx-release package-translations pseudo-bundle
+.PHONY: package-macosx package-macosx-zip package-macosx-release package-translations pseudo-bundle macos-install
 
 ###############################################################################
 # Mac OS X project
-- 
2.21.0 (Apple Git-122.2)



More information about the vlc-devel mailing list