Skip to content

Commit f70b300

Browse files
committed
merge: sync upstream faaa437 into fork main
2 parents 86ce261 + faaa437 commit f70b300

4 files changed

Lines changed: 35 additions & 22 deletions

File tree

‎cmd/viva/package_tarball.go‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,23 @@ var linuxRuntimeDepends = []string{
2929
"libfontconfig1", "libpango-1.0-0", "libpangocairo-1.0-0", "libglib2.0-0",
3030
}
3131

32-
// linuxRuntimeRecommends add GPU acceleration without being required: the CPU
33-
// renderer draws the window when the loader or a Vulkan driver is missing.
34-
var linuxRuntimeRecommends = []string{"libvulkan1"}
32+
// linuxRuntimeRecommends are the optional capabilities an install gets by
33+
// default: pointers that follow the desktop's cursor theme and size through
34+
// libxcb-cursor, and GPU acceleration through the Vulkan loader. Both have a
35+
// fallback — the X cursor font's fixed glyph and the CPU renderer — so neither
36+
// is required to start, but without the cursor library a HiDPI desktop shows a
37+
// pointer many times smaller than its own.
38+
var linuxRuntimeRecommends = []string{"libxcb-cursor0", "libvulkan1"}
3539

3640
// linuxArchRuntimeDepends are the same libraries under Arch's names.
3741
var linuxArchRuntimeDepends = []string{
3842
"libxcb", "cairo", "fontconfig", "pango", "glib2",
3943
}
4044

41-
// linuxArchRuntimeRecommends are the GPU packages under Arch's names. Arch's
45+
// linuxArchRuntimeRecommends are the optional packages under Arch's names. Arch's
4246
// optdepends carry their reason, which pacman shows.
4347
var linuxArchRuntimeRecommends = []string{
48+
"libxcb-cursor: pointers that follow the desktop cursor theme and size; without it the pointer uses a fixed small glyph",
4449
"vulkan-icd-loader: GPU acceleration; without it the application draws on the CPU",
4550
}
4651

@@ -55,8 +60,9 @@ var linuxRPMRuntimeDepends = []string{
5560
"libpangocairo-1.0.so.0()(64bit)", "libgobject-2.0.so.0()(64bit)",
5661
}
5762

58-
// linuxRPMRuntimeRecommends are the GPU capabilities RPM recommends.
59-
var linuxRPMRuntimeRecommends = []string{"libvulkan.so.1()(64bit)"}
63+
// linuxRPMRuntimeRecommends are the optional capabilities RPM recommends: the
64+
// cursor theme library and the GPU loader.
65+
var linuxRPMRuntimeRecommends = []string{"libxcb-cursor.so.0()(64bit)", "libvulkan.so.1()(64bit)"}
6066

6167
// linuxApplication describes the application for the Debian and RPM packages:
6268
// both install the same files, so they share one description.

‎cmd/viva/package_tarball_test.go‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func TestPackageLinuxMakesADeb(t *testing.T) {
165165
text := string(control["./control"])
166166
for _, want := range []string{
167167
"Package: fixture-notes\n", "Version: 2.0.1\n", "Architecture: amd64\n", "Maintainer: Ann Lee <ann@example.com>\n",
168-
"Depends: libxcb1, libcairo2, libfontconfig1, libpango-1.0-0, libpangocairo-1.0-0, libglib2.0-0, libfoo1 (>= 1.2)\n", "Recommends: libvulkan1\n", "Homepage: https://example.com/notes\n", "Description: Takes notes\n",
168+
"Depends: libxcb1, libcairo2, libfontconfig1, libpango-1.0-0, libpangocairo-1.0-0, libglib2.0-0, libfoo1 (>= 1.2)\n", "Recommends: libxcb-cursor0, libvulkan1\n", "Homepage: https://example.com/notes\n", "Description: Takes notes\n",
169169
} {
170170
if !strings.Contains(text, want) {
171171
t.Errorf("control lacks %q:\n%s", want, text)
@@ -279,8 +279,8 @@ func TestPackageLinuxMakesAnRPM(t *testing.T) {
279279

280280
// dlopen dependencies do not appear in the program's ELF headers. RPM must request
281281
// their shared-library capabilities so a clean installation has the text and XCB
282-
// libraries; the GPU loader is recommended, because the CPU renderer covers a
283-
// machine without it.
282+
// libraries; the cursor theme library and the GPU loader are recommended, because
283+
// the X cursor font and the CPU renderer cover a machine without them.
284284
func TestPackageLinuxRPMDeclaresRuntimeLibraries(t *testing.T) {
285285
for _, arch := range []struct{ goarch, rpm string }{{"amd64", "x86_64"}, {"arm64", "aarch64"}} {
286286
t.Run(arch.goarch, func(t *testing.T) {
@@ -306,8 +306,10 @@ func TestPackageLinuxRPMDeclaresRuntimeLibraries(t *testing.T) {
306306
t.Error("RPM hard-requires the GPU loader, which the CPU renderer does not need")
307307
}
308308
recommends := rpmRecommendedCapabilities(t, data)
309-
if !slices.Contains(recommends, "libvulkan.so.1()(64bit)") {
310-
t.Errorf("RPM does not recommend the GPU loader, has %v", recommends)
309+
for _, capability := range []string{"libxcb-cursor.so.0()(64bit)", "libvulkan.so.1()(64bit)"} {
310+
if !slices.Contains(recommends, capability) {
311+
t.Errorf("RPM does not recommend %s, has %v", capability, recommends)
312+
}
311313
}
312314
for _, library := range []string{
313315
"libpangoft2-1.0.so.0", "libxcb-cursor.so.0", "libxcb-randr.so.0",
@@ -477,22 +479,22 @@ func TestDebDepends(t *testing.T) {
477479
}
478480

479481
func TestDebRecommends(t *testing.T) {
480-
if got := strings.Join(debRecommends(nil), ", "); got != "libvulkan1" {
482+
if got := strings.Join(debRecommends(nil), ", "); got != "libxcb-cursor0, libvulkan1" {
481483
t.Errorf("recommends = %q", got)
482484
}
483-
// A manifest that requires the loader itself keeps it out of Recommends.
484-
if got := debRecommends([]string{"libvulkan1 (>= 1.3)"}); len(got) != 0 {
485-
t.Errorf("recommends = %v, want none", got)
485+
// A manifest that requires a package itself keeps it out of Recommends.
486+
if got := strings.Join(debRecommends([]string{"libxcb-cursor0", "libvulkan1 (>= 1.3)"}), ", "); got != "" {
487+
t.Errorf("recommends = %q, want none", got)
486488
}
487489
}
488490

489491
func TestArchOptDepends(t *testing.T) {
490492
optional := archOptDepends(nil)
491-
if len(optional) != 1 || !strings.HasPrefix(optional[0], "vulkan-icd-loader: ") {
493+
if len(optional) != 2 || !strings.HasPrefix(optional[0], "libxcb-cursor: ") || !strings.HasPrefix(optional[1], "vulkan-icd-loader: ") {
492494
t.Errorf("optdepends = %v", optional)
493495
}
494-
// A manifest that depends on the loader itself keeps it out of optdepends.
495-
if got := archOptDepends([]string{"vulkan-icd-loader"}); len(got) != 0 {
496+
// A manifest that depends on a package itself keeps it out of optdepends.
497+
if got := archOptDepends([]string{"libxcb-cursor", "vulkan-icd-loader"}); len(got) != 0 {
496498
t.Errorf("optdepends = %v, want none", got)
497499
}
498500
}
@@ -559,7 +561,7 @@ func TestPackageLinuxMakesAPKGBUILD(t *testing.T) {
559561
"pkgver='2.0.1'",
560562
"arch=('x86_64')",
561563
"depends=('fontconfig' 'pango' 'glib2' 'libxcb>=1.16' 'cairo' 'extra-lib')",
562-
"optdepends=('vulkan-icd-loader: GPU acceleration; without it the application draws on the CPU')",
564+
"optdepends=('libxcb-cursor: pointers that follow the desktop cursor theme and size; without it the pointer uses a fixed small glyph' 'vulkan-icd-loader: GPU acceleration; without it the application draws on the CPU')",
563565
"source=('fixture-notes-2.0.1-linux-amd64.tar.gz')",
564566
"sha256sums=('" + hex.EncodeToString(digest[:]) + "')",
565567
"_icon_size=256",
@@ -575,7 +577,12 @@ func TestPackageLinuxMakesAPKGBUILD(t *testing.T) {
575577
if err != nil {
576578
t.Fatal(err)
577579
}
578-
for _, want := range []string{"pkgbase = fixture-notes-bin", "\tarch = x86_64", "\tdepends = extra-lib", "\toptdepends = vulkan-icd-loader: GPU acceleration; without it the application draws on the CPU", "pkgname = fixture-notes-bin"} {
580+
for _, want := range []string{
581+
"pkgbase = fixture-notes-bin", "\tarch = x86_64", "\tdepends = extra-lib",
582+
"\toptdepends = libxcb-cursor: pointers that follow the desktop cursor theme and size; without it the pointer uses a fixed small glyph",
583+
"\toptdepends = vulkan-icd-loader: GPU acceleration; without it the application draws on the CPU",
584+
"pkgname = fixture-notes-bin",
585+
} {
579586
if !strings.Contains(string(srcinfo), want) {
580587
t.Errorf("the .SRCINFO lacks %q:\n%s", want, srcinfo)
581588
}

‎website/content/guides/en/build-and-package.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ viva package --program ./notes-signed # package an executable you buil
102102
| Windows | NSIS installer (needs `makensis`), or `.zip` |
103103
| Linux | `tar.gz` with an install script, `.deb`, or a `PKGBUILD` with its `.SRCINFO` for an Arch binary package |
104104

105-
A `PKGBUILD` installs the program under `/opt/<name>-bin`, links it into `/usr/bin`, and installs the menu entry, icon and document types; it never builds anything, so it needs no Arch machine to write. The `tar.gz` is its source: by default makepkg looks for it beside the `PKGBUILD`, and `--pkgbuild-url` gives the address of the released archive instead (the `tar.gz::<url>` form, so the file keeps its name). Write each architecture into its own directory, as `PKGBUILD` is one file per directory. Set `[linux] arch_depends` for libraries the application needs beyond the XCB, Pango, Cairo and fontconfig packages every Viva application requires; the Vulkan loader is recommended for GPU acceleration and installed on request.
105+
A `PKGBUILD` installs the program under `/opt/<name>-bin`, links it into `/usr/bin`, and installs the menu entry, icon and document types; it never builds anything, so it needs no Arch machine to write. The `tar.gz` is its source: by default makepkg looks for it beside the `PKGBUILD`, and `--pkgbuild-url` gives the address of the released archive instead (the `tar.gz::<url>` form, so the file keeps its name). Write each architecture into its own directory, as `PKGBUILD` is one file per directory. Set `[linux] arch_depends` for libraries the application needs beyond the XCB, Pango, Cairo and fontconfig packages every Viva application requires. The `.deb` and RPM recommend the cursor theme library and the Vulkan loader — pointers that follow the desktop's cursor theme and size, and GPU acceleration — and the PKGBUILD lists them as optdepends, installed on request.
106106

107107
**Signing is optional.** With nothing configured nothing is signed: macOS blocks a downloaded bundle and Windows SmartScreen warns about the installer. `--program` exists so you can build, sign, and then package that exact executable yourself.
108108

‎website/content/guides/zh/build-and-package.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ viva package --program ./notes-signed # 打包你自己构建或签名
102102
| Windows | NSIS 安装程序(需要 `makensis`),或 `.zip` |
103103
| Linux | 带安装脚本的 `tar.gz`、`.deb`,或 Arch 二进制包用的 `PKGBUILD` 与 `.SRCINFO` |
104104

105-
`PKGBUILD` 把程序装到 `/opt/<name>-bin`,链接到 `/usr/bin`,并安装菜单项、图标和文档类型;它不构建任何东西,所以写它不需要 Arch 机器。它的源是那个 `tar.gz`:默认 makepkg 在 `PKGBUILD` 旁边找它,`--pkgbuild-url` 则给出已发布归档的地址(写成 `tar.gz::<url>`,保留文件名)。每个架构写到各自的目录,因为一个目录只有一个 `PKGBUILD`。除每个 Viva 应用都需要的 XCB、Pango、Cairo 和 fontconfig 包之外,应用还需要别的库时,用 `[linux] arch_depends` 列出;Vulkan 加载库建议安装以获得 GPU 加速。
105+
`PKGBUILD` 把程序装到 `/opt/<name>-bin`,链接到 `/usr/bin`,并安装菜单项、图标和文档类型;它不构建任何东西,所以写它不需要 Arch 机器。它的源是那个 `tar.gz`:默认 makepkg 在 `PKGBUILD` 旁边找它,`--pkgbuild-url` 则给出已发布归档的地址(写成 `tar.gz::<url>`,保留文件名)。每个架构写到各自的目录,因为一个目录只有一个 `PKGBUILD`。除每个 Viva 应用都需要的 XCB、Pango、Cairo 和 fontconfig 包之外,应用还需要别的库时,用 `[linux] arch_depends` 列出。`.deb` 和 RPM 会推荐光标主题库和 Vulkan 加载库——前者让光标跟随桌面的主题和大小,后者提供 GPU 加速;PKGBUILD 把它们列为 optdepends,按需安装。
106106

107107
**签名是可选的。** 什么都不配置就什么都不签:macOS 会阻止下载的应用包,Windows SmartScreen 会对安装程序给出警告。`--program` 的存在就是为了让你自己先构建、签名,再打包这个确定的可执行文件。
108108

0 commit comments

Comments
 (0)