260 lines
5.4 KiB
Bash
Executable file
260 lines
5.4 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
usage() {
|
|
cat <<USAGE
|
|
There is an error in your command.
|
|
More information: ./configure --help
|
|
USAGE
|
|
exit
|
|
}
|
|
|
|
help() {
|
|
cat <<HELP
|
|
This script tries to be similar to autotools' \`configure', but is different.
|
|
|
|
Usage: ./configure [OPTION]...
|
|
|
|
Defaults for the options are specified in brackets.
|
|
|
|
Configuration:
|
|
-h, --help Display this help and exit
|
|
|
|
Installation directories:
|
|
--prefix PREFIX install architecture-independent files in PREFIX
|
|
[/usr/local]
|
|
--exec-prefix EPREFIX install architecture-dependent files in EPREFIX
|
|
[PREFIX]
|
|
|
|
By default, \`make install' will install all the files in
|
|
\`/usr/local/bin', \`/usr/local/lib' etc. You can specify
|
|
an installation prefix other than \`/usr/local' using \`--prefix',
|
|
for instance \`--prefix \$HOME'.
|
|
|
|
For better control, use the options below.
|
|
|
|
File tuning of the installation directories:
|
|
--bindir DIR user executables [EPREFIX/bin]
|
|
--datarootdir DIR read-only arch.-independent data root [PREFIX/share]
|
|
--mandir DIR man documentation [DATAROOTDIR/man]
|
|
|
|
Optional Features:
|
|
--disable-xinerama disable Xinerama
|
|
|
|
Optional Packages:
|
|
--with-PACKAGE[ ARG] use PACKAGE [ARG=yes]
|
|
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE no)
|
|
--with-locker [i3lock|i3lock-color]
|
|
use ARG as screen locker [i3lock]
|
|
--without-locker do not use screen locker at all
|
|
--with-terminal [alacritty|gnome|st|xterm]
|
|
use ARG as terminal [alacritty]
|
|
--without-terminal do not use terminal at all
|
|
HELP
|
|
exit
|
|
}
|
|
|
|
prefix='/usr/local'
|
|
eprefix=''
|
|
bindir=''
|
|
datarootdir=''
|
|
mandir=''
|
|
enable_xinerama=''
|
|
with_locker=''
|
|
with_terminal=''
|
|
|
|
while [ $# -gt 0 ]; do
|
|
do_shift='yes'
|
|
|
|
case "$1" in
|
|
-h | -? | --help | -help | help)
|
|
help
|
|
;;
|
|
--prefix)
|
|
shift
|
|
prefix="$1"
|
|
;;
|
|
--exec-prefix)
|
|
shift
|
|
eprefix="$1"
|
|
;;
|
|
--bindir)
|
|
shift
|
|
bindir="$1"
|
|
;;
|
|
--datarootdir)
|
|
shift
|
|
datarootdir="$1"
|
|
;;
|
|
--mandir)
|
|
shift
|
|
mandir="$1"
|
|
;;
|
|
--disable-xinerama)
|
|
enable_xinerama='no'
|
|
;;
|
|
--without-locker)
|
|
if [ "$with_locker" = '' ]; then
|
|
with_locker='no'
|
|
elif [ "$with_locker" != 'no' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
--without-terminal)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='no'
|
|
elif [ "$with_terminal" != 'no' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
--with-locker)
|
|
shift
|
|
|
|
case "$1" in
|
|
yes)
|
|
if [ "$with_locker" = '' ]; then
|
|
with_locker='yes'
|
|
elif [ "$with_locker" != 'yes' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
no)
|
|
if [ "$with_locker" = '' ]; then
|
|
with_locker='no'
|
|
elif [ "$with_locker" != 'no' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
i3lock)
|
|
if [ "$with_locker" = '' ]; then
|
|
with_locker='i3lock'
|
|
elif [ "$with_locker" != 'i3lock' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
i3lock-color)
|
|
if [ "$with_locker" = '' ]; then
|
|
with_locker='i3lock-color'
|
|
elif [ "$with_locker" != 'i3lock-color' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
*)
|
|
do_shift='no'
|
|
;;
|
|
esac
|
|
;;
|
|
--with-terminal)
|
|
shift
|
|
|
|
case "$1" in
|
|
yes)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='yes'
|
|
elif [ "$with_terminal" != 'yes' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
no)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='no'
|
|
elif [ "$with_terminal" != 'no' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
alacritty)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='alacritty'
|
|
elif [ "$with_terminal" != 'alacritty' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
gnome)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='gnome'
|
|
elif [ "$with_terminal" != 'gnome' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
st)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='st'
|
|
elif [ "$with_terminal" != 'st' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
xterm)
|
|
if [ "$with_terminal" = '' ]; then
|
|
with_terminal='xterm'
|
|
elif [ "$with_terminal" != 'xterm' ]; then
|
|
usage
|
|
fi
|
|
;;
|
|
*)
|
|
do_shift='no'
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
|
|
if [ "$do_shift" = 'yes' ]; then shift; fi
|
|
done
|
|
|
|
if [ "$eprefix" = '' ]; then
|
|
eprefix="$prefix"
|
|
fi
|
|
|
|
if [ "$bindir" = '' ]; then
|
|
bindir="$eprefix/bin"
|
|
fi
|
|
|
|
if [ "$datarootdir" = '' ]; then
|
|
datarootdir="$prefix/share"
|
|
fi
|
|
|
|
if [ "$mandir" = '' ]; then
|
|
mandir="$datarootdir/man"
|
|
fi
|
|
|
|
if [ "$enable_xinerama" = '' ]; then
|
|
enable_xinerama='yes'
|
|
fi
|
|
|
|
if [ "$with_locker" = '' -o "$with_locker" = 'yes' ]; then
|
|
with_locker='i3lock'
|
|
fi
|
|
|
|
if [ "$with_terminal" = '' -o "$with_terminal" = 'yes' ]; then
|
|
with_terminal='alacritty'
|
|
fi
|
|
|
|
echo "PREFIX = $prefix"
|
|
echo "EPREFIX = $eprefix"
|
|
echo "BINDIR = $bindir"
|
|
echo "DATAROOTDIR = $datarootdir"
|
|
echo "MANDIR = $mandir"
|
|
echo "ENABLE_XINERAMA = $enable_xinerama"
|
|
echo "WITH_LOCKER = $with_locker"
|
|
echo "WITH_TERMINAL = $with_terminal"
|
|
|
|
cat > 'config/1-generated.mk' << MAKE
|
|
PREFIX = $prefix
|
|
EPREFIX = $eprefix
|
|
BINDIR = $bindir
|
|
DATAROOTDIR = $datarootdir
|
|
MANDIR = $mandir
|
|
ENABLE_XINERAMA = $enable_xinerama
|
|
WITH_LOCKER = $with_locker
|
|
WITH_TERMINAL = $with_terminal
|
|
MAKE
|
|
|
|
make_help_result="$(make --help 2>&1 || true)"
|
|
if [ "$(echo "$make_help_result" | grep 'gnu.org')" = '' ]; then
|
|
ln -sf '2-conditionals-bsd.mk' 'config/2-conditionals.mk'
|
|
else
|
|
ln -sf '2-conditionals-gnu.mk' 'config/2-conditionals.mk'
|
|
fi
|