--- embedaddon/sudo/mkpkg	2012/10/09 09:29:52	1.1.1.3
+++ embedaddon/sudo/mkpkg	2014/06/15 16:12:53	1.1.1.6
@@ -1,5 +1,19 @@
 #!/bin/sh
 #
+# Copyright (c) 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
 # Build a binary package using polypkg
 # Usage: mkpkg [--debug] [--flavor flavor] [--platform platform] [--osversion ver]
 #
@@ -117,6 +131,10 @@ case "$osversion" in
 	    configure_opts="${configure_opts}${configure_opts+$tab}--with-pam-login"
 	    PPVARS="${PPVARS}${PPVARS+$space}linux_audit=1.4.0"
 	fi
+	if [ $osrelease -ge 60 ]; then
+	    # RHEL 6 and above builds sudo with SSSD support
+	    configure_opts="${configure_opts}${configure_opts+$tab}--with-sssd"
+	fi
 	# Note, must indent with tabs, not spaces due to IFS trickery
 	configure_opts="--prefix=/usr
 		--with-logging=syslog
@@ -129,6 +147,7 @@ case "$osversion" in
 		--with-tty-tickets
 		--with-ldap
 		--with-passprompt=[sudo] password for %p: 
+		--with-sendmail=/usr/sbin/sendmail
 		$configure_opts"
 	;;
     sles*)
@@ -147,7 +166,7 @@ case "$osversion" in
 	# Note, must indent with tabs, not spaces due to IFS trickery
 	# XXX - SuSE uses secure path but only for env_reset
 	configure_opts="--prefix=/usr
-		--libexecdir=/usr/$libexec/sudo
+		--libexecdir=/usr/$libexec
 		--with-logging=syslog
 		--with-logfac=auth
 		--with-all-insults
@@ -160,6 +179,7 @@ case "$osversion" in
 		--with-ldap
 		--with-env-editor
 		--with-passprompt=%p\'s password: 
+		--with-sendmail=/usr/sbin/sendmail
 		$configure_opts"
 
 	make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
@@ -192,12 +212,10 @@ case "$osversion" in
 		--with-timeout=15
 		--with-password-timeout=0
 		--with-passprompt=[sudo] password for %p: 
-		--with-timedir=/var/lib/sudo
 		--disable-root-mailer
-		--disable-setresuid
 		--with-sendmail=/usr/sbin/sendmail
 		--mandir=/usr/share/man
-		--libexecdir=/usr/lib/sudo
+		--libexecdir=/usr/lib
 		--with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
 		$configure_opts"
 	;;
@@ -210,12 +228,20 @@ case "$osversion" in
 	esac
 	if test "${osversion}" != "`$top_srcdir/pp --probe`"; then
 	    sdkvers=`echo "${osversion}" | sed 's/^macos\([0-9][0-9]\)\([0-9]*\)-.*$/\1.\2/'`
-	    SDK_FLAGS="-isysroot /Developer/SDKs/MacOSX${sdkvers}.sdk -mmacosx-version-min=${sdkvers}"
+	    # Newer Xcode puts /Developer under the app Contents dir.
+	    SDK_DIR="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
+	    if test -d "${SDK_DIR}/MacOSX${sdkvers}.sdk"; then
+		SDK_DIR="${SDK_DIR}/MacOSX${sdkvers}.sdk"
+	    elif test -d "/Developer/SDKs/MacOSX${sdkvers}.sdk"; then
+		SDK_DIR="/Developer/SDKs/MacOSX${sdkvers}.sdk"
+	    fi
+	    SDK_FLAGS="-isysroot ${SDK_DIR} -mmacosx-version-min=${sdkvers}"
 	fi
 	export CFLAGS="-O2 -g $ARCH_FLAGS $SDK_FLAGS"
 	export LDFLAGS="$ARCH_FLAGS $SDK_FLAGS"
 	# Note, must indent with tabs, not spaces due to IFS trickery
 	configure_opts="--with-pam
+		--with-bsm-audit
 		--without-tty-tickets
 		--enable-zlib=system
 		--with-ldap
@@ -227,6 +253,10 @@ case "$osversion" in
 		$configure_opts"
 	;;
     aix*)
+	# Use -gxcoff with gcc instead of -g for dbx-style debugging symbols.
+	if test -z "$CC" && gcc -v >/dev/null 2>&1; then
+	    CFLAGS=-gxcoff; export CFLAGS
+	fi
 	# Note, must indent with tabs, not spaces due to IFS trickery
 	# Note: we include our own zlib instead of relying on the
 	#       AIX freeware version being installed.
@@ -240,6 +270,7 @@ case "$osversion" in
 		--with-env-editor
 		--enable-zlib=builtin
 		--disable-nls
+		--with-sendmail=/usr/sbin/sendmail
 		$configure_opts"
 	PPVARS="${PPVARS}${PPVARS+$space}aix_freeware=true"
 	;;
@@ -247,8 +278,16 @@ case "$osversion" in
 	# For Solaris, add project support and use let configure choose zlib.
 	# For all others, use the builtin zlib and disable NLS support.
 	case "$osversion" in
-	    sol*) configure_opts="${configure_opts}${configure_opts+$tab}--with-project";;
-	    *) configure_opts="${configure_opts}${configure_opts+$tab}--enable-zlib=builtin${tab}--disable-nls";;
+	    sol*)
+		configure_opts="${configure_opts}${configure_opts+$tab}--with-project"
+
+		if [ $osrelease -ge 11 ]; then
+		    configure_opts="${configure_opts}${configure_opts+$tab}--with-bsm-audit"
+		fi
+		;;
+	    *)
+		configure_opts="${configure_opts}${configure_opts+$tab}--enable-zlib=builtin${tab}--disable-nls"
+		;;
 	esac
 	if test "$flavor" = "ldap"; then
 	    configure_opts="${configure_opts}${configure_opts+$tab}--with-ldap"