- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 flatpak 构建一个 Vala 程序。我需要连接到 mysql 服务器,这就是为什么我需要将 libmysqlclient
与我的 flatpak 捆绑在一起。
这就是我将 mysql_config
添加到 meson.build 文件的原因。
project('zeiterfassunggtk', ['c', 'vala'], version: '0.1.0',
meson_version: '>= 0.40.0',
)
i18n = import('i18n')
mysql_config = find_program('mysql_config')
mysql_vapi = meson.get_compiler('vala').find_library('mysql')
mysql_dep = declare_dependency(c_args: run_command([mysql_config, '--cflags']).stdout().split(),
link_args: run_command([mysql_config, '--libs']).stdout().split(),
dependencies: [mysql_vapi])
subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('build-aux/meson/postinstall.py')
Modules
The module list specifies each of the modules that are to be built as part of the build process. One of these modules is the application itself, and other modules are dependencies and libraries that are bundled as part of the Flatpak. While simple applications may only specify one or two modules, and therefore have short modules sections, some applications can bundle numerous modules and therefore have lengthy modules sections.
GNOME Dictionary’s modules section is short, since it just contains the application itself, and looks like:
"modules": [ {
"name": "gnome-dictionary",
"sources": [
{
"type": "archive",
"url": "https://download.gnome.org/sources/gnome-dictionary/3.26/gnome-dictionary-3.26.0.tar.xz",
"sha256": "387ff8fbb8091448453fd26dcf0b10053601c662e59581097bc0b54ced52e9ef"
}
] } ]As can be seen, each listed module has a name (which can be freely assigned) and a list of sources. Each source has a type, and available types include:
archive - .tar or .zip archive files
git - Git repositories
bzr - Bazaar repositories
file - local file (these are copied into the source directory)
dir - local directory (these are copied into the source directory)
script - an array of shell commands (these are put in a shellscript file)
shell - an array of shell commands that are run during source extraction
patch - a patch (are applied to the source directory)
extra-data - data that can be downloaded at install time; this can include archive or package filesDifferent properties are available for each source type, which are listed in the Flatpak Builder Command Reference.
libmysqlclient
添加到我的 flatpak 以及如何使用
mysql_config
为我的 flatpak 设置正确的编译器标志。
{
"app-id" : "org.gnome.Zeiterfassunggtk",
"runtime" : "org.gnome.Platform",
"runtime-version" : "3.28",
"sdk" : "org.gnome.Sdk",
"command" : "zeiterfassunggtk",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"build-options" : {
"cflags" : "-O2 -g",
"cxxflags" : "-O2 -g",
"env" : {
"V" : "1"
}
},
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"/share/vala",
"*.la",
"*.a"
],
"modules" : [
{
"name" : "zeiterfassunggtk",
"buildsystem" : "meson",
"config-opts" : [
"--libdir=lib"
],
"builddir" : true,
"sources" : [
{
"type" : "git",
"url" : "file:///home/g.zehetner/Projekte/ZeiterfassungGtk"
}
]
}
]
}
最佳答案
Flatpak 旨在通过使用容器化技术在 Linux 上分发应用程序。这允许 Flatpak 独立于当前的发行版,如 Ubuntu 和 Fedora。然而,似乎创建 Flatpak 的人需要培养分发打包人员的一些技能。 Flatpak 的依赖项放在 list 的 modules
部分,这些将被构建并包含在 Flatpak 中。以下内容未经测试,因此可能会丢失一些细节,但它旨在概述有助于提供帮助的想法。有几个选项:libmariadb
MariaDB 是 MySQL 的一个分支。在对 Oracle Corporation 收购 MySQL 的担忧之后由社区 fork 。我首先列出了它,因为它似乎是最简单的选择,至少从长远来看是这样。
MariaDB 在 GitHub 上有 releases of mariadb-connector-c
。出于某种原因,GitHub 没有显示这些版本的校验和。所以 MariaDB Foundation's download section 在这里是一个更好的选择。 mariadb-connector-c
可以连接到 MariaDB 和 MySQL。
从源代码来看,mariadb-connector-c
的构建系统是 CMake。 CMakeLists.txt file 中有您可能需要的 WITH_SSL
之类的选项,但下面的 list 片段忽略了 config-opts
的使用。这个 Flatpak GitHub issue 可能有一个关于如何使用 config-opts
进行 CMake 构建的相关示例。
所以我们有一个源代码发布,一个校验和,我们知道构建系统。通过向 list 的 modules
部分添加类似的内容,您应该能够在您的 Flatpak 中包含 mariadb-connector-c
的构建:
{
"name": "mariadb-connector-c",
"buildsystem": "cmake",
"sources": [
{
"type": "archive",
"url": "https://downloads.mariadb.org/f/connector-c-3.0.8/mariadb-connector-c-3.0.8-src.tar.gz",
"sha256": "2ca368fd79e87e80497a5c9fd18922d8316af8584d87cecb35bd5897cb1efd05"
}
]
}
cleanup
键。
pkg-config
文件名为
libmariadb.pc
。所以你的 VAPI 需要重命名为
libmariadb.vapi
。您可以将
mysql.vapi
中的
/usr/share/
复制到您的本地应用程序源目录,并重命名为
libmariadb.vapi
。您需要调整您的
meson.build
以将其包含为 VAPI 搜索目录,并且您不再需要搜索
mysql_config
。
pkg-config
将代替
mysql_config
的工作。
maria-connector-c
的一部分。手指交叉它会起作用。 C 头文件中还有一些额外的符号是 MariaDB 特定的。如果要修改 VAPI,请阅读
Writing a VAPI Manually 。请考虑随后将您的改进提交给
Vala mainline repository。
mysqlclient
libmariadb
选项从长远来看可能是更好的选项。还有一个页面
MySQL Connector/C (Archived Versions) ,里面的存档版本是 870 万下载。使用旧版本可能是一个更好的选择。
libmariadb
的 list 。
MySQL source is available from GitHub 也使用 CMake。
CMakeLists.txt
文件确实显示
pkg-config
文件是
mysqlclient.pc
。所以 Vala VAPI 应该是
mysqlclient.vapi
。欢迎对 Vala 存储库的贡献来解决这个问题。通过使用
pkg-config
名称,您不再需要在
mysql_config
中查找
meson.build
。
mysqlclient
或
libmariadb
。什么也没找到。
simple
构建类型。这允许运行命令,如
cp
。因此,更快的选择可能是将本地 MySQL 客户端文件复制到 Flatpak。这至少可以让您在开发过程中取得进展,并重新为最终版本实现强大的解决方案。有关
simple
构建的示例,请参阅此
GitHub issue 和
LibreOffice Flathub manifest。此外,Flatpak 文件结构记录在
Requirement and Conventions 和
typical filesystem inside a Flatpak sandbox 中。
关于vala - Flatpak bundle libmysqlclient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52534250/
如何在 Vala 中创建周期性任务? Vala 中是否有可以在指定时间段调用预定方法的计时器类?如果是,请提供示例代码。 更新: 这是基于答案和评论的示例代码: public class Sample
有没有人尝试在Vala中编写pidgin或libpurple插件?快速浏览Vala homepage似乎是一种很棒的语言,并且是学习Vala的好机会,但是同时学习Vala和pidgin插件的精湛技巧有
Vala 有函数静态变量吗? 我所说的“函数静态变量”是指在函数内部声明的变量,它在调用之间保持其值,如以下 C 示例所示: #include void foo() { int a = 10
在 Java 中你可以有这样的东西 class MyClass { ... 在 C# 中 class MyClass where E : A { ... Vala 中有类似的东西吗? 最佳答案 不,V
Vala Tutorial提到了内置数组的以下方法和属性(和运算符): arr.length arr += element arr.resize() arr.move() (“内置数组”是指像 int
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
在 Vala 的默认应用程序中打开文件的最佳方式是什么? 有点像xdg-open作品。 最佳答案 我在另一个应用程序中找到了一些现有的代码,但后来我也发现了这个GLib.AppInfo.launch_
在 Vala 中,我看到当我声明一个数组时我必须指定类型,比如 int[] myarray = { 1, 2, 3 }; 我想知道是否有一种方法可以像这样混合数组 smtg[] myarray = {
我想在我的应用程序中使用颜色选择器对话框 - https://github.com/satya164/gtk-theme-config 我在 vala 中找不到关于 ColorChooserDialo
我是瓦拉的新手。我对 GObject 不熟悉。据我了解,GObject 是从 GNOME 的 GLib 项目中分离出来的。如果我错了请纠正我。 我确实非常喜欢 Vala 的语法和实现,但我无意为 GN
假设我有一个 C 代码 (dcomplex.h): typedef double dcomplex[2]; 并且想在vala中使用这样的数据类型。 最小的 vapi 文件和 vala 调用是什么? (
我正在尝试使用 Vala 创建一个使用 Glib.Settings 的应用程序。如果架构或键不存在,我不希望我的应用程序崩溃。我已经明白我无法捕获其中的错误( How to handle errors
我正在为 LAME 编码器构建一个前端,以便在 Gtk/Vala 中进行概念验证。 我已经安装了 libmp3lame-dev 并希望使用一些给定的编码参数对 WAV 文件进行简单编码,并使用 Gtk
我正在使用 HashMap。当我遍历 map 时,数据以(通常是相同的)随机顺序返回。但是数据是按特定顺序插入的,我需要保留插入顺序。我怎样才能在 Vala 中做到这一点?在 Java 中有 Link
我在 Vala 应用程序中使用 Glib.Settings。我想确保即使模式或 key 不可用,我的程序也能正常工作。所以我添加了一个 try/catch 块,但是如果我使用不存在的 key ,程序就
在 Linux 中,我在 Gnome Builder (3.26.4) 中使用 Meson (0.44.0) 作为控制台程序,该程序将使用 Gee 和 GXml。我的意图是在 Genie 中写这个。
我刚刚运行了这段代码,它对我来说看起来是不错的语言。 但是当我在 NetBeans IDE 中尝试时,我没有看到任何 Vala,也没有看到任何自动完成可用性。 知道如何让 NetBeans IDE 支
将此库与 Vala 一起使用: http://valadoc.org/#!api=glib-2.0/GLib.DateTime GLib.DateTime now = new GLib.Dat
我正在 win32 上使用 Vala 开发小型命令行实用程序。使用 vala 编译的程序依赖于以下 DLL libgobject-2.0-0.dll libgthread-2.0-0.dll libg
我想使用模拟对象编写单元测试,例如 Moq或 NSubstitute对于 C#。 有人可以推荐一个与 Vala 一起使用的模拟库吗? 最佳答案 由于 Vala 生成 C 代码(使用 GObject 库
我是一名优秀的程序员,十分优秀!