Skip to content

Commit

Permalink
vis: make help texts optional to produce a smaller binary
Browse files Browse the repository at this point in the history
 $ ./configure --disable-help

shrinks the binary by about 20K on a x86_64 system.
  • Loading branch information
martanne committed Feb 24, 2017
1 parent 615a2c4 commit f2090b4
Show file tree
Hide file tree
Showing 9 changed files with 311 additions and 275 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ MANPREFIX ?= ${PREFIX}/man

VERSION = $(shell git describe --always --dirty 2>/dev/null || echo "0.2-git")

CONFIG_HELP ?= 1
CONFIG_LUA ?= 1
CONFIG_LPEG ?= 0
CONFIG_TRE ?= 0
Expand All @@ -34,6 +35,7 @@ CFLAGS_VIS = $(CFLAGS_AUTO) $(CFLAGS_TERMKEY) $(CFLAGS_CURSES) $(CFLAGS_ACL) \
$(CFLAGS_SELINUX) $(CFLAGS_TRE) $(CFLAGS_LUA) $(CFLAGS_LPEG) $(CFLAGS_STD)

CFLAGS_VIS += -DVIS_PATH=\"${SHAREPREFIX}/vis\"
CFLAGS_VIS += -DCONFIG_HELP=${CONFIG_HELP}
CFLAGS_VIS += -DCONFIG_LUA=${CONFIG_LUA}
CFLAGS_VIS += -DCONFIG_LPEG=${CONFIG_LPEG}
CFLAGS_VIS += -DCONFIG_TRE=${CONFIG_TRE}
Expand Down
11 changes: 11 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Optional features:
--enable-tre build with TRE regex support [auto]
--enable-selinux build with SELinux support [auto]
--enable-acl build with POSIX ACL support [auto]
--enable-help build with built-in help texts [yes]
Some influential environment variables:
CC C compiler command [detected]
Expand Down Expand Up @@ -114,6 +115,7 @@ BINDIR='$(EXEC_PREFIX)/bin'
SHAREDIR='$(PREFIX)/share'
MANDIR='$(PREFIX)/share/man'

help=yes
lua=auto
lpeg=auto
tre=auto
Expand All @@ -131,6 +133,8 @@ case "$arg" in
--mandir=*) MANDIR=${arg#*=} ;;
--environment-only) environmentonly=yes ;;
--static) static=yes ;;
--enable-help|--enable-help=yes) help=yes ;;
--disable-help|--enable-help=no) help=no ;;
--enable-lua|--enable-lua=yes) lua=yes ;;
--disable-lua|--enable-lua=no) lua=no ;;
--enable-lpeg|--enable-lpeg=yes) lpeg=yes ;;
Expand Down Expand Up @@ -283,6 +287,12 @@ printf "checking for pkg-config... "
cmdexists pkg-config && have_pkgconfig=yes
printf "%s\n" "$have_pkgconfig"

if test "$help" = "yes" ; then
CONFIG_HELP=1
else
CONFIG_HELP=0
fi

# libcurses is a mandatory dependency

printf "checking for libcurses...\n"
Expand Down Expand Up @@ -585,6 +595,7 @@ CFLAGS_CURSES = $CFLAGS_CURSES
LDFLAGS_CURSES = $LDFLAGS_CURSES
CFLAGS_TERMKEY = $CFLAGS_TERMKEY
LDFLAGS_TERMKEY = $LDFLAGS_TERMKEY
CONFIG_HELP = $CONFIG_HELP
REGEX_SRC = $REGEX_SRC
CONFIG_TRE = $CONFIG_TRE
CFLAGS_TRE = $CFLAGS_TRE
Expand Down
Loading

0 comments on commit f2090b4

Please sign in to comment.