From 23d8465817e7bc0d188f36fc2ad14f41ff01c221 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 28 Oct 2009 19:13:56 +0100 Subject: refactor the buildsystem to extract library versions from one file, so it is not needed to change x-files to just increase a version number (because this is far to easy to forget one of the files, which will not result in failures or is bad in general, but is inconsitent.) --- apt-pkg/init.h | 6 +++++- apt-pkg/makefile | 10 +++++----- buildlib/libversion.mak | 14 ++++++++++++++ debian/rules | 3 +-- methods/makefile | 5 ++--- 5 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 buildlib/libversion.mak diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 44a57eb45..b3e4b147f 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -16,7 +16,11 @@ #include #include -// See the makefile +// These lines are extracted by the makefiles and the buildsystem +// Increasing MAJOR or MINOR results in the need of recompiling all +// reverse-dependencies of libapt-pkg against the new SONAME. +// Non-ABI-Breaks should only increase RELEASE number. +// See also buildlib/libversion.mak #define APT_PKG_MAJOR 4 #define APT_PKG_MINOR 9 #define APT_PKG_RELEASE 0 diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 80038e28e..f71367ace 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -9,13 +9,13 @@ HEADER_TARGETDIRS = apt-pkg # Bring in the default rules include ../buildlib/defaults.mak -# The library name, don't forget to update init.h and the copy in -# methods/makefile - FIXME +# The library name and version (indirectly used from init.h) +include ../buildlib/libversion.mak LIBRARY=apt-pkg -MAJOR=4.9 -MINOR=0 +MAJOR=$(LIBAPTPKG_MAJOR) +MINOR=$(LIBAPTPKG_RELEASE) SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl -APT_DOMAIN:=libapt-pkg$(MAJOR) +APT_DOMAIN:=libapt-pkg$(LIBAPTPKG_MAJOR) # Source code for the contributed non-core things SOURCE = contrib/mmap.cc contrib/error.cc contrib/strutl.cc \ diff --git a/buildlib/libversion.mak b/buildlib/libversion.mak new file mode 100644 index 000000000..796c956e7 --- /dev/null +++ b/buildlib/libversion.mak @@ -0,0 +1,14 @@ +# -*- make -*- +# Version number of libapt-pkg. +# Please increase MAJOR with each ABI break, +# with each non-ABI break to the lib, please increase RELEASE. +# The versionnumber is extracted from apt-pkg/init.h - see also there. +LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/init.h | sed 's/\.$$//') +LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/init.h | cut -d ' ' -f 3) + +# Version number of libapt-inst +# Please increase MAJOR with each ABI break, +# with each non-ABI break to the lib, please increase MINOR. +# The versionnumber is extracted from apt-inst/makefile - see also there. +LIBAPTINST_MAJOR=$(shell egrep '^MAJOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2) +LIBAPTINST_MINOR=$(shell egrep '^MINOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2) diff --git a/debian/rules b/debian/rules index d1b77e172..f69c0cffb 100755 --- a/debian/rules +++ b/debian/rules @@ -75,8 +75,7 @@ APT_UTILS=ftparchive sortpkgs extracttemplates #export DH_VERBOSE=1 # Find the libapt-pkg major version for use in other control files -export LIBAPTPKG_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2) -export LIBAPTINST_MAJOR:=$(shell egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2) +include buildlib/libversion.mak # Determine which package we should provide in the control files LIBAPTPKG_PROVIDE=libapt-pkg-$(LIBAPTPKG_MAJOR) diff --git a/methods/makefile b/methods/makefile index f5d80d839..7bcae6b9b 100644 --- a/methods/makefile +++ b/methods/makefile @@ -6,9 +6,8 @@ SUBDIR=methods include ../buildlib/defaults.mak BIN := $(BIN)/methods -# FIXME.. -LIB_APT_PKG_MAJOR = 4.9 -APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) +include ../buildlib/libversion.mak +APT_DOMAIN := libapt-pkg$(LIBAPTPKG_MAJOR) # The file method PROGRAM=file -- cgit v1.2.3