Commit c708b1b6 authored by Jim Nelson's avatar Jim Nelson

#2705: Maximum Vala compiler version now checked during build.

parent 61f1440c
......@@ -4,10 +4,12 @@ VERSION = 0.8.1+trunk
GETTEXT_PACKAGE = $(PROGRAM)
BUILD_ROOT = 1
VALAC = valac
MIN_VALAC_VERSION = 0.9.8
INSTALL_PROGRAM = install
INSTALL_DATA = install -m 644
VALAC := valac
VALAC_VERSION := `$(VALAC) --version | awk '{print $$2}'`
MIN_VALAC_VERSION := 0.9.8
MAX_VALAC_VERSION := 0.11.0
INSTALL_PROGRAM := install
INSTALL_DATA := install -m 644
# defaults that may be overridden by configure.mk
PREFIX=/usr/local
......@@ -354,7 +356,7 @@ VALA_STAMP := $(BUILD_DIR)/.stamp
LANG_STAMP := $(LOCAL_LANG_DIR)/.langstamp
MAKE_FILES := Makefile $(CONFIG_IN) $(UNIT_MKS) unitize.mk units.mk
DIST_FILES = Makefile configure minver $(EXPANDED_SRC_FILES) $(EXPANDED_VAPI_FILES) \
DIST_FILES = Makefile configure chkver $(EXPANDED_SRC_FILES) $(EXPANDED_VAPI_FILES) \
$(EXPANDED_SRC_HEADER_FILES) $(EXPANDED_RESOURCE_FILES) $(TEXT_FILES) $(EXPANDED_ICON_FILES) \
$(EXPANDED_SYS_INTEGRATION_FILES) $(EXPANDED_PO_FILES) po/shotwell.pot libraw-config \
$(EXPANDED_HELP_FILES) $(EXPANDED_HELP_IMAGES) apport/shotwell.py $(UNIT_RESOURCES) $(UNIT_MKS) \
......@@ -389,6 +391,12 @@ CFLAGS += -DG_UDEV_API_IS_SUBJECT_TO_CHANGE
# if not available.
LIBRAW_CONFIG=./libraw-config
define check_valac_version
@ ./chkver min $(VALAC_VERSION) $(MIN_VALAC_VERSION) || ( echo 'Shotwell requires Vala compiler $(MIN_VALAC_VERSION) or greater. You are running' $(VALAC_VERSION) '\b.'; exit 1 )
$(if $(MAX_VALAC_VERSION),\
@ ./chkver max $(VALAC_VERSION) $(MAX_VALAC_VERSION) || ( echo 'Shotwell cannot be built by Vala compiler $(MAX_VALAC_VERSION) or greater. You are running' $(VALAC_VERSION) '\b.'; exit 1 ),)
endef
ifdef ENABLE_BUILD_FOR_GLADE
all: $(PLUGINS_DIR) lib$(PROGRAM).so $(PROGRAM)
else
......@@ -546,7 +554,7 @@ $(UNITIZE_INITS) $(UNITIZE_ENTRIES): $(UNITIZE_STAMP)
# EXPANDED_SRC_FILES includes UNITIZE_INITS and UNITIZE_ENTRY
$(VALA_STAMP): $(EXPANDED_SRC_FILES) $(EXPANDED_VAPI_FILES) $(EXPANDED_SRC_HEADER_FILES)
@ ./minver `$(VALAC) --version | awk '{print $$2}'` $(MIN_VALAC_VERSION) || ( echo 'Shotwell requires Vala compiler $(MIN_VALAC_VERSION) or greater. You are running' `$(VALAC) --version` '\b.'; exit 1 )
$(call check_valac_version)
ifndef ASSUME_PKGS
ifdef EXT_PKG_VERSIONS
@pkg-config --print-errors --exists '$(EXT_PKG_VERSIONS) $(DIRECT_LIBS_VERSIONS)'
......@@ -582,6 +590,7 @@ $(PLUGINS_SO): $(PLUGINS_DIR)
.PHONY: $(PLUGINS_DIR)
$(PLUGINS_DIR): $(PLUGIN_VAPIS) $(PLUGIN_HEADERS) $(PLUGIN_DEPS)
$(call check_valac_version)
@$(MAKE) --directory=$@ PLUGINS_VERSION="$(VERSION)"
glade: lib$(PROGRAM).so
......
......@@ -4,17 +4,19 @@
#
# This software is licensed under the GNU LGPL (version 2.1 or later).
# See the COPYING file in this distribution.
# minver <major.minor.revision> <minimum major.minor.revision>
#
# Returns 0 if queried version is greater than or equal to second, 1 otherwise.
# chkver <min | max> <major.minor.revision> <min|max major.minor.revision>
#
# Returns 0 if queried version is greater than or equal (for min) or lesser than (for max) the
# supplied value, or 1 otherwise.
#
# Set VERBOSE environment variable for somewhat useful output.
#
# NOTE:
# This is an ultra-naive implementation with just enough error-checking.
usage() {
echo 'usage: minver <major.minor.revision> <minimum major.minor.revision>'
echo 'usage: chkver <min | max> <major.minor.revision> <min|max major.minor.revision>'
}
abort() {
......@@ -36,15 +38,28 @@ verify_cardinal() {
done
}
# check_range name number min-number
check_range() {
# check_min name number min-number
check_min() {
if [ $2 -gt $3 ]
then
verbose $1 large enough.
exit 0
elif [ $2 -lt $3 ]
then
verbose $1 not large enough
verbose $1 not large enough.
exit 1
fi
}
# check_max name number max-number
check_max() {
if [ $2 -lt $3 ]
then
verbose $1 small enough.
exit 0
elif [ $2 -gt $3 ]
then
verbose $1 not small enough.
exit 1
fi
}
......@@ -57,30 +72,48 @@ verbose() {
}
# Check number of arguments
if [ $# -lt 2 ]
if [ $# -lt 3 ]
then
abort
fi
# Parse arguments into integers
major=`echo $1 | awk -F. '{print $1}'`
minor=`echo $1 | awk -F. '{print $2}'`
revision=`echo $1 | awk -F. '{print $3}'`
# Parse arguments
mode=$1
if [ $mode != "min" ] && [ $mode != "max" ]
then
abort
fi
min_major=`echo $2 | awk -F. '{print $1}'`
min_minor=`echo $2 | awk -F. '{print $2}'`
min_revision=`echo $2 | awk -F. '{print $3}'`
major=`echo $2 | awk -F. '{print $1}'`
minor=`echo $2 | awk -F. '{print $2}'`
revision=`echo $2 | awk -F. '{print $3}'`
min_major=`echo $3 | awk -F. '{print $1}'`
min_minor=`echo $3 | awk -F. '{print $2}'`
min_revision=`echo $3 | awk -F. '{print $3}'`
# Verify they're all positive integers
verify_cardinal "$major" "$minor" "$revision" "$min_major" "$min_minor" "$min_revision"
verbose Comparing $major.$minor.$revision against $min_major.$min_minor.$min_revision
verbose Comparing $major.$minor.$revision against $mode $min_major.$min_minor.$min_revision
# check version numbers in order of importance
check_range "Major" $major $min_major
check_range "Minor" $minor $min_minor
check_range "Revision" $revision $min_revision
if [ $mode == "min" ]
then
check_min "Major" $major $min_major
check_min "Minor" $minor $min_minor
check_min "Revision" $revision $min_revision
else
check_max "Major" $major $min_major
check_max "Minor" $minor $min_minor
check_max "Revision" $revision $min_revision
fi
verbose Same version.
exit 0
if [ $mode == "min" ]
then
exit 0
else
exit 1
fi
......@@ -9,14 +9,16 @@ PLUGIN_DEPS := $(PLUGIN_VAPIS:.vapi=.deps)
$(PLUGIN_HEADERS): %.h: %.vapi
plugins/shotwell-spit-1.0.deps: plugins/shotwell-spit-1.0.vapi
echo "" > $@
@echo "" > $@
plugins/shotwell-spit-1.0.vapi: src/plugins/SpitInterfaces.vala
$(call check_valac_version)
$(VALAC) -c $(VALAFLAGS) -X -I. --includedir=plugins --vapi=$@ --header=$(basename $@).h $<
plugins/shotwell-transitions-1.0.deps: plugins/shotwell-transitions-1.0.vapi
printf "gdk-2.0\nshotwell-spit-1.0\n" > $@
@printf "gdk-2.0\nshotwell-spit-1.0\n" > $@
plugins/shotwell-transitions-1.0.vapi: src/plugins/TransitionsInterfaces.vala plugins/shotwell-spit-1.0.vapi
$(call check_valac_version)
$(VALAC) -c $(VALAFLAGS) -X -I. --pkg=gdk-2.0 --pkg=shotwell-spit-1.0 --includedir=plugins --vapi=$@ --header=$(basename $@).h $<
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment