refactor the buildsystem to extract library versions from one file,
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 28 Oct 2009 18:13:56 +0000 (19:13 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 28 Oct 2009 18:13:56 +0000 (19:13 +0100)
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
apt-pkg/makefile
buildlib/libversion.mak [new file with mode: 0644]
debian/rules
methods/makefile

index 44a57eb..b3e4b14 100644 (file)
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/pkgsystem.h>
 
-// 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
index 80038e2..f71367a 100644 (file)
@@ -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 (file)
index 0000000..796c956
--- /dev/null
@@ -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)
index d1b77e1..f69c0cf 100755 (executable)
@@ -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)
index f5d80d8..7bcae6b 100644 (file)
@@ -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