Migrate Mac packaging system to pkgbuild, since PackageMaker is no longer supported.


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1212 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/ChangeLog.txt b/ChangeLog.txt
index fb148ca..4b3db1e 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -33,6 +33,12 @@
 of the application.  An application can still override the Huffman tables, for
 instance to re-use tables from a previous frame of the same video.
 
+[4] The Mac packaging system now uses pkgbuild and productbuild rather than
+PackageMaker (which is obsolete and no longer supported.)  This means that
+OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo,
+although the packages produced can be installed on OS X 10.5 "Leopard" or
+later.  OS X 10.4 "Tiger" is no longer supported.
+
 
 1.3.1
 =====
diff --git a/configure.ac b/configure.ac
index 4173f25..ff5cf66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -530,8 +530,6 @@
 AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
 AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
 AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
-AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
-AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
 AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
 if test "x$with_turbojpeg" != "xno"; then
   AC_CONFIG_FILES([tjbenchtest])
diff --git a/release/Description.plist.in b/release/Description.plist.in
deleted file mode 100644
index 46a5bce..0000000
--- a/release/Description.plist.in
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IFPkgDescriptionDescription</key>
-	<string>A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs</string>
-	<key>IFPkgDescriptionTitle</key>
-	<string>@PACKAGE_NAME@</string>
-	<key>IFPkgDescriptionVersion</key>
-	<string>@VERSION@</string>
-</dict>
-</plist>
diff --git a/release/Distribution.xml b/release/Distribution.xml
new file mode 100644
index 0000000..ee73ab0
--- /dev/null
+++ b/release/Distribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<installer-gui-script minSpecVersion="1">
+	<title>libjpeg-turbo</title>
+	<welcome file="Welcome.rtf" />
+	<readme file="ReadMe.txt" />
+	<license file="License.rtf" />
+	<domains
+		enable_anywhere="false"
+		enable_currentUserHome="false"
+		enable_localSystem="true"
+	/>
+	<options customize="never" />
+	<choices-outline>
+		<line choice="default">
+			<line choice="com.libjpeg-turbo.libjpeg-turbo"/>
+		</line>
+	</choices-outline>
+	<choice id="default"/>
+	<choice id="com.libjpeg-turbo.libjpeg-turbo" visible="false">
+		<pkg-ref id="com.libjpeg-turbo.libjpeg-turbo"/>
+	</choice>
+	<pkg-ref auth="root"
+		id="com.libjpeg-turbo.libjpeg-turbo">libjpeg-turbo.pkg</pkg-ref>
+</installer-gui-script>
diff --git a/release/Info.plist.in b/release/Info.plist.in
deleted file mode 100755
index 0575079..0000000
--- a/release/Info.plist.in
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleGetInfoString</key>
-	<string>@VERSION@, The libjpeg-turbo Project</string>
-	<key>CFBundleIdentifier</key>
-	<string>com.libjpeg-turbo.libjpeg-turbo</string>
-	<key>CFBundleShortVersionString</key>
-	<string>@VERSION@</string>
-	<key>IFMajorVersion</key>
-	<integer>1</integer>
-	<key>IFMinorVersion</key>
-	<integer>@BUILD@</integer>
-	<key>IFPkgFlagAllowBackRev</key>
-	<false/>
-	<key>IFPkgFlagAuthorizationAction</key>
-	<string>AdminAuthorization</string>
-	<key>IFPkgFlagBackgroundAlignment</key>
-	<string>topleft</string>
-	<key>IFPkgFlagBackgroundScaling</key>
-	<string>none</string>
-	<key>IFPkgFlagDefaultLocation</key>
-	<string>/</string>
-	<key>IFPkgFlagFollowLinks</key>
-	<true/>
-	<key>IFPkgFlagInstallFat</key>
-	<false/>
-	<key>IFPkgFlagIsRequired</key>
-	<false/>
-	<key>IFPkgFlagOverwritePermissions</key>
-	<false/>
-	<key>IFPkgFlagRelocatable</key>
-	<false/>
-	<key>IFPkgFlagRestartAction</key>
-	<string>NoRestart</string>
-	<key>IFPkgFlagRootVolumeOnly</key>
-	<true/>
-	<key>IFPkgFlagUpdateInstalledLanguages</key>
-	<false/>
-	<key>IFPkgFormatVersion</key>
-	<real>0.10000000149011612</real>
-</dict>
-</plist>
diff --git a/release/ReadMe.rtf b/release/ReadMe.rtf
deleted file mode 100644
index 2ae4878..0000000
--- a/release/ReadMe.rtf
+++ /dev/null
@@ -1,13 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
-{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\margl1440\margr1440\vieww26380\viewh15840\viewkind0
-\deftab720
-\pard\pardeftab720\ql\qnatural
-
-\f0\fs24 \cf0 libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems.  On such systems, libjpeg-turbo is generally 2-4x as fast as libjpeg, all else being equal.  On other types of systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by virtue of its highly-optimized Huffman coding routines.  In many cases, the performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.\
-\
-libjpeg-turbo implements both the traditional libjpeg API as well as the less powerful but more straightforward TurboJPEG API.  libjpeg-turbo also features colorspace extensions that allow it to compress from/decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java interface.\
-\
-libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated derivative of libjpeg v6b developed by Miyasaka Masaru.  The TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, and in early 2010, libjpeg-turbo spun off into an independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers.\
-}
\ No newline at end of file
diff --git a/release/ReadMe.txt b/release/ReadMe.txt
new file mode 100644
index 0000000..b9f6ca5
--- /dev/null
+++ b/release/ReadMe.txt
@@ -0,0 +1,5 @@
+libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems.  On such systems, libjpeg-turbo is generally 2-4x as fast as libjpeg, all else being equal.  On other types of systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by virtue of its highly-optimized Huffman coding routines.  In many cases, the performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.
+
+libjpeg-turbo implements both the traditional libjpeg API as well as the less powerful but more straightforward TurboJPEG API.  libjpeg-turbo also features colorspace extensions that allow it to compress from/decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java interface.
+
+libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated derivative of libjpeg v6b developed by Miyasaka Masaru.  The TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, and in early 2010, libjpeg-turbo spun off into an independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers.
diff --git a/release/makemacpkg.in b/release/makemacpkg.in
index 65abdef..16c18de 100644
--- a/release/makemacpkg.in
+++ b/release/makemacpkg.in
@@ -11,7 +11,7 @@
 onexit()
 {
 	if [ ! "$TMPDIR" = "" ]; then
-		sudo rm -rf $TMPDIR
+		rm -rf $TMPDIR
 	fi
 }
 
