Improve configuration script to configure terminals

This commit is contained in:
Alex Kotov 2021-11-18 18:09:40 +05:00
parent 498f9d1d80
commit 8be8ec9eb2
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
4 changed files with 124 additions and 34 deletions

View File

@ -1,8 +1,14 @@
.if "$(ENABLE_GNOME_TERMINAL)" == "yes"
CPPFLAGS += -DENABLE_GNOME_TERMINAL
.endif
.if "$(ENABLE_XINERAMA)" == "yes"
CPPFLAGS += -DENABLE_XINERAMA
PKGS += xinerama
.endif
.if "$(WITH_TERMINAL)" == "ptterm"
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_PTTERM
.endif
.if "$(WITH_TERMINAL)" == "xterm"
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_XTERM
.endif
.if "$(WITH_TERMINAL)" == "gnome"
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_GNOME
.endif

View File

@ -1,8 +1,14 @@
ifeq (yes,$(ENABLE_GNOME_TERMINAL))
CPPFLAGS += -DENABLE_GNOME_TERMINAL
endif
ifeq (yes,$(ENABLE_XINERAMA))
CPPFLAGS += -DENABLE_XINERAMA
PKGS += xinerama
endif
ifeq (ptterm,$(WITH_TERMINAL))
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_PTTERM
endif
ifeq (xterm,$(WITH_TERMINAL))
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_XTERM
endif
ifeq (gnome,$(WITH_TERMINAL))
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_GNOME
endif

118
configure vendored
View File

@ -2,6 +2,14 @@
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.
@ -34,7 +42,15 @@ File tuning of the installation directories:
Optional Features:
--enable-gnome-terminal use GNOME Terminal instead of ptterm
--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-terminal [ptterm|xterm|gnome]
use ARG as terminal [ptterm]
--without-terminal do not use terminal at all
HELP
exit
}
prefix='/usr/local'
@ -42,14 +58,15 @@ eprefix=''
bindir=''
datarootdir=''
mandir=''
enable_gnome_terminal='no'
enable_xinerama='yes'
enable_xinerama=''
with_terminal=''
while [ $# -gt 0 ]; do
do_shift='yes'
case "$1" in
-h | -? | --help | -help | help)
help
exit
;;
--prefix)
shift
@ -71,19 +88,66 @@ while [ $# -gt 0 ]; do
shift
mandir="$1"
;;
--enable-gnome-terminal)
enable_gnome_terminal='yes'
;;
--disable-xinerama)
enable_xinerama='no'
;;
--without-terminal)
if [ "$with_terminal" = '' ]; then
with_terminal='no'
elif [ "$with_terminal" != 'no' ]; then
usage
fi
;;
--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
;;
ptterm)
if [ "$with_terminal" = '' ]; then
with_terminal='ptterm'
elif [ "$with_terminal" != 'ptterm' ]; then
usage
fi
;;
xterm)
if [ "$with_terminal" = '' ]; then
with_terminal='xterm'
elif [ "$with_terminal" != 'xterm' ]; then
usage
fi
;;
gnome)
if [ "$with_terminal" = '' ]; then
with_terminal='gnome'
elif [ "$with_terminal" != 'gnome' ]; then
usage
fi
;;
*)
do_shift='no'
;;
esac
;;
*)
help
exit
usage
;;
esac
shift
if [ "$do_shift" = 'yes' ]; then shift; fi
done
if [ "$eprefix" = '' ]; then
@ -102,22 +166,30 @@ if [ "$mandir" = '' ]; then
mandir="$datarootdir/man"
fi
echo "PREFIX = $prefix"
echo "EPREFIX = $eprefix"
echo "BINDIR = $bindir"
echo "DATAROOTDIR = $datarootdir"
echo "MANDIR = $mandir"
echo "ENABLE_GNOME_TERMINAL = $enable_gnome_terminal"
echo "ENABLE_XINERAMA = $enable_xinerama"
if [ "$enable_xinerama" = '' ]; then
enable_xinerama='yes'
fi
if [ "$with_terminal" = '' -o "$with_terminal" = 'yes' ]; then
with_terminal='ptterm'
fi
echo "PREFIX = $prefix"
echo "EPREFIX = $eprefix"
echo "BINDIR = $bindir"
echo "DATAROOTDIR = $datarootdir"
echo "MANDIR = $mandir"
echo "ENABLE_XINERAMA = $enable_xinerama"
echo "WITH_TERMINAL = $with_terminal"
cat > 'config/1-generated.mk' << MAKE
PREFIX = $prefix
EPREFIX = $eprefix
BINDIR = $bindir
DATAROOTDIR = $datarootdir
MANDIR = $mandir
ENABLE_GNOME_TERMINAL = $enable_gnome_terminal
ENABLE_XINERAMA = $enable_xinerama
PREFIX = $prefix
EPREFIX = $eprefix
BINDIR = $bindir
DATAROOTDIR = $datarootdir
MANDIR = $mandir
ENABLE_XINERAMA = $enable_xinerama
WITH_TERMINAL = $with_terminal
MAKE
make_help_result="$(make --help 2>&1 || true)"

View File

@ -37,15 +37,21 @@ static struct Command commands[] = {
NULL,
},
},
#ifdef WITH_TERMINAL
{
.name = "term",
.monitor_arg_index = 0,
#ifdef ENABLE_GNOME_TERMINAL
.args = { "gnome-terminal", "--wait", NULL },
#else
#ifdef WITH_TERMINAL_PTTERM
.args = { "ptterm", NULL },
#endif
#ifdef WITH_TERMINAL_XTERM
.args = { "xterm", NULL },
#endif
#ifdef WITH_TERMINAL_GNOME
.args = { "gnome-terminal", "--wait", NULL },
#endif
},
#endif
{
.name = "firefox",
.monitor_arg_index = 0,