-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
external_libs: build deps sys, add libcdada
This commit does two major things: 1) Adds external_libs/ folder, and prepares the build system to accept building, as part of pmacct's `make` process, external dependencies. These external dependencies are in the form of git submodules, which are cloned and checkedout as part of the build process. 2) Adds libcdada submodule as a dependency of pmacct, and also as a showcase of the build system, to later be used by the code. A bit more details on 2). `src/external_libs/Makefile.am` contains the basics that do the "work" of cloning the subrepos, checking out the commits and compiling the dependencies. These dependencies are compiled before any pmacct object is attempted to be compiled. Dependencies _shall_ be compiled and linked by pmacct daemons statically, as they are NOT distributed as part of pmacct binaries, just statically linked. Dependencies will only be attempted to be compiled if the git submodule commit hash changes, or it hasn't been built before. To do so, a "mark" file is created under $(builddir)/src/external_libs/. The dependency build system puts the results under $(builddir)/src/external_libs/rootfs, with the typical structure of: * bin/ * include/ * lib/ When compiled in-tree, this directory, and the compilation marks are git ignored. If pmacct is compiled from a tarball (no git repository), dependency building is skipped. There will be more refinement on this later on
- Loading branch information
Showing
6 changed files
with
72 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "src/external_libs/libcdada"] | ||
path = src/external_libs/libcdada | ||
url = https://github.com/msune/libcdada.git |
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
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,51 @@ | ||
#Build all submodule deps | ||
BUILT_SOURCES = submodule_deps | ||
CLEANFILES = .libcdada_mark | ||
|
||
#NOTE make sure Makefile targets don't have the same name of the folder | ||
|
||
## | ||
## LIBCDADA | ||
## | ||
_libcdada: | ||
@if [[ -z "$(shell git rev-parse HEAD 2> /dev/null)" ]]; then \ | ||
echo "[dep: libcdada] Skipping, not a git repository!"; \ | ||
exit 0;\ | ||
fi;\ | ||
echo "[dep: libcdada] Checking..."; \ | ||
if [[ ! -f "$(abs_srcdir)/libcdada/.git" ]]; then \ | ||
echo "[dep: libcdada] Cloning and checking out commit..";\ | ||
git submodule update --init --recursive libcdada; \ | ||
if [ $$? != 0 ]; then exit 1; fi;\ | ||
fi;\ | ||
if [[ ( ! -f $(abs_builddir)/.libcdada_mark ) || "$(shell cat $(abs_builddir)/.libcdada_mark 2> /dev/null)" != "$(shell cd $(abs_srcdir)/libcdada && git rev-parse HEAD)" ]]; then \ | ||
echo "[dep: libcdada] Building...";\ | ||
mkdir -p $(abs_builddir)/libcdada/build || true; \ | ||
cd $(abs_srcdir)/libcdada/ && \ | ||
./autogen.sh &&\ | ||
cd $(abs_builddir)/libcdada/build && \ | ||
$(abs_srcdir)/libcdada/configure --disable-shared \ | ||
--prefix=$(abs_builddir)/rootfs && make $(MAKE_JOBS) install;\ | ||
if [ $$? != 0 ]; then exit 1; fi; \ | ||
echo "$(shell cd $(abs_srcdir)/libcdada && git rev-parse HEAD)" > $(abs_builddir)/.libcdada_mark;\ | ||
if [ $$? != 0 ]; then exit 1; fi; \ | ||
echo "[dep: libcdada] Done!";\ | ||
else\ | ||
echo "[dep: libcdada] Up-to-date!";\ | ||
fi | ||
|
||
_libcdada_maintainer_clean: | ||
@rm -rf $(builddir)/libcdada/build/* | ||
|
||
submodule_prep: | ||
@mkdir -p $(builddir)/rootfs | ||
|
||
#List all of them here | ||
submodule_deps: submodule_prep _libcdada | ||
|
||
#Deep cleanup | ||
maintainer-clean-local: _libcdada_maintainer_clean | ||
rm -rf $(abs_builddir)/rootfs | ||
|
||
#Placed abnormally here, just because vim syntax highlighter has a bug | ||
MAKE_JOBS := $(shell ps T | sed -n 's/.*$(MAKE_PID).*$(MAKE).* \(-j\|--jobs=\) *\([0-9][0-9]*\).*/-j \2/p') |