This guide shows all necessary steps needed for unspported Linux distributions to work with Wails.
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.
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 on the installation’s prerequisites section.
Wails uses /etc/os-release
for identification. In a terminal window run cat /etc/os-release
.
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco
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
For example on Ubuntu you need to use the -dumpfullversion
flag.
$ gcc -dumpversion
8
$ gcc -dumpfullversion
8.3.0
linuxdb.yaml
linuxdb.yaml
lives in wails/cmd/linuxdb.yaml
.
Use the NAME
and ID
fields of the previous step.
`ID`:
id: `ID`
releases:
name: `NAME`
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
programs: *debiandefaultprograms
libraries: *debiandefaultlibraries
If you are adding a previously unspported major release a new entry would like (centOS entry sample)
centos:
id: centos
releases:
default:
version: 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
linux.go
In wails/cmd/linux.go
you have to
NAME
field two steps back)const (
// Unknown is the catch-all distro
Unknown LinuxDistribution = iota
// Debian distribution
Debian
// Ubuntu distribution
Ubuntu
// Arch linux distribution
Arch
// CentOS linux distribution
CentOS
(...)
// NewDistroName linux distribution
NewDistroName
)
case "ID":
)switch osID {
case "fedora":
result.Distribution = Fedora
case "centos":
result.Distribution = CentOS
case "arch":
result.Distribution = Arch
case "debian":
result.Distribution = 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
}
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
// Linux has library deps
if runtime.GOOS == "linux" {
(...)
switch distroInfo.Distribution {
case Ubuntu, Debian, NewDistroName:
libraryChecker = DpkgInstalled
(...)
}
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
.
Now try running wails setup
.