@@ -78,7 +78,6 @@
 	esac
 	shift
 done
-PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
 
 if [ -f $PACKAGE_NAME-$VERSION.dmg ]; then
 	rm -f $PACKAGE_NAME-$VERSION.dmg
@@ -245,21 +244,20 @@
 	fi
 fi
 
-chmod 1775 $PKGROOT/Library
-chmod 775 $PKGROOT/Library/Documentation 
-mkdir -p $TMPDIR/pkg/Resources 
+mkdir -p $TMPDIR/pkg
 
-cp pkgscripts/Description.plist $TMPDIR/pkg/
-cp pkgscripts/Info.plist $TMPDIR/pkg/
 install -m 755 pkgscripts/uninstall $PKGROOT/$BINDIR/
 
-sudo chown -R root:admin $PKGROOT
-cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.rtf $TMPDIR/pkg/Resources/ 
+find $PKGROOT -type f | while read file; do xattr -c $file; done
+
+cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.txt $TMPDIR/pkg/
 
 mkdir $TMPDIR/dmg
-$PACKAGEMAKER -build -v -p $TMPDIR/dmg/$PACKAGE_NAME.pkg \
-	-f $PKGROOT -r $TMPDIR/pkg/Resources \
-	-i $TMPDIR/pkg/Info.plist -d $TMPDIR/pkg/Description.plist 
+pkgbuild --root $PKGROOT --version $VERSION.$BUILD \
+	--identifier com.libjpeg-turbo.libjpeg-turbo $TMPDIR/pkg/$PACKAGE_NAME.pkg
+productbuild --distribution $SRCDIR/release/Distribution.xml \
+	--package-path $TMPDIR/pkg/ --resources $TMPDIR/pkg/ \
+	$TMPDIR/dmg/$PACKAGE_NAME.pkg
 hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
 	-srcfolder "$TMPDIR/dmg" $TMPDIR/$PACKAGE_NAME-$VERSION.dmg 
 cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg .