Merge pull request #154239 from bobby285271/vala

Vala updates 2022-01-09
This commit is contained in:
Jan Tojnar 2022-01-17 18:46:07 +01:00 committed by GitHub
commit 0b3e6e3783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 242 deletions

@ -1,4 +1,5 @@
{ lib, stdenv
{ lib
, stdenv
, fetchFromGitHub
, nix-update-script
, meson
@ -14,7 +15,6 @@
, libsoup
, libgee
, wrapGAppsHook
, vala_0_40
}:
stdenv.mkDerivation rec {
@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
meson
ninja
vala_0_40
vala
pkg-config
python3
wrapGAppsHook
@ -65,5 +65,12 @@ stdenv.mkDerivation rec {
platforms = platforms.linux;
license = licenses.gpl3;
mainProgram = "com.github.jeremyvaartjes.ping";
# Does not build with vala 0.48 or later
# ../src/Application.vala:696.46-696.57: error: Assignment: Cannot convert from
# `GLib.HashTable<weak string,weak string>' to `GLib.HashTable<string,string>?'
# HashTable<string,string> tempDataList = Soup.Form.decode(testObjs[id].data);
# ^^^^^^^^^^^^
# Upstream has no activity since 28 Dec 2020
broken = true;
};
}

@ -1,4 +1,4 @@
{ lib, stdenv, pkg-config, fetchFromGitHub, python3, vala_0_40
{ lib, stdenv, pkg-config, fetchFromGitHub, python3, vala
, gtk3, libwnck, libxfce4util, xfce4-panel, wafHook, xfce }:
stdenv.mkDerivation rec {
@ -12,13 +12,7 @@ stdenv.mkDerivation rec {
sha256 = "sha256-aKrJzf9rwCyXAJsRIXdBzmJBASuXD5I5kZrp+atx4FA=";
};
# Does not build with vala 0.48 or later
# Upstream has no activity for a while
# libxfce4panel-2.0.vapi:92.3-92.41: error: overriding method `Xfce.PanelPlugin.remote_event' is incompatible
# with base method `bool Xfce.PanelPluginProvider.remote_event (string, GLib.Value, uint)': too few parameters.
# public virtual signal bool remote_event (string name, GLib.Value value);
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nativeBuildInputs = [ pkg-config vala_0_40 wafHook python3 ];
nativeBuildInputs = [ pkg-config vala wafHook python3 ];
buildInputs = [ gtk3 libwnck libxfce4util xfce4-panel ];
postPatch = ''
@ -39,5 +33,12 @@ stdenv.mkDerivation rec {
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ volth ] ++ teams.xfce.members;
# Does not build with vala 0.48 or later
# libxfce4panel-2.0.vapi:92.3-92.41: error: overriding method `Xfce.PanelPlugin.remote_event' is incompatible
# with base method `bool Xfce.PanelPluginProvider.remote_event (string, GLib.Value, uint)': too few parameters.
# public virtual signal bool remote_event (string name, GLib.Value value);
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Upstream has no activity since 20 May 2020
broken = true;
};
}

@ -15,19 +15,7 @@ let
# header file isn't available at all, but that patch (./gvc-compat.patch)
# can be shared between all versions of Vala so far.
graphvizPatch =
let
fp = { commit, sha256 }: fetchpatch {
url = "https://github.com/openembedded/openembedded-core/raw/${commit}/meta/recipes-devtools/vala/vala/disable-graphviz.patch";
inherit sha256;
};
in {
# NOTE: the openembedded-core project doesn't have a patch for 0.40.12
# We've fixed the single merge conflict in the following patch.
# 0.40.12: https://github.com/openembedded/openembedded-core/raw/8553c52f174af4c8c433c543f806f5ed5c1ec48c/meta/recipes-devtools/vala/vala/disable-graphviz.patch
"0.40" = ./disable-graphviz-0.40.12.patch;
{
"0.48" = ./disable-graphviz-0.46.1.patch;
"0.52" = ./disable-graphviz-0.46.1.patch;
@ -98,19 +86,14 @@ let
});
in rec {
vala_0_40 = generic {
version = "0.40.25";
sha256 = "1pxpack8rrmywlf47v440hc6rv3vi8q9c6niwqnwikxvb2pwf3w7";
};
vala_0_48 = generic {
version = "0.48.21";
sha256 = "sha256-MFRVrrdo1u2bAYNgtVGC5IsW2xvBY6TluBQg+Y0h2Zg=";
version = "0.48.22";
sha256 = "sha256-27NHjEvjZvCTFkrGHNOu29zz5EQE2eNkFK4VEk525os=";
};
vala_0_52 = generic {
version = "0.52.9";
sha256 = "sha256-HpMH2B4hHxniUB6P5PtN0Z+5J8SEtV/873FOjFFdAHk=";
version = "0.52.10";
sha256 = "sha256-nCAb+BLZh04hveU/jZwU9lF0ixqBRB/1ySkSJESQEAg=";
};
vala_0_54 = generic {

@ -1,208 +0,0 @@
diff --git i/configure.ac w/configure.ac
index 694ffd200..915062053 100644
--- i/configure.ac
+++ w/configure.ac
@@ -112,34 +112,38 @@ PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
-PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
-AC_MSG_CHECKING([for CGRAPH])
-cgraph_tmp_LIBADD="$LIBADD"
-cgraph_tmp_CFLAGS="$CFLAGS"
-LIBADD="$LIBADD $LIBGVC_LIBS"
-CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
-AC_RUN_IFELSE(
- [AC_LANG_SOURCE([
- #include <gvc.h>
-
- int main(void) {
- #ifdef WITH_CGRAPH
- return 0;
- #else
- return -1;
- #endif
- }
- ])], [
- AC_MSG_RESULT([yes])
- VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
- have_cgraph=yes
- ], [
- AC_MSG_RESULT([no])
- have_cgraph=no
- ]
-)
-LIBADD="$cgraph_tmp_LIBADD"
-CFLAGS="$cgraph_tmp_CFLAGS"
+AC_ARG_ENABLE(graphviz, AS_HELP_STRING([--disable-graphviz], [Disable graphviz usage for valadoc]), enable_graphviz=$enableval, enable_graphviz=yes)
+if test x$enable_graphviz = xyes; then
+ PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
+ AC_MSG_CHECKING([for CGRAPH])
+ VALAFLAGS="$VALAFLAGS -D HAVE_GRAPHVIZ"
+ cgraph_tmp_LIBADD="$LIBADD"
+ cgraph_tmp_CFLAGS="$CFLAGS"
+ LIBADD="$LIBADD $LIBGVC_LIBS"
+ CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([
+ #include <gvc.h>
+ int main(void) {
+ #ifdef WITH_CGRAPH
+ return 0;
+ #else
+ return -1;
+ #endif
+ }
+ ])], [
+ AC_MSG_RESULT([yes])
+ VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
+ have_cgraph=yes
+ ], [
+ AC_MSG_RESULT([no])
+ have_cgraph=no
+ ]
+ )
+ LIBADD="$cgraph_tmp_LIBADD"
+ CFLAGS="$cgraph_tmp_CFLAGS"
+fi
+AM_CONDITIONAL(ENABLE_GRAPHVIZ, test x$enable_graphviz = xyes)
AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
AC_PATH_PROG([XSLTPROC], [xsltproc], :)
diff --git i/libvaladoc/Makefile.am w/libvaladoc/Makefile.am
index f3f790e76..3c5dc4c80 100644
--- i/libvaladoc/Makefile.am
+++ w/libvaladoc/Makefile.am
@@ -128,10 +128,6 @@ libvaladoc_la_VALASOURCES = \
content/tablerow.vala \
content/taglet.vala \
content/text.vala \
- charts/chart.vala \
- charts/chartfactory.vala \
- charts/hierarchychart.vala \
- charts/simplechartfactory.vala \
parser/manyrule.vala \
parser/oneofrule.vala \
parser/optionalrule.vala \
@@ -158,13 +154,24 @@ libvaladoc_la_VALASOURCES = \
highlighter/codetoken.vala \
highlighter/highlighter.vala \
html/basicdoclet.vala \
- html/htmlchartfactory.vala \
html/linkhelper.vala \
html/cssclassresolver.vala \
html/htmlmarkupwriter.vala \
html/htmlrenderer.vala \
$(NULL)
+if ENABLE_GRAPHVIZ
+libvaladoc_la_VALASOURCES += \
+ charts/chart.vala \
+ charts/chartfactory.vala \
+ charts/hierarchychart.vala \
+ charts/simplechartfactory.vala \
+ html/htmlchartfactory.vala \
+ $(NULL)
+
+LIBGVC_PKG = --vapidir $(top_srcdir)/vapi --pkg libgvc
+endif
+
libvaladoc@PACKAGE_SUFFIX@_la_SOURCES = \
libvaladoc.vala.stamp \
$(libvaladoc_la_VALASOURCES:.vala=.c) \
@@ -184,11 +191,11 @@ libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES)
--library valadoc \
--vapi valadoc@PACKAGE_SUFFIX@.vapi \
--vapidir $(top_srcdir)/vapi --pkg gmodule-2.0 \
- --vapidir $(top_srcdir)/vapi --pkg libgvc \
--vapidir $(top_srcdir)/gee --pkg gee \
--vapidir $(top_srcdir)/vala --pkg vala \
--vapidir $(top_srcdir)/ccode --pkg ccode \
--vapidir $(top_srcdir)/codegen --pkg codegen \
+ $(LIBGVC_PKG) \
--pkg config \
$(filter %.vala %.c,$^)
touch $@
@@ -217,6 +224,9 @@ nodist_pkgconfig_DATA = valadoc@PACKAGE_SUFFIX@.pc
valadoc@PACKAGE_SUFFIX@.pc: valadoc.pc
cp $< $@
+if !ENABLE_GRAPHVIZ
+ sed -i "s/libgvc //g" $@
+endif
vapidir = $(datadir)/vala/vapi
dist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.vapi
@@ -224,6 +234,9 @@ nodist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.deps
valadoc@PACKAGE_SUFFIX@.deps: valadoc.deps
cp $< $@
+if !ENABLE_GRAPHVIZ
+ sed -i "s/libgvc//g" $@
+endif
EXTRA_DIST = \
$(libvaladoc_la_VALASOURCES) \
diff --git i/libvaladoc/html/basicdoclet.vala w/libvaladoc/html/basicdoclet.vala
index 192e488cd..ec0960222 100644
--- i/libvaladoc/html/basicdoclet.vala
+++ w/libvaladoc/html/basicdoclet.vala
@@ -46,7 +46,11 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
protected HtmlRenderer _renderer;
protected Html.MarkupWriter writer;
protected Html.CssClassResolver cssresolver;
+#if HAVE_GRAPHVIZ
protected Charts.Factory image_factory;
+#else
+ protected void* image_factory;
+#endif
protected ErrorReporter reporter;
protected string package_list_link = "../index.html";
@@ -120,7 +124,9 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
this.linker = new LinkHelper ();
_renderer = new HtmlRenderer (settings, this.linker, this.cssresolver);
+#if HAVE_GRAPHVIZ
this.image_factory = new SimpleChartFactory (settings, linker);
+#endif
}
@@ -1026,6 +1032,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
}
protected void write_image_block (Api.Node element) {
+#if HAVE_GRAPHVIZ
if (element is Class || element is Interface || element is Struct) {
unowned string format = (settings.use_svg_images ? "svg" : "png");
var chart = new Charts.Hierarchy (image_factory, element);
@@ -1045,6 +1052,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
this.get_img_path_html (element, format)});
writer.add_usemap (chart);
}
+#endif
}
public void write_namespace_content (Namespace node, Api.Node? parent) {
diff --git i/libvaladoc/html/htmlmarkupwriter.vala w/libvaladoc/html/htmlmarkupwriter.vala
index dcc4dad76..cf9c860b8 100644
--- i/libvaladoc/html/htmlmarkupwriter.vala
+++ w/libvaladoc/html/htmlmarkupwriter.vala
@@ -51,12 +51,16 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
}
}
+#if HAVE_GRAPHVIZ
public MarkupWriter add_usemap (Charts.Chart chart) {
string? buf = (string?) chart.write_buffer ("cmapx");
if (buf != null) {
raw_text ("\n");
raw_text ((!) buf);
}
+#else
+ public MarkupWriter add_usemap (void* chart) {
+#endif
return this;
}

@ -13251,7 +13251,6 @@ with pkgs;
vala-lint = callPackage ../development/tools/vala-lint { };
inherit (callPackage ../development/compilers/vala { })
vala_0_40
vala_0_48
vala_0_52
vala_0_54