From 0c0c3b8903814b572978888e596a2c3386799de4 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 26 Oct 2013 19:02:55 +0200 Subject: [PATCH] Redo version checks and add check for GTK Signed-off-by: Sebastian Ramacher --- .gitignore | 2 +- Makefile | 20 ++++++++++++-------- README | 2 +- config.mk | 17 ++++++++++++++--- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index f357c42..851795d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ doc/ *.tmp zathura.1 zathurarc.5 -girara-version-check +.version-checks/ diff --git a/Makefile b/Makefile index 1769ff5..e1f4a54 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,15 @@ DOBJECTS = $(patsubst %.c, %.do, $(SOURCE)) all: options ${PROJECT} po build-manpages -girara-version-check: -ifneq ($(GIRARA_VERSION_CHECK), 0) - $(error "The minimum required version of girara is ${GIRARA_MIN_VERSION}") -endif - $(QUIET)touch girara-version-check +# pkg-config based version checks +.version-checks/%: + $(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \ + pkg-config --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \ + echo "The minium required version of $(*) is $($(*)_MIN_VERSION)" && \ + false \ + ) + @mkdir -p .version-checks + $(QUIET)touch $@ options: @echo ${PROJECT} build options: @@ -72,8 +76,8 @@ version.h: version.h.in config.mk @mkdir -p .depend $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep -${OBJECTS}: config.mk version.h girara-version-check -${DOBJECTS}: config.mk version.h girara-version-check +${OBJECTS} ${DOBJECTS}: config.mk version.h \ + .version-checks/GIRARA .version-checks/GLIB .version-checks/GTK ${PROJECT}: ${OBJECTS} $(ECHO) CC -o $@ @@ -83,7 +87,7 @@ clean: $(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \ ${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \ *gcda *gcno $(PROJECT).info gcov *.tmp \ - girara-version-check + .version-checks ifneq "$(wildcard ${RSTTOMAN})" "" $(QUIET)rm -f zathura.1 zathurarc.5 endif diff --git a/README b/README index d057887..1ce70ff 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ girara user interface library and several document libraries. Requirements ------------ -gtk2 (>= 2.28) +gtk2 (>= 2.18) glib (>= 2.28) girara sqlite3 (optional, >= 3.5.9) diff --git a/config.mk b/config.mk index 6c1cb8d..d7c255b 100644 --- a/config.mk +++ b/config.mk @@ -14,10 +14,21 @@ VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_RE # note: zathura with GTK+ 3 is broken! ZATHURA_GTK_VERSION ?= 2 -# minimum required zathura version -# If you want to disable the check, set GIRARA_VERSION_CHECK to 0. +# version checks +# If you want to disable any of the checks, set *_VERSION_CHECK to 0. + +# girara +GIRARA_VERSION_CHECK ?= 1 GIRARA_MIN_VERSION = 0.1.6 -GIRARA_VERSION_CHECK ?= $(shell pkg-config --atleast-version=$(GIRARA_MIN_VERSION) girara-gtk${ZATHURA_GTK_VERSION}; echo $$?) +GIRARA_PKG_CONFIG_NAME = girara-gtk$(ZATHURA_GTK_VERSION) +# glib +GLIB_VERSION_CHECK ?= 1 +GLIB_MIN_VERSION = 2.28 +GLIB_PKG_CONFIG_NAME = glib-2.0 +# GTK +GTK_VERSION_CHECK ?= 1 +GTK_MIN_VERSION = 2.18 +GTK_PKG_CONFIG_NAME = gtk+-$(ZATHURA_GTK_VERSION).0 # database # To disable support for the sqlite backend set WITH_SQLITE to 0.