Add support for your Linux distro
if you managed to get Wails working for your desktop please consider making a Pull Request. For more details see the development section.
Wails uses cgo to bind to the native rendering engines so a number of platform dependent libraries are needed.
- npm -
- gcc
- gtk
- webkitgtk
gtk, webkit
Locate the appropriate equivalent libraries for your distribution.
NOTE: if your distro is a derivative and not a major distribution there are good chances all necessary dependendancies to be the covered .
Gather system’s information
Wails uses for identification. In a terminal window run cat /etc/os-release
.
We are interested in NAME
and ID
fields. Then identify which of the bellow two commands returns gcc’s full version . This is needed for better support when filling tickets via wails issue
.
gcc -dumpversion
gcc -dumpfullversion
$ gcc -dumpversion
8
$ gcc -dumpfullversion
8.3.0
linuxdb.yaml
lives in wails/cmd/linuxdb.yaml
.
Use the NAME
and ID
fields of the previous step.
If your are on derivative distro that shares libraries and software with it’s major a new entry would look like (linux mint sample):
linuxmint:
id: linuxmint
releases:
default:
version: default
name: Linux Mint
gccversioncommand: *gccdumpversion
libraries: *debiandefaultlibraries
If you are adding a previously unspported major release a new entry would like (centOS entry sample)
centos:
id: centos
releases:
default:
name: CentOS Linux
gccversioncommand: *gccdumpversion
programs:
- name: gcc
help: Please install with `sudo yum install gcc-c++ make` and try again
- name: pkg-config
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
- name: npm
help: Please install with `sudo yum install epel-release && sudo yum install nodejs` and try again
libraries:
- name: gtk3-devel
help: Please install with `sudo yum install gtk3-devel` and try again
- name: webkitgtk3-devel
help: Please install with `sudo yum install webkitgtk3-devel` and try again
Mewn
After you are done editing run mewn
inside wails/cmd
directory.
As a result cmd-mewn.go
should have been re-generated adding your DB entry.
- add a new constant with your distro’s name (use whatever is returned under
NAME
field two steps back)
- and a new switch case (
case "ID":
)
switch osID {
case "fedora":
result.Distribution = Fedora
case "centos":
case "arch":
result.Distribution = Arch
case "debian":
(...)
case "newdistroID":
result.Distribution = NewDistroName
}
When adding a major distro you need to also add a new function to support your distro’s specific package manager.
Here is a sample for dpkg
.
// DpkgInstalled uses dpkg to see if a package is installed
func DpkgInstalled(packageName string) (bool, error) {
program := NewProgramHelper()
dpkg := program.FindProgram("dpkg")
if dpkg == nil {
return false, fmt.Errorf("cannot check dependencies: dpkg not found")
}
_, _, exitCode, _ := dpkg.Run("-L", packageName)
return exitCode == 0, nil
}
Edit system.go
Finally you have to edit package manager’s switch case in wails/cmd/system.go
to also include your distro.
For example if your are on a Debian derivative you would
If you are adding a major distro with it’s own package manager you have to make a new case entry.
// Linux has library deps
if runtime.GOOS == "linux" {
(...)
switch distroInfo.Distribution {
case NewDistroName:
libraryChecker = NewPackageManagerInstalled
(...)
}
cd
in directory wails/cmd/wails
and install the updated Wails by running go install
.