[vala] Add version suffix to installed files to allow parallel installation



commit abbcceab2fc3b674d1bb5d056f249c11cd5079a4
Author: Jürg Billeter <j bitron ch>
Date:   Thu Aug 5 10:17:48 2010 +0200

    Add version suffix to installed files to allow parallel installation

 Makefile.am                                        |   11 +++++++++--
 ccode/Makefile.am                                  |    2 +-
 codegen/Makefile.am                                |   10 +++++-----
 compiler/Makefile.am                               |    8 ++++++--
 compiler/valacompiler.vala                         |    2 +-
 configure.ac                                       |   19 +++++++++++++++----
 doc/Makefile.am                                    |    8 ++++++++
 doc/vala/Makefile.am                               |    2 +-
 gee/Makefile.am                                    |    2 +-
 gobject-introspection/Makefile.am                  |    2 +-
 vala-1.0.pc.in => vala.pc.in                       |    6 +++---
 vala/Makefile.am                                   |    2 +-
 vala/valacodecontext.vala                          |   17 +++++++++++++----
 vapi/.gitignore                                    |    2 +-
 vapi/Makefile.am                                   |    4 ++--
 vapi/config.vapi                                   |    3 ++-
 vapigen/Makefile.am                                |   10 ++++++++--
 vapigen/vala-gen-introspect/Makefile.am            |    4 ++++
 vapigen/vala-gen-introspect/vala-gen-introspect.in |    2 +-
 19 files changed, 83 insertions(+), 33 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b59d5d1..0e0f9bf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,10 @@ DIST_SUBDIRS = \
 	$(NULL)
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = vala-1.0.pc
+pkgconfig_DATA = vala PACKAGE_SUFFIX@.pc
+
+vala PACKAGE_SUFFIX@.pc: vala.pc
+	cp $< $@
 
 .PHONY: bootstrap
 bootstrap: all
@@ -89,11 +92,15 @@ gen-ChangeLog:
 	  mv $(distdir)/cl-t $(distdir)/ChangeLog;			\
 	fi
 
+CLEANFILES = \
+	vala PACKAGE_SUFFIX@.pc
+	$(NULL)
+
 EXTRA_DIST = \
 	ChangeLog.pre-0-4 \
 	ChangeLog.pre-0-5-7 \
 	MAINTAINERS \
-	vala-1.0.pc.in \
+	vala.pc.in \
 	.version \
 	build-aux/git-version-gen \
 	build-aux/gitlog-to-changelog \
diff --git a/ccode/Makefile.am b/ccode/Makefile.am
index 486a5dd..1fd4a0d 100644
--- a/ccode/Makefile.am
+++ b/ccode/Makefile.am
@@ -70,7 +70,7 @@ libvalaccode_la_SOURCES = \
 	$(libvalaccode_la_VALASOURCES:.vala=.c) \
 	$(NULL)
 
-ccodeincludedir = $(includedir)/vala-1.0
+ccodeincludedir = $(includedir)/vala PACKAGE_SUFFIX@
 
 ccodeinclude_HEADERS = \
 	valaccode.h \
diff --git a/codegen/Makefile.am b/codegen/Makefile.am
index 49406d1..e9f661e 100644
--- a/codegen/Makefile.am
+++ b/codegen/Makefile.am
@@ -11,7 +11,7 @@ AM_CPPFLAGS = \
 BUILT_SOURCES = codegen.vala.stamp
 
 lib_LTLIBRARIES = \
-	libvala.la
+	libvala PACKAGE_SUFFIX@.la
 	$(NULL)
 
 libvala_la_VALASOURCES = \
@@ -62,12 +62,12 @@ libvala_la_VALASOURCES = \
 	valatyperegisterfunction.vala \
 	$(NULL)
 
-libvala_la_SOURCES = \
+libvala PACKAGE_SUFFIX@_la_SOURCES = \
 	codegen.vala.stamp \
 	$(libvala_la_VALASOURCES:.vala=.c) \
 	$(NULL)
 
-codegenincludedir = $(includedir)/vala-1.0
+codegenincludedir = $(includedir)/vala PACKAGE_SUFFIX@
 
 codegeninclude_HEADERS = \
 	valacodegen.h \
@@ -77,9 +77,9 @@ codegen.vapi codegen.vala.stamp: $(libvala_la_VALASOURCES)
 	$(VALA_V)$(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir $(srcdir)/../gee --pkg gee --vapidir $(srcdir)/../ccode --pkg ccode --vapidir $(srcdir)/../vala --pkg vala -H valacodegen.h --library codegen $^
 	@touch $@
 
-libvala_la_LDFLAGS = -no-undefined
+libvala PACKAGE_SUFFIX@_la_LDFLAGS = -no-undefined
 
-libvala_la_LIBADD = \
+libvala PACKAGE_SUFFIX@_la_LIBADD = \
 	$(COVERAGE_LIBS) \
 	$(GLIB_LIBS) \
 	../vala/libvalacore.la \
diff --git a/compiler/Makefile.am b/compiler/Makefile.am
index bbc9335..d6e7f81 100644
--- a/compiler/Makefile.am
+++ b/compiler/Makefile.am
@@ -32,13 +32,17 @@ valac.vala.stamp: $(valac_VALASOURCES)
 valac_LDADD = \
 	$(COVERAGE_LIBS) \
 	$(GLIB_LIBS) \
-	../codegen/libvala.la \
+	../codegen/libvala PACKAGE_SUFFIX@.la \
 	$(NULL)
 
 EXTRA_DIST = $(valac_VALASOURCES) valac.vala.stamp
 
 install-exec-hook:
-	cd $(DESTDIR)$(bindir) && $(LN_S) -f valac$(EXEEXT) vala$(EXEEXT)
+	cd $(DESTDIR)$(bindir) && $(LN_S) -f valac PACKAGE_SUFFIX@$(EXEEXT) vala PACKAGE_SUFFIX@$(EXEEXT)
+if ENABLE_UNVERSIONED
+	cd $(DESTDIR)$(bindir) && $(LN_S) -f valac PACKAGE_SUFFIX@$(EXEEXT) valac$(EXEEXT)
+	cd $(DESTDIR)$(bindir) && $(LN_S) -f vala PACKAGE_SUFFIX@$(EXEEXT) vala$(EXEEXT)
+endif
 
 MAINTAINERCLEANFILES = \
 	$(valac_VALASOURCES:.vala=.c) \
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 97cca88..0718f14 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -675,7 +675,7 @@ class Vala.Compiler {
 	}
 
 	static int main (string[] args) {
-		if (Path.get_basename (args[0]) == "vala") {
+		if (Path.get_basename (args[0]) == "vala" || Path.get_basename (args[0]) == "vala" + Config.PACKAGE_SUFFIX) {
 			return run_source (args);
 		}
 
diff --git a/configure.ac b/configure.ac
index 3522be5..6ebe279 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,6 +6,14 @@ AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([dist-bzip2])
 AM_MAINTAINER_MODE
 
+PACKAGE_SUFFIX=-0.10
+AC_SUBST(PACKAGE_SUFFIX)
+AC_DEFINE_UNQUOTED(PACKAGE_SUFFIX, "$PACKAGE_SUFFIX", [Define to the suffix of this package])
+
+program_transform_name="s,\$\$,${PACKAGE_SUFFIX},"
+
+AC_SUBST(pkgdatadir, [${datadir}/vala${PACKAGE_SUFFIX}])
+
 # Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -31,6 +39,9 @@ AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
 
+AC_ARG_ENABLE(unversioned, AS_HELP_STRING([--disable-unversioned], [Disable unversioned binaries]), enable_unversioned=$enableval, enable_unversioned=yes)
+AM_CONDITIONAL(ENABLE_UNVERSIONED, test x$enable_unversioned = xyes)
+
 AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [Enable coverage analysis]), enable_coverage=$enableval, enable_coverage=no)
 AM_CONDITIONAL(ENABLE_COVERAGE, test x$enable_coverage = xyes)
 
@@ -51,9 +62,9 @@ AC_ARG_ENABLE(vapigen, AS_HELP_STRING([--enable-vapigen], [Enable VAPI generator
 AM_CONDITIONAL(ENABLE_VAPIGEN, test x$enable_vapigen = xyes)
 
 if test "$enable_vapigen" = "yes"; then
-  vapigen_decl='vapigen=${bindir}/vapigen'
-  gen_introspect_decl='gen_introspect=${libdir}/vala/gen-introspect'
-  vala_gen_introspect_decl='vala_gen_introspect=${bindir}/vala-gen-introspect'
+  vapigen_decl="vapigen=\${bindir}/vapigen${PACKAGE_SUFFIX}"
+  gen_introspect_decl="gen_introspect=\${libdir}/vala${PACKAGE_SUFFIX}/gen-introspect${PACKAGE_SUFFIX}"
+  vala_gen_introspect_decl="vala_gen_introspect=\${bindir}/vala-gen-introspect${PACKAGE_SUFFIX}"
 else
   vapigen_decl=''
   gen_introspect_decl=''
@@ -86,7 +97,7 @@ AM_CONDITIONAL(HAVE_XSLTPROC, test "$XSLTPROC" != :)
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
 AC_CONFIG_FILES([Makefile
-           vala-1.0.pc
+           vala.pc
            gee/Makefile
            ccode/Makefile
            vala/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d81c58b..71d979f 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -22,3 +22,11 @@ EXTRA_DIST = \
 	vapigen.1 \
 	$(NULL)
 
+if ENABLE_UNVERSIONED
+install-data-hook:
+	cd $(DESTDIR)$(man1dir) && $(LN_S) -f valac PACKAGE_SUFFIX@.1 valac.1
+if ENABLE_VAPIGEN
+	cd $(DESTDIR)$(man1dir) && $(LN_S) -f vala-gen-introspect PACKAGE_SUFFIX@.1 vala-gen-introspect.1
+	cd $(DESTDIR)$(man1dir) && $(LN_S) -f vapigen PACKAGE_SUFFIX@.1 vapigen.1
+endif
+endif
diff --git a/doc/vala/Makefile.am b/doc/vala/Makefile.am
index c0a9a0b..9e359c9 100644
--- a/doc/vala/Makefile.am
+++ b/doc/vala/Makefile.am
@@ -1,6 +1,6 @@
 NULL =
 
-bookdir=$(datadir)/devhelp/books/vala
+bookdir=$(datadir)/devhelp/books/vala PACKAGE_SUFFIX@
 
 chapter_data = \
 	overview.html \
diff --git a/gee/Makefile.am b/gee/Makefile.am
index 82e7e36..15f3e9b 100644
--- a/gee/Makefile.am
+++ b/gee/Makefile.am
@@ -29,7 +29,7 @@ libgee_la_SOURCES = \
 	$(libgee_la_VALASOURCES:.vala=.c) \
 	$(NULL)
 
-geeincludedir = $(includedir)/vala-1.0
+geeincludedir = $(includedir)/vala PACKAGE_SUFFIX@
 
 geeinclude_HEADERS = \
 	valagee.h \
diff --git a/gobject-introspection/Makefile.am b/gobject-introspection/Makefile.am
index e109801..9b30e1f 100644
--- a/gobject-introspection/Makefile.am
+++ b/gobject-introspection/Makefile.am
@@ -25,7 +25,7 @@ libgidl_la_LIBADD = \
 	$(GMODULE_LIBS) \
 	$(NULL)
 
-pkglibexecdir = $(libdir)/vala
+pkglibexecdir = $(libdir)/vala PACKAGE_SUFFIX@
 pkglibexec_PROGRAMS = gen-introspect
 
 BUILT_SOURCES = scannerparser.h
diff --git a/vala-1.0.pc.in b/vala.pc.in
similarity index 70%
rename from vala-1.0.pc.in
rename to vala.pc.in
index 3d52031..4e96afa 100644
--- a/vala-1.0.pc.in
+++ b/vala.pc.in
@@ -5,7 +5,7 @@ bindir= bindir@
 includedir= includedir@
 datarootdir= datarootdir@
 datadir= datadir@
-vapidir= datadir@/vala/vapi
+vapidir= datadir@/vala PACKAGE_SUFFIX@/vapi
 
 @vapigen_decl@
 @gen_introspect_decl@
@@ -15,5 +15,5 @@ Name: Vala
 Description: The Vala compiler library
 Version: @VERSION@
 Requires: glib-2.0 gobject-2.0
-Libs: -L${libdir} -lvala
-Cflags: -I${includedir}/vala-1.0
+Libs: -L${libdir} -lvala PACKAGE_SUFFIX@
+Cflags: -I${includedir}/vala PACKAGE_SUFFIX@
diff --git a/vala/Makefile.am b/vala/Makefile.am
index 7148e44..83acbd5 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -167,7 +167,7 @@ libvalacore_la_SOURCES = \
 	$(libvalacore_la_VALASOURCES:.vala=.c) \
 	$(NULL)
 
-valaincludedir = $(includedir)/vala-1.0
+valaincludedir = $(includedir)/vala PACKAGE_SUFFIX@
 
 valainclude_HEADERS = \
 	vala.h \
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index cd32378..476142c 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -315,7 +315,7 @@ public class Vala.CodeContext {
 	}
 
 	public string? get_package_path (string pkg, string[] directories) {
-		var path = get_file_path (pkg + ".vapi", "vala/vapi", directories);
+		var path = get_file_path (pkg + ".vapi", "vala" + Config.PACKAGE_SUFFIX + "/vapi", "vala/vapi", directories);
 
 		if (path == null) {
 			/* last chance: try the package compiled-in vapi dir */
@@ -329,10 +329,10 @@ public class Vala.CodeContext {
 	}
 
 	public string? get_gir_path (string gir, string[] directories) {
-		return get_file_path (gir + ".gir", "gir-1.0", directories);
+		return get_file_path (gir + ".gir", "gir-1.0", null, directories);
 	}
 
-	string? get_file_path (string basename, string data_dir, string[] directories) {
+	string? get_file_path (string basename, string versioned_data_dir, string? data_dir, string[] directories) {
 		string filename = null;
 
 		if (directories != null) {
@@ -345,12 +345,21 @@ public class Vala.CodeContext {
 		}
 
 		foreach (string dir in Environment.get_system_data_dirs ()) {
-			filename = Path.build_filename (dir, data_dir, basename);
+			filename = Path.build_filename (dir, versioned_data_dir, basename);
 			if (FileUtils.test (filename, FileTest.EXISTS)) {
 				return filename;
 			}
 		}
 
+		if (data_dir != null) {
+			foreach (string dir in Environment.get_system_data_dirs ()) {
+				filename = Path.build_filename (dir, data_dir, basename);
+				if (FileUtils.test (filename, FileTest.EXISTS)) {
+					return filename;
+				}
+			}
+		}
+
 		return null;
 	}
 }
diff --git a/vapi/.gitignore b/vapi/.gitignore
index 0785bd7..9fa8bca 100644
--- a/vapi/.gitignore
+++ b/vapi/.gitignore
@@ -1 +1 @@
-vala-1.0.vapi
+vala-*.vapi
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index 83db45d..373f5d9 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -2,7 +2,7 @@ NULL =
 
 vapidir = $(pkgdatadir)/vapi
 
-vala-1.0.vapi: ../gee/gee.vapi ../ccode/ccode.vapi ../vala/vala.vapi ../codegen/codegen.vapi
+vala PACKAGE_SUFFIX@.vapi: ../gee/gee.vapi ../ccode/ccode.vapi ../vala/vala.vapi ../codegen/codegen.vapi
 	cat $^ > $@
 
 dist_vapi_DATA = \
@@ -205,7 +205,7 @@ dist_vapi_DATA = \
 	unique-1.0.deps \
 	unique-1.0.vapi \
 	v4l2.vapi \
-	vala-1.0.vapi \
+	vala PACKAGE_SUFFIX@.vapi \
 	vte.deps \
 	vte.vapi \
 	webkit-1.0.deps \
diff --git a/vapi/config.vapi b/vapi/config.vapi
index 8e14bf0..2c6df9e 100644
--- a/vapi/config.vapi
+++ b/vapi/config.vapi
@@ -1,6 +1,6 @@
 /* config.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,4 +25,5 @@ namespace Config {
 	[CCode (cheader_filename = "version.h")]
 	public const string BUILD_VERSION;
 	public const string PACKAGE_DATADIR;
+	public const string PACKAGE_SUFFIX;
 }
diff --git a/vapigen/Makefile.am b/vapigen/Makefile.am
index dad0d5d..2f08351 100644
--- a/vapigen/Makefile.am
+++ b/vapigen/Makefile.am
@@ -50,18 +50,24 @@ vapicheck.vala.stamp: $(vapicheck_VALASOURCES)
 
 vapigen_LDADD = \
 	$(GLIB_LIBS) \
-	../codegen/libvala.la \
+	../codegen/libvala PACKAGE_SUFFIX@.la \
 	../gobject-introspection/libgidl.la \
 	$(NULL)
 
 vapicheck_LDADD = \
 	$(GLIB_LIBS) \
-	../codegen/libvala.la \
+	../codegen/libvala PACKAGE_SUFFIX@.la \
 	../gobject-introspection/libgidl.la \
 	$(NULL)
 
 EXTRA_DIST = $(vapigen_VALASOURCES) $(vapicheck_VALASOURCES) vapigen.vala.stamp vapicheck.vala.stamp
 
+if ENABLE_UNVERSIONED
+install-exec-hook:
+	cd $(DESTDIR)$(bindir) && $(LN_S) -f vapigen PACKAGE_SUFFIX@$(EXEEXT) vapigen$(EXEEXT)
+	cd $(DESTDIR)$(bindir) && $(LN_S) -f vapicheck PACKAGE_SUFFIX@$(EXEEXT) vapicheck$(EXEEXT)
+endif
+
 MAINTAINERCLEANFILES = \
 	$(vapigen_VALASOURCES:.vala=.c) \
 	$(vapicheck_VALASOURCES:.vala=.c) \
diff --git a/vapigen/vala-gen-introspect/Makefile.am b/vapigen/vala-gen-introspect/Makefile.am
index 91dea99..4f0c471 100644
--- a/vapigen/vala-gen-introspect/Makefile.am
+++ b/vapigen/vala-gen-introspect/Makefile.am
@@ -8,3 +8,7 @@ EXTRA_DIST = \
 	vala-gen-introspect.in
 	$(NULL)
 
+if ENABLE_UNVERSIONED
+install-exec-hook:
+	cd $(DESTDIR)$(bindir) && $(LN_S) -f vala-gen-introspect PACKAGE_SUFFIX@$(EXEEXT) vala-gen-introspect$(EXEEXT)
+endif
diff --git a/vapigen/vala-gen-introspect/vala-gen-introspect.in b/vapigen/vala-gen-introspect/vala-gen-introspect.in
index 538f43d..5a93986 100755
--- a/vapigen/vala-gen-introspect/vala-gen-introspect.in
+++ b/vapigen/vala-gen-introspect/vala-gen-introspect.in
@@ -3,7 +3,7 @@
 prefix= prefix@
 exec_prefix= exec_prefix@
 libdir= libdir@
-pkglibdir=${libdir}/vala
+pkglibdir=${libdir}/vala PACKAGE_SUFFIX@
 
 if [ $# -ne 2 ]
 then



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]