2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00
sudo/mkpkg

151 lines
3.5 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# Build a binary package using polypkg
# Usage: mkpkg
#
# Make sure IFS is set to space, tab, newline in that order.
nl='
'
IFS=" $nl"
top_srcdir=`dirname $0`
platform=`$top_srcdir/pp --probe` || exit 1
# Default paths
prefix=/usr/local
# Linux distros may build binaries as pie files.
# This is really something libtool should figure out, but it does not.
case "$platform" in
*-s390*|*-sparc*|*-alpha*)
F_PIE=-fPIE
;;
*)
F_PIE=-fpie
;;
esac
# Choose configure options by platform.
# We use the same configure options as vendor packages when possible.
case "$platform" in
2010-07-14 15:54:09 -04:00
centos*|rhel*)
prefix=/usr
2010-07-14 15:54:09 -04:00
case "$platform" in
centos[0-4].*|rhel[0-4].*)
;;
*)
# RHEL 5 and up build pies and have audit support
export CFLAGS="$F_PIE" LDFLAGS="-pie"
configure_opts="--with-linux-audit"
;;
esac
# Note, must indent with tabs, not spaces due to IFS trickery
2010-07-14 15:54:09 -04:00
configure_opts="$configure_opts
--prefix=$prefix
--with-logging=syslog
--with-logfac=authpriv
--with-pam
--with-pam-login
2010-07-14 16:03:59 -04:00
--enable-zlib
--with-editor=/bin/vi
--with-env-editor
--with-ignore-dot
--with-tty-tickets
--with-ldap
--with-selinux
--with-passprompt=[sudo] password for %p: "
;;
2010-07-14 15:54:09 -04:00
sles*)
prefix=/usr
case "$platform" in
2010-07-14 15:54:09 -04:00
sles[0-9].*)
;;
sles10.*)
# SLES 10 and higher build pies
export CFLAGS="$F_PIE" LDFLAGS="-pie"
;;
*)
# SLES 11 and higher has SELinux too
export CFLAGS="$F_PIE" LDFLAGS="-pie"
configure_opts="--with-selinux"
;;
esac
# SuSE doesn't have /usr/libexec
case "$platform" in
*64*) libexec=lib64;;
*) libexec=lib;;
esac
# Note, must indent with tabs, not spaces due to IFS trickery
# XXX - SuSE uses secure path but only for env_reset
2010-07-14 15:54:09 -04:00
configure_opts="$configure_opts
--prefix=$prefix
--libexecdir=$prefix/$libexec/sudo
--with-logging=syslog
--with-logfac=auth
--with-all-insults
--with-ignore-dot
--with-tty-tickets
--enable-shell-sets-home
--with-sudoers-mode=0440
--with-pam
2010-07-14 16:03:59 -04:00
--enable-zlib
--with-ldap
--with-env-editor
--with-passprompt=%p\'s password: "
make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
;;
deb*)
2010-07-15 15:19:37 -04:00
prefix=/usr
2010-07-13 17:52:50 -04:00
# Note, must indent with tabs, not spaces due to IFS trickery
2010-07-15 15:44:36 -04:00
if test "${SUDO_FLAVOR:-vanilla}" = "ldap"; then
configure_opts="--with-ldap
--with-ldap-conf-file=/etc/sudo-ldap.conf"
fi
configure_opts="$configure_opts
2010-07-13 17:52:50 -04:00
--prefix=/usr
--with-all-insults
--with-exempt=sudo
--with-pam
2010-07-14 16:03:59 -04:00
--enable-zlib
2010-07-13 17:52:50 -04:00
--with-fqdn
--with-logging=syslog
--with-logfac=authpriv
--with-env-editor
--with-editor=/usr/bin/editor
--with-timeout=15
--with-password-timeout=0
--with-passprompt=[sudo] password for %p:
--with-timedir=/var/lib/sudo
2010-07-13 17:52:50 -04:00
--disable-root-mailer
--disable-setresuid
--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"
;;
*)
2010-07-15 15:44:36 -04:00
if test "${SUDO_FLAVOR:-vanilla}" = "ldap"; then
2010-07-14 15:56:37 -04:00
configure_opts="--with-ldap"
fi
# Note, must indent with tabs, not spaces due to IFS trickery
2010-07-14 15:56:37 -04:00
configure_opts="$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"
;;
esac
# Remove spaces from IFS when setting $@ so that passprompt may include them
OIFS="$IFS"
IFS=" $nl"
set -- $configure_opts
IFS="$OIFS"
$top_srcdir/configure "$@" || exit 1
make $make_opts && make $make_opts package