Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions dist/tools/has_minimal_version/has_minimal_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/bash
#
# usage: has_minimal_version.sh <version> <minimal_version> [toolname]
# Checks that version >= minimal_version
# Version format MAJOR.MINOR.PATCH ex 3.1.4

# Adapted from https://stackoverflow.com/a/24067243 to have >=
# Checking versions with '-rcX' does not work properly due to the usage of
# `sort -V`.

if [ $# -lt 2 ]; then
echo "usage: ${0} <version> <minimal_version> [toolname]" >&2
echo " Checks that version >= minimal_version" >&2
echo " Version format MAJOR.MINOR.PATCH ex 3.1.4" >&2
exit 1
fi

readonly TOOLVERSION="${1}"
readonly MINVERSION="${2}"
readonly TOOLNAME="${3}"

if [ "${TOOLNAME}" != "" ]; then
readonly TOOLSTR="${TOOLNAME} "
else
readonly TOOLSTR=""
fi


HIGHEST=$(printf "%s\n%s\n" "${TOOLVERSION}" "${MINVERSION}" | sort -rV | head -n 1)
test "${HIGHEST}" = "${TOOLVERSION}" && exit 0

printf "\nInvalid version, found %s%s, minimal required is %s\n\n" "${TOOLSTR}" "${TOOLVERSION}" "${MINVERSION}" >&2
exit 1
15 changes: 13 additions & 2 deletions pkg/ccn-lite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ PKG_URL=https://github.com/cn-uofbasel/ccn-lite/
PKG_VERSION=f85a2a055db92b5978f2d4f92b830b5b6b9acb42
PKG_LICENSE=ISC

.PHONY: all
.PHONY: all ..cmake_version_supported

CMAKE_MINIMAL_VERSION = 3.6.0


RIOT_CFLAGS = $(INCLUDES)

Expand All @@ -17,10 +20,18 @@ $(PKG_BUILDDIR)/src/Makefile: $(TOOLCHAIN_FILE)
cd $(PKG_BUILDDIR)/src && \
cmake -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCCNL_RIOT=1 -DRIOT_CFLAGS="$(RIOT_CFLAGS)" -DBUILD_TESTING=OFF .

$(TOOLCHAIN_FILE): git-download
$(RIOTTOOLS)/cmake/generate-xcompile-toolchain.sh > $(TOOLCHAIN_FILE)

git-download: | ..cmake_version_supported

..cmake_version_supported:
@ # Remove '-rcX' from version as they are not well handled
$(Q)\
CMAKE_VERSION=$$(cmake --version | sed -n '1 {s/cmake version //;s/-rc.*//;p;}'); \
$(RIOTTOOLS)/has_minimal_version/has_minimal_version.sh "$${CMAKE_VERSION}" "$(CMAKE_MINIMAL_VERSION)" cmake


include $(RIOTBASE)/pkg/pkg.mk
ifneq (,$(filter -Wformat-nonliteral -Wformat=2, $(CFLAGS)))
CFLAGS += -Wno-format-nonliteral
Expand Down
13 changes: 12 additions & 1 deletion pkg/relic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ PKG_URL=https://github.com/relic-toolkit/relic.git
PKG_VERSION=0b0442a8218df8d309266923f2dd5b9ae3b318ce
PKG_LICENSE=LGPL-2.1

.PHONY: all
.PHONY: all ..cmake_version_supported

CMAKE_MINIMAL_VERSION = 3.6.0


CFLAGS += -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-function -Wno-newline-eof

Expand All @@ -22,6 +25,14 @@ $(PKG_BUILDDIR)/Makefile: $(TOOLCHAIN_FILE)
$(TOOLCHAIN_FILE): git-download
$(RIOTTOOLS)/cmake/generate-xcompile-toolchain.sh > $(TOOLCHAIN_FILE)

git-download: | ..cmake_version_supported

..cmake_version_supported:
@ # Remove '-rcX' from version as they are not well handled
$(Q)\
CMAKE_VERSION=$$(cmake --version | sed -n '1 {s/cmake version //;s/-rc.*//;p;}'); \
$(RIOTTOOLS)/has_minimal_version/has_minimal_version.sh "$${CMAKE_VERSION}" "$(CMAKE_MINIMAL_VERSION)" cmake

clean::
@rm -rf $(BINDIR)/$(PKG_NAME).a

Expand Down