Skip to content

Commit fffc988

Browse files
committed
Allow the use of a valac with a different name
This is useful e.g. for testing git master installed with --disable-unversioned. The two changes made are to have VALAC set only if not already set in Makefile, and to use the environment setting of VALAC in valadoc-example-tester.
1 parent 19ff271 commit fffc988

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
VALAC = valac
1+
VALAC ?= valac
22
PACKAGES ?= --all
33
GENERATOR_OPTS ?= --disable-devhelp --skip-existing
4-
VALAC_VERSION := $(shell vala --api-version | awk -F. '{ print "0."$$2 }')
4+
VALAC_VERSION := $(shell $(VALAC) --api-version | awk -F. '{ print "0."$$2 }')
55
VAPIDIR := $(shell pkg-config --variable vapidir libvala-$(VALAC_VERSION))
66
VALAFLAGS = -g -X -w
77
PREFIX = "stable"

src/generator.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class Valadoc.IndexGenerator : Valadoc.ValadocOrgDoclet {
5858

5959
// Unversioned vapi directory:
6060
try {
61-
Process.spawn_command_line_sync ("pkg-config --variable=vapidir vapigen", out standard_output, out standard_error, out exit_status);
61+
Process.spawn_command_line_sync ("pkg-config --variable=vapidir vapigen-%s".printf (Vala.API_VERSION), out standard_output, out standard_error, out exit_status);
6262
if (exit_status == 0) {
6363
paths += standard_output.strip ();
6464
}

src/valadoc-example-tester.vala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public class ExampleTester : ExampleParser {
6060
protected override void compile (string str) throws MarkupError {
6161
string cmnd = str.strip ();
6262

63-
bool is_valac_call = str.has_prefix ("valac ");
63+
const string VALAC_PREFIX = "valac ";
64+
bool is_valac_call = str.has_prefix (VALAC_PREFIX);
6465
bool is_schema_call = str.has_prefix ("glib-compile-schemas");
6566

6667
// We only check for sanity, not for safety
@@ -70,6 +71,8 @@ public class ExampleTester : ExampleParser {
7071
}
7172

7273
if (is_valac_call) {
74+
cmnd = Environment.get_variable ("VALAC") + " " +
75+
cmnd.substring (VALAC_PREFIX.length);
7376
cmnd += " --fatal-warnings";
7477
if (example_deprecated == true) {
7578
cmnd += " --enable-deprecated";

0 commit comments

Comments
 (0)