Skip to content

Fix use of VALAC so that it is respected everywhere #314

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VALAC = valac
VALAC ?= valac
PACKAGES ?= --all
GENERATOR_OPTS ?= --disable-devhelp --skip-existing
VALAC_VERSION := $(shell vala --api-version | awk -F. '{ print "0."$$2 }')
VAPIDIR := $(shell pkg-config --variable vapidir libvala-$(VALAC_VERSION))
VALAFLAGS = -g -X -w
VALAC_VERSION := $(shell $(VALAC) --api-version | awk -F. '{ print "0."$$2 }')
VAPIDIRS := --vapidir $(shell pkg-config --variable vapidir libvala-$(VALAC_VERSION)) --vapidir $(shell pkg-config --variable vapidir valadoc-$(VALAC_VERSION))
VALAFLAGS = -g -X -w $(VAPIDIRS)
PREFIX = "stable"
INSTALL_DIR ?= /usr/local/share/devhelp/books

Expand Down Expand Up @@ -107,7 +107,6 @@ build-data:
build-docs: default
$(RM) -r tmp/
./generator \
--vapidir $(VAPIDIR) \
--vapidir "extra-vapis/" --vapidir "girs/vala/vapi/" \
--prefix $(PREFIX) \
--target-glib 2.98 \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ sudo make install
to install the devhelp books in your system. Now launch Devhelp and use them!


Using a different version of Vala
=================================

You may want or need to test Valadoc with a different version of Vala, for example to pick up fixes in Vala that are necessary to build example code. You can do this with a chroot or jhbuild; or if your valac’s API version is different from other versions you have installed, just set `VALAC=valac-X.YY` in your environment when running `make`.


Searching
=========

Expand Down
6 changes: 3 additions & 3 deletions src/generator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class Valadoc.IndexGenerator : Valadoc.ValadocOrgDoclet {

// Unversioned vapi directory:
try {
Process.spawn_command_line_sync ("pkg-config --variable=vapidir vapigen", out standard_output, out standard_error, out exit_status);
Process.spawn_command_line_sync ("pkg-config --variable=vapidir vapigen-%s".printf (Vala.API_VERSION), out standard_output, out standard_error, out exit_status);
if (exit_status == 0) {
paths += standard_output.strip ();
}
Expand Down Expand Up @@ -828,8 +828,8 @@ public class Valadoc.IndexGenerator : Valadoc.ValadocOrgDoclet {


StringBuilder builder = new StringBuilder ();
builder.append_printf ("valadoc --target-glib %s --importdir girs --doclet \"%s\" -o \"tmp/%s\" \"%s\" --vapidir \"%s\" --girdir \"%s\" %s --use-svg-images",
target_glib, docletpath, pkg.name, pkg.get_vapi_path (vapidirs), Path.get_dirname (pkg.get_vapi_path (vapidirs)), girdir, pkg.flags);
builder.append_printf ("valadoc-%s --target-glib %s --importdir girs --doclet \"%s\" -o \"tmp/%s\" \"%s\" --vapidir \"%s\" --girdir \"%s\" %s --use-svg-images",
Vala.API_VERSION, target_glib, docletpath, pkg.name, pkg.get_vapi_path (vapidirs), Path.get_dirname (pkg.get_vapi_path (vapidirs)), girdir, pkg.flags);

if (disable_devhelp == true) {
builder.append (" -X --disable-devhelp");
Expand Down
5 changes: 4 additions & 1 deletion src/valadoc-example-tester.vala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public class ExampleTester : ExampleParser {
protected override void compile (string str) throws MarkupError {
string cmnd = str.strip ();

bool is_valac_call = str.has_prefix ("valac ");
const string VALAC_PREFIX = "valac ";
bool is_valac_call = str.has_prefix (VALAC_PREFIX);
bool is_schema_call = str.has_prefix ("glib-compile-schemas");

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

if (is_valac_call) {
cmnd = Environment.get_variable ("VALAC") + " " +
cmnd.substring (VALAC_PREFIX.length);
cmnd += " --fatal-warnings";
if (example_deprecated == true) {
cmnd += " --enable-deprecated";
Expand Down