Skip to content

Commit

Permalink
build: run configure before building dependencies
Browse files Browse the repository at this point in the history
We need some basic configuration before building dependencies. For
example useful CFLAGS have to be in place to prevent linker errors.

The configure script is run again later with some extra parameters.
  • Loading branch information
eworm-de committed Apr 24, 2016
1 parent eb176b4 commit 73e6d7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
2 changes: 2 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,15 @@ dependencies-local:
$(MAKE) dependency/build/local

local: clean
./configure --environment-only
$(MAKE) dependencies-local
./configure CFLAGS="-I$(DEPS_INC)" LDFLAGS="-L$(DEPS_LIB)" LD_LIBRARY_PATH="$(DEPS_LIB)"
$(MAKE)
@echo Run with: LD_LIBRARY_PATH=$(DEPS_LIB) ./vis

standalone: clean
[ ! -e dependency/build/local ] || $(MAKE) dependencies-clean
./configure --environment-only
$(MAKE) dependency/build/libmusl-install
PATH=$(DEPS_BIN):$$PATH PKG_CONFIG_PATH= PKG_CONFIG_LIBDIR= $(MAKE) \
CC=musl-gcc dependency/build/standalone
Expand Down
55 changes: 37 additions & 18 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Defaults for the options are specified in brackets.
Configuration:
--srcdir=DIR source directory [detected]
--environment-only check environment only, no system libraries
Installation directories:
--prefix=PREFIX main installation prefix [/usr/local]
Expand Down Expand Up @@ -125,6 +126,7 @@ case "$arg" in
--bindir=*) BINDIR=${arg#*=} ;;
--sharedir=*) SHAREDIR=${arg#*=} ;;
--mandir=*) MANDIR=${arg#*=} ;;
--environment-only) environmentonly=yes ;;
--enable-lua|--enable-lua=yes) lua=yes ;;
--disable-lua|--enable-lua=no) lua=no ;;
--enable-selinux|--enable-selinux=yes) selinux=yes ;;
Expand Down Expand Up @@ -225,6 +227,39 @@ tryldflag LDFLAGS_AUTO -Wl,-z,now
tryldflag LDFLAGS_AUTO -Wl,-z,relro
#tryldflag LDFLAGS_AUTO -pie

printf "creating config.mk... "

cmdline=$(quote "$0")
for i ; do cmdline="$cmdline $(quote "$i")" ; done

exec 3>&1 1>config.mk

cat << EOF
# This version of config.mk was generated by:
# $cmdline
# Any changes made here will be lost if configure is re-run
SRCDIR = $SRCDIR
PREFIX = $PREFIX
EXEC_PREFIX = $EXEC_PREFIX
BINDIR = $BINDIR
MANPREFIX = $MANDIR
SHAREPREFIX = $SHAREDIR
CC = $CC
CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
CFLAGS_STD = $CFLAGS_STD
LDFLAGS_STD = $LDFLAGS_STD
CFLAGS_AUTO = $CFLAGS_AUTO
LDFLAGS_AUTO = $LDFLAGS_AUTO
EOF
exec 1>&3 3>&-

printf "done\n"

if test "$environmentonly" = "yes"; then
exit 0
fi

have_pkgconfig=no
printf "checking for pkg-config... "
cmdexists pkg-config && have_pkgconfig=yes
Expand Down Expand Up @@ -430,30 +465,14 @@ EOF
fi
fi

printf "creating config.mk... "
printf "completing config.mk... "

cmdline=$(quote "$0")
for i ; do cmdline="$cmdline $(quote "$i")" ; done

exec 3>&1 1>config.mk
exec 3>&1 1>>config.mk

cat << EOF
# This version of config.mk was generated by:
# $cmdline
# Any changes made here will be lost if configure is re-run
SRCDIR = $SRCDIR
PREFIX = $PREFIX
EXEC_PREFIX = $EXEC_PREFIX
BINDIR = $BINDIR
MANPREFIX = $MANDIR
SHAREPREFIX = $SHAREDIR
CC = $CC
CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
CFLAGS_STD = $CFLAGS_STD
LDFLAGS_STD = $LDFLAGS_STD
CFLAGS_AUTO = $CFLAGS_AUTO
LDFLAGS_AUTO = $LDFLAGS_AUTO
CFLAGS_CURSES = $CFLAGS_CURSES
LDFLAGS_CURSES = $LDFLAGS_CURSES
CFLAGS_TERMKEY = $CFLAGS_TERMKEY
Expand Down

0 comments on commit 73e6d7f

Please sign in to comment.