From 574811d270de165808961c5e7f0b44638e03475b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 25 Nov 2012 19:43:09 +0100 Subject: [PATCH] CMake: Check for the needed lgi dependency We only need lgi for running, not for building. This means that our lgi dependency is easily missed. This commit makes this dependency more explicit. Signed-off-by: Uli Schlachter --- CMakeLists.txt | 4 ++++ build-utils/lgi-check.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 build-utils/lgi-check.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d0d3911..4514336a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,10 @@ target_link_libraries(${PROJECT_AWE_NAME} ${AWESOME_REQUIRED_LDFLAGS} ${AWESOME_OPTIONAL_LDFLAGS}) +# check for lgi and the needed gobject introspection files +add_custom_target(lgi-check ALL + COMMAND ${SOURCE_DIR}/build-utils/lgi-check.sh) + # atoms file(MAKE_DIRECTORY ${BUILD_DIR}/common) add_custom_command( diff --git a/build-utils/lgi-check.sh b/build-utils/lgi-check.sh new file mode 100755 index 00000000..340eea92 --- /dev/null +++ b/build-utils/lgi-check.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +die() +{ + exec >&2 + echo + echo + echo " WARNING" + echo " =======" + echo + echo " The lgi check failed." + echo " The Lua GObject introspection package is just a runtime dependency, so it is not" + echo " necessary for building awesome. However, awesome needs it to run." + echo " Add AWESOME_IGNORE_LGI=1 to your environment to continue." + echo + echo + if [ "x$AWESOME_IGNORE_LGI" = "x1" ] + then + exit 0 + fi + exit 1 +} + +# Check if we have lgi +lua -e 'require("lgi")' || die + +# Check the version number +lua -e 'if tonumber(string.match(require("lgi.version"), "(%d%.%d)")) <= 0.5 then error("lgi too old, need at least version 0.6.1") end' || die + +# Check for the needed gi files +lua -e 'l = require("lgi") assert(l.cairo, l.Pango, l.PangoCairo)' || die