add build deps to enable use of autoreconf in rules
[debian/sudo] / mkpkg
diff --git a/mkpkg b/mkpkg
index 12c1d849c443ae1452e54362fcf2bc4d0b6bce23..32771235434b5b7693e762d8e27433ad4fc3606c 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -121,47 +121,51 @@ fi
 case "$osversion" in
     centos*|rhel*)
        prefix=/usr
+       if [ $osrelease -ge 40 ]; then
+           # RHEL 4 and up support SELinux
+           configure_opts="${configure_opts}${configure_opts+$tab}--with-selinux"
+       fi
        if [ $osrelease -ge 50 ]; then
-           # RHEL 5 and up build pies and have audit support
-           export CFLAGS="-O2 $F_PIE" LDFLAGS="-pie"
+           # RHEL 5 and up build pies, have audit support and use a
+           # separate PAM config file for "sudo -i".
+           export CFLAGS="-O2 -g $F_PIE" LDFLAGS="-pie"
            configure_opts="${configure_opts}${configure_opts+$tab}--with-linux-audit"
+           configure_opts="${configure_opts}${configure_opts+$tab}--with-pam-login"
            PPVARS="${PPVARS}${PPVARS+$space}linux_audit=1.4.0"
        fi
        # Note, must indent with tabs, not spaces due to IFS trickery
-       configure_opts="$configure_opts
-               --prefix=$prefix
+       configure_opts="--prefix=$prefix
                --with-logging=syslog
                --with-logfac=authpriv
                --with-pam
-               --with-pam-login
                --enable-zlib=system
                --with-editor=/bin/vi
                --with-env-editor
                --with-ignore-dot
                --with-tty-tickets
                --with-ldap
-               --with-selinux
-               --with-passprompt=[sudo] password for %p: "
+               --with-passprompt=[sudo] password for %p: 
+               $configure_opts"
        ;;
     sles*)
        prefix=/usr
        if [ $osrelease -ge 10 ]; then
            # SLES 10 and higher build pies
-           export CFLAGS="-O2 $F_PIE" LDFLAGS="-pie"
+           export CFLAGS="-O2 -g $F_PIE" LDFLAGS="-pie"
            if [ $osrelease -ge 11 ]; then
                # SLES 11 and higher has SELinux
                configure_opts="${configure_opts}${configure_opts+$tab}--with-selinux"
            fi
        fi
        # SuSE doesn't have /usr/libexec
+       libexec=lib
        case "$osversion" in
-           *64*)       libexec=lib64;;
-           *)          libexec=lib;;
+           *64*)       gcc -v 2>&1 | grep "with-cpu=[^ ]*32" >/dev/null || libexec=lib64
+                       ;;
        esac
        # Note, must indent with tabs, not spaces due to IFS trickery
        # XXX - SuSE uses secure path but only for env_reset
-       configure_opts="$configure_opts
-               --prefix=$prefix
+       configure_opts="--prefix=$prefix
                --libexecdir=$prefix/$libexec/sudo
                --with-logging=syslog
                --with-logfac=auth
@@ -174,7 +178,8 @@ case "$osversion" in
                --enable-zlib=system
                --with-ldap
                --with-env-editor
-               --with-passprompt=%p\'s password: "
+               --with-passprompt=%p\'s password: 
+               $configure_opts"
 
        make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
        ;;
@@ -184,6 +189,14 @@ case "$osversion" in
        case "$osversion" in
            ubu*)
                configure_opts="${configure_opts}${configure_opts+$tab}--enable-admin-flag${tab}--without-lecture"
+               if [ $osrelease -ge 1004 ]; then
+                   export CFLAGS="-O2 -g $F_PIE" LDFLAGS="-pie"
+               fi
+               ;;
+           deb*)
+               if [ $osrelease -ge 600 ]; then
+                   export CFLAGS="-O2 -g $F_PIE" LDFLAGS="-pie"
+               fi
                ;;
        esac
        # Note, must indent with tabs, not spaces due to IFS trickery
@@ -191,10 +204,8 @@ case "$osversion" in
            configure_opts="${configure_opts}${configure_opts+$tab}--with-ldap
                --with-ldap-conf-file=/etc/sudo-ldap.conf"
        fi
-       configure_opts="$configure_opts
-               --prefix=/usr
+       configure_opts="--prefix=/usr
                --with-all-insults
-               --with-exempt=sudo
                --with-pam
                --enable-zlib=system
                --with-fqdn
@@ -211,26 +222,57 @@ case "$osversion" in
                --with-sendmail=/usr/sbin/sendmail
                --mandir=/usr/share/man
                --libexecdir=/usr/lib/sudo
-               --with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
+               --with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
+               $configure_opts"
+       ;;
+    macos*)
+       case "$osversion" in
+           *i386|*x86_64)
+               # Build intel-only universal binaries
+               ARCH_FLAGS="-arch i386 -arch x86_64"
+               ;;
+       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}"
+       fi
+       export CFLAGS="-O2 -g $ARCH_FLAGS $SDK_FLAGS"
+       export LDFLAGS="$ARCH_FLAGS $SDK_FLAGS"
+       if [ $osrelease -ge 105 ]; then
+           CFLAGS="$CFLAGS $F_PIE"
+           LDFLAGS="$LDFLAGS -Wl,-pie"
+       fi
+       # Note, must indent with tabs, not spaces due to IFS trickery
+       configure_opts="--prefix=$prefix
+               --with-pam
+               --without-tty-tickets
+               --enable-zlib=system
+               --with-ldap
+               --with-insults=disabled
+               --with-logging=syslog
+               --with-logfac=authpriv
+               --with-editor=/usr/bin/vim
+               --with-env-editor
+               $configure_opts"
        ;;
     *)
        # For Solaris, add project support and use let configure choose zlib.
-       # For all others, use the builtin 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";;
+           *) 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"
        fi
        # Note, must indent with tabs, not spaces due to IFS trickery
-       configure_opts="$configure_opts
-               --prefix=$prefix
+       configure_opts="--prefix=$prefix
                --with-insults=disabled
                --with-logging=syslog
                --with-logfac=auth
                --with-editor=/usr/bin/vim:/usr/bin/vi:/bin/vi
-               --with-env-editor"
+               --with-env-editor
+               $configure_opts"
        ;;
 esac