diff Makefile @ 29027:db5084d27df5 stable

osx: create a modern package including manpages Instead of using bdist_mpkg, we use the modern Apple-provided tools to build an OS X Installer package directly. This has several advantages: * Avoids bdist_mpkg which seems to be barely maintained and is hard to use. * Creates a single unified .pkg instead of a .mpkg. * The package we produce is in the modern, single-file format instead of a directory bundle that we have to zip up for download. In addition, this way of building the package now correctly: * Installs the manpages, bringing the `make osx`-generated package in line with the official Mac packages we publish on the website. * Installs files with the correct permissions instead of encoding the UID of the user who happened to build the package. Thanks to Augie for updating the test expectations.
author Kevin Bullock <kbullock+mercurial@ringworld.org>
date Wed, 27 Apr 2016 10:20:36 -0500
parents fe364d8797c3
children e63dfbbdbd07
line wrap: on
line diff
--- a/Makefile	Wed Apr 27 11:45:55 2016 -0400
+++ b/Makefile	Wed Apr 27 10:20:36 2016 -0500
@@ -156,18 +156,20 @@
 # Packaging targets
 
 osx:
-	python -c 'import bdist_mpkg.script_bdist_mpkg' || \
-	   (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false)
-	rm -rf dist/mercurial-*.mpkg
-	python -m bdist_mpkg.script_bdist_mpkg setup.py --
-	python contrib/fixpax.py dist/mercurial-*.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
-	OUTPUTDIR=$${OUTPUTDIR:=packages/osx} && \
-	  mkdir -p $$OUTPUTDIR && \
-	  N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && \
-	  hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" \
-	    -ov $$OUTPUTDIR/$$N.dmg && \
-	  [ -n "$$KEEPMPKG" ] && mv dist/mercurial-*.mpkg $$OUTPUTDIR || \
-	  rm -rf dist/mercurial-*.mpkg
+	python setup.py install --optimize=1 \
+	  --root=build/mercurial/ --prefix=/usr/local/ \
+	  --install-lib=/Library/Python/2.7/site-packages/
+	make -C doc all install DESTDIR="$(PWD)/build/mercurial/"
+	mkdir -p $${OUTPUTDIR:-dist}
+	pkgbuild --root build/mercurial/ --identifier org.mercurial-scm.mercurial \
+	  build/mercurial.pkg
+	HGVER=$$((cat build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py; echo 'print(version)') | python) && \
+	OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \
+	productbuild --distribution contrib/macosx/distribution.xml \
+	  --package-path build/ \
+	  --version "$${HGVER}" \
+	  --resources contrib/macosx/ \
+	  "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
 
 deb:
 	contrib/builddeb