Add support for your Linux distro

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.

Identify necessary dependencies

Wails uses cgo to bind to the native rendering engines so a number of platform dependent libraries are needed.

gcc, pkg-config

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 on the installation’s prerequisites section.

Gather system’s information

Wails uses /etc/os-release for identification. In a terminal window run cat /etc/os-release.

  1. $ cat /etc/os-release
  2. NAME="Ubuntu"
  3. VERSION="19.04 (Disco Dingo)"
  4. ID=ubuntu
  5. ID_LIKE=debian
  6. PRETTY_NAME="Ubuntu 19.04"
  7. VERSION_ID="19.04"
  8. HOME_URL="https://www.ubuntu.com/"
  9. SUPPORT_URL="https://help.ubuntu.com/"
  10. BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
  11. PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
  12. VERSION_CODENAME=disco
  13. 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.

  1. gcc -dumpversion
  2. gcc -dumpfullversion

For example on Ubuntu you need to use the -dumpfullversion flag.

  1. $ gcc -dumpversion
  2. 8
  3. $ gcc -dumpfullversion
  4. 8.3.0

Make a new entry in linuxdb.yaml

linuxdb.yaml lives in wails/cmd/linuxdb.yaml.

Use the NAME and ID fields of the previous step.

  1. `ID`:
  2. id: `ID`
  3. releases:
  4. 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):

  1. linuxmint:
  2. id: linuxmint
  3. releases:
  4. default:
  5. version: default
  6. name: Linux Mint
  7. gccversioncommand: *gccdumpversion
  8. programs: *debiandefaultprograms
  9. libraries: *debiandefaultlibraries

If you are adding a previously unspported major release a new entry would like (centOS entry sample)

  1. centos:
  2. id: centos
  3. releases:
  4. default:
  5. version: default
  6. name: CentOS Linux
  7. gccversioncommand: *gccdumpversion
  8. programs:
  9. - name: gcc
  10. help: Please install with `sudo yum install gcc-c++ make` and try again
  11. - name: pkg-config
  12. help: Please install with `sudo yum install pkgconf-pkg-config` and try again
  13. - name: npm
  14. help: Please install with `sudo yum install epel-release && sudo yum install nodejs` and try again
  15. libraries:
  16. - name: gtk3-devel
  17. help: Please install with `sudo yum install gtk3-devel` and try again
  18. - name: webkitgtk3-devel
  19. 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.

Edit linux.go

In wails/cmd/linux.go you have to

  • add a new constant with your distro’s name (use whatever is returned under NAME field two steps back)
  1. const (
  2. // Unknown is the catch-all distro
  3. Unknown LinuxDistribution = iota
  4. // Debian distribution
  5. Debian
  6. // Ubuntu distribution
  7. Ubuntu
  8. // Arch linux distribution
  9. Arch
  10. // CentOS linux distribution
  11. CentOS
  12. (...)
  13. // NewDistroName linux distribution
  14. NewDistroName
  15. )
  • and a new switch case (case "ID":)
  1. switch osID {
  2. case "fedora":
  3. result.Distribution = Fedora
  4. case "centos":
  5. result.Distribution = CentOS
  6. case "arch":
  7. result.Distribution = Arch
  8. case "debian":
  9. result.Distribution = Debian
  10. (...)
  11. case "newdistroID":
  12. result.Distribution = NewDistroName
  13. }

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.

  1. // DpkgInstalled uses dpkg to see if a package is installed
  2. func DpkgInstalled(packageName string) (bool, error) {
  3. program := NewProgramHelper()
  4. dpkg := program.FindProgram("dpkg")
  5. if dpkg == nil {
  6. return false, fmt.Errorf("cannot check dependencies: dpkg not found")
  7. }
  8. _, _, exitCode, _ := dpkg.Run("-L", packageName)
  9. return exitCode == 0, nil
  10. }

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

  1. // Linux has library deps
  2. if runtime.GOOS == "linux" {
  3. (...)
  4. switch distroInfo.Distribution {
  5. case Ubuntu, Debian, NewDistroName:
  6. libraryChecker = DpkgInstalled
  7. (...)
  8. }

If you are adding a major distro with it’s own package manager you have to make a new case entry.

  1. // Linux has library deps
  2. if runtime.GOOS == "linux" {
  3. (...)
  4. switch distroInfo.Distribution {
  5. case NewDistroName:
  6. libraryChecker = NewPackageManagerInstalled
  7. (...)
  8. }

Check that everything works

cd in directory wails/cmd/wails and install the updated Wails by running go install.

Now try running wails setup.