chore: change qt version

This commit is contained in:
arm64v8a
2022-11-26 16:41:31 +09:00
parent 09d37fa898
commit b2ebd0e432
20 changed files with 408 additions and 177 deletions

View File

@@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
)
var local_qt_theme bool
@@ -16,18 +15,19 @@ func Launcher() {
wd, _ := filepath.Abs(".")
_debug := flag.Bool("debug", false, "Debug mode")
flag.BoolVar(&local_qt_theme, "theme", false, "Use local QT theme (unstable)")
flag.Parse()
// Find & symlink some Qt Plugin to enable system theme
tryLinkQtPlugin("styles", !local_qt_theme)
tryLinkQtPlugin("platformthemes", !local_qt_theme)
cmd := exec.Command("./nekoray", flag.Args()...)
cmd.Env = os.Environ()
ld_env := "LD_LIBRARY_PATH=" + filepath.Join(wd, "./usr/lib")
cmd.Env = append(cmd.Env, ld_env)
log.Println(ld_env, cmd)
qt_plugin_env := "QT_PLUGIN_PATH=" + filepath.Join(wd, "./usr/plugins")
// Qt 5.12 abi is usually compatible with system Qt 5.15
// But use package Qt 5.12 by default.
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "NKR_FROM_LAUNCHER=1")
cmd.Env = append(cmd.Env, ld_env, qt_plugin_env)
log.Println(ld_env, qt_plugin_env, cmd)
if *_debug {
cmd.Env = append(cmd.Env, "QT_DEBUG_PLUGINS=1")
@@ -39,39 +39,3 @@ func Launcher() {
cmd.Start()
}
}
func tryLinkQtPlugin(sub string, remove bool) {
wd_plugins_sub := filepath.Join("./usr/plugins", sub)
if Exist(wd_plugins_sub) {
if remove {
os.RemoveAll(wd_plugins_sub)
}
} else {
if remove {
return
}
arch := "x86_64"
if runtime.GOARCH == "arm64" {
arch = "aarch64"
}
paths := []string{
filepath.Join("/usr/lib/qt5/plugins", sub),
filepath.Join("/usr/lib64/qt5/plugins", sub),
filepath.Join("/usr/lib/"+arch+"-linux-gnu/qt5/plugins", sub),
filepath.Join("/usr/lib/qt/plugins", sub),
}
path := FindExist(paths)
if path == "" {
log.Println("warning:", sub, "not found")
return
}
err := os.Symlink(path, wd_plugins_sub)
if err != nil {
log.Println("symlink failed:", err.Error())
}
}
}