-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Rework the autotools setup prototype
Changes: - uses subdirectories/recursive builds - boost is bootstrapped as part of autogen.sh - boost libraries are only built when needed - Boost::JSON is statically linked instead of using the header-only version of the library Ticket: MEN-5795 Changelog: None Signed-off-by: Vratislav Podzimek <[email protected]>
- Loading branch information
Showing
10 changed files
with
108 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,3 @@ | ||
AUTOMAKE_OPTIONS = subdir-objects | ||
|
||
ACLOCAL_AMFLAGS = -I m4 | ||
|
||
AM_CXXFLAGS = -std=c++11 -Wall -Werror | ||
AM_CPPFLAGS = \ | ||
-I$(srcdir)/common/json \ | ||
-I$(srcdir)/vendor/boost/install/include | ||
|
||
# Two daemons | ||
bin_PROGRAMS = men-authd men-updated | ||
|
||
# Headers for libraries and utils under common to be listed here | ||
COMMON_SOURCES = common/json/json.hpp \ | ||
common/json/impl/boost/boost_json.hpp | ||
|
||
# Libraries objects to be listed here | ||
noinst_LIBRARIES = \ | ||
libjson.a | ||
|
||
# For each library, set the source(s) | ||
libjson_a_SOURCES = common/json/impl/boost/boost_json.cpp | ||
|
||
# Auth daemon | ||
AUTH_SOURCES = mender-auth/main.cpp | ||
men_authd_SOURCES = $(COMMON_SOURCES) $(AUTH_SOURCES) | ||
men_authd_LDADD = $(LIBRARIES) | ||
|
||
# Update daemon | ||
UPDATE_SOURCES = mender-update/main.cpp | ||
men_updated_SOURCES = $(COMMON_SOURCES) $(UPDATE_SOURCES) | ||
men_updated_LDADD = $(LIBRARIES) | ||
SUBDIRS = common vendor mender-auth mender-update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ ! -f "$(dirname "$0")/vendor/googletest/README.md" ] ; then | ||
echo "Please run the following to clone submodules first:" | ||
echo " git submodule update --init" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "$(dirname "$0")/vendor/boost/libs/json/README.md" ] ; then | ||
echo "Please initialize and build required Boost libraries with:" | ||
echo " ./bootstrap_boost.sh" | ||
exit 1 | ||
if [ ! -f "$(dirname "$0")/vendor/boost/b2" ] ; then | ||
$(dirname "$0")/bootstrap_boost.sh | ||
fi | ||
|
||
( cd "$(dirname "$0")" && autoreconf -i ) | ||
cd "$(dirname "$0")" | ||
aclocal --install | ||
autoreconf --install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
AUTOMAKE_OPTIONS = subdir-objects | ||
|
||
BUILT_SOURCES = $(builddir)/../vendor/libboost_json.built | ||
|
||
$(builddir)/../vendor/libboost_%.built: | ||
$(MAKE) -C $(builddir)/../vendor libboost_$*.built | ||
|
||
# Libraries objects to be listed here | ||
noinst_LTLIBRARIES = \ | ||
libjson.la | ||
|
||
# For each library, set the source(s) | ||
libjson_la_SOURCES = $(srcdir)/json/impl/boost/boost_json.cpp | ||
libjson_la_CPPFLAGS = $(BOOST_CPPFLAGS) -I $(srcdir)/../ | ||
libjson_la_LIBADD = $(BOOST_JSON_LIB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
m4_define([version], m4_normalize(m4_esyscmd([git describe --exact HEAD 2>/dev/null || git rev-parse --short HEAD]))) | ||
AC_INIT([mender], [version], [[email protected]]) | ||
m4_define([mender_version], m4_normalize(m4_esyscmd([git describe --exact HEAD 2>/dev/null || git rev-parse --short HEAD]))) | ||
AC_INIT([mender], [mender_version], [[email protected]]) | ||
AC_CANONICAL_TARGET | ||
AM_INIT_AUTOMAKE([-Wall -Werror foreign]) | ||
AM_SILENT_RULES([yes]) | ||
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign]) | ||
|
||
dnl Use the m4 directory for m4 macros (convention): | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
|
||
AM_SILENT_RULES([yes]) | ||
|
||
AM_PROG_AR | ||
LT_INIT([disable-shared]) | ||
|
||
|
@@ -17,26 +18,40 @@ dnl (Make these variables available for use in Makefile.am) | |
AM_CONDITIONAL([LINUX], [test -n "`echo ${target_os} | grep linux`"]) | ||
AM_CONDITIONAL([MACOSX], [test -n "`echo ${target_os} | grep darwin`"]) | ||
|
||
|
||
dnl TODO: Switch to Boost from OS packages and configure the build with: | ||
dnl https://www.gnu.org/software/autoconf-archive/ax_boost_base.html | ||
dnl https://www.gnu.org/software/autoconf-archive/ax_boost_json.html | ||
dnl | ||
dnl AX_BOOST_BASE([1.75.0], | ||
dnl [AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}]) | ||
dnl AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}]) | ||
dnl AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])], | ||
dnl [AC_MSG_ERROR([Boost 1.75.0 or later is required but was not found.])]) | ||
dnl AX_BOOST_JSON | ||
dnl AC_SUBST([boost_json_LIBS], [${BOOST_JSON_LIB}]) | ||
dnl AC_MSG_NOTICE([boost_json_LIBS : ${boost_json_LIBS}]) | ||
BOOST_VENDOR_DIR="`cd $(dirname $0); pwd`/vendor/boost" | ||
AC_CACHE_CHECK([whether Boost was bootstrapped (at ${BOOST_VENDOR_DIR})], | ||
ax_cv_boost_bootstrapped, | ||
AS_IF([test -f "${BOOST_VENDOR_DIR}/b2"], | ||
[ax_cv_boost_bootstrapped=yes], | ||
[ax_cv_boost_bootstrapped=no] | ||
) | ||
) | ||
AS_IF([test "x$ax_cv_boost_bootstrapped" != "xyes"], | ||
[AC_MSG_ERROR([Boost at ${BOOST_VENDOR_DIR} not boostrapped])] | ||
) | ||
|
||
BOOST_INSTALL_DIR="${BOOST_VENDOR_DIR}/install" | ||
BOOST_CPPFLAGS="-I ${BOOST_INSTALL_DIR}/include" | ||
BOOST_LDFLAGS="-L${BOOST_INSTALL_DIR}/lib" | ||
AC_SUBST(BOOST_CPPFLAGS) | ||
AC_SUBST(BOOST_LDFLAGS) | ||
AC_MSG_NOTICE([BOOST_CPPFLAGS : ${BOOST_CPPFLAGS}]) | ||
AC_MSG_NOTICE([BOOST_LDFLAGS : ${BOOST_LDFLAGS}]) | ||
|
||
BOOST_JSON_LIB="-lboost_json" | ||
AC_SUBST(BOOST_JSON_LIB) | ||
AC_MSG_NOTICE([BOOST_JSON_LIB : ${BOOST_JSON_LIB}]) | ||
|
||
AC_CONFIG_HEADERS([config.h]) | ||
AC_CONFIG_FILES([ | ||
Makefile | ||
Makefile | ||
common/Makefile | ||
vendor/Makefile | ||
mender-auth/Makefile | ||
mender-update/Makefile | ||
]) | ||
|
||
dnl Set C++ standard | ||
CXXFLAGS="$CXXFLAGS -std=c++11" | ||
dnl Set C++ standard and a few nice compiler options | ||
CXXFLAGS="$CXXFLAGS -std=c++11 -Wall -Werror" | ||
|
||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AUTOMAKE_OPTIONS = subdir-objects | ||
|
||
ACLOCAL_AMFLAGS = -I m4 | ||
|
||
AM_CPPFLAGS = -I $(srcdir)/.. | ||
|
||
bin_PROGRAMS = men-authd | ||
|
||
# Auth daemon | ||
men_authd_SOURCES = main.cpp | ||
men_authd_LDFLAGS = $(BOOST_LDFLAGS) | ||
men_authd_LDADD = $(builddir)/../common/libjson.la |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AUTOMAKE_OPTIONS = subdir-objects | ||
|
||
ACLOCAL_AMFLAGS = -I m4 | ||
|
||
AM_CPPFLAGS = -I$(srcdir)/.. | ||
|
||
bin_PROGRAMS = men-updated | ||
|
||
# Auth daemon | ||
men_updated_SOURCES = main.cpp | ||
men_updated_LDFLAGS = $(BOOST_LDFLAGS) | ||
men_updated_LDADD = $(builddir)/../common/libjson.la |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AUTOMAKE_OPTIONS = subdir-objects | ||
|
||
libboost_%.built: | ||
$(SHELL) -c "cd $(srcdir)/boost; ./b2 --build-dir=build --prefix=install --with-$* link=static install" | ||
touch libboost_$*.built | ||
|
||
clean-local: | ||
$(SHELL) -c "cd $(srcdir)/boost; git clean -df" | ||
rm -f libboost_*.built | ||
|
||
distclean-local: | ||
$(SHELL) -c "cd $(srcdir)/boost; git clean -xdf" |