Get it compiling

This commit is contained in:
Lea Anthony
2020-09-15 19:55:50 -05:00
committed by Travis McLane
parent c158fd369a
commit 852bbd148c
9 changed files with 894 additions and 74 deletions
+3
View File
@@ -15,6 +15,9 @@ import (
#cgo linux CFLAGS: -DFFENESTRI_LINUX=1
#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0
#cgo darwin CFLAGS: -DFFENESTRI_DARWIN=1
#cgo darwin LDFLAGS: -framework WebKit -lobjc
#include <stdlib.h>
#include "ffenestri.h"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,30 @@
package operatingsystem
import "github.com/wailsapp/wails/v2/internal/shell"
func platformInfo() (*OS, error) {
// Default value
var result OS
result.ID = "Unknown"
result.Name = "MacOS"
result.Version = "Unknown"
stdout, stderr, err := shell.RunCommand(".", "sysctl", "kern.osrelease")
println(stdout)
println(stderr)
println(err)
// cmd := CreateCommand(directory, command, args...)
// var stdo, stde bytes.Buffer
// cmd.Stdout = &stdo
// cmd.Stderr = &stde
// err := cmd.Run()
// return stdo.String(), stde.String(), err
// }
// sysctl := shell.NewCommand("sysctl")
// kern.ostype: Darwin
// kern.osrelease: 20.1.0
// kern.osrevision: 199506
return nil, nil
}
@@ -9,24 +9,6 @@ import (
"github.com/wailsapp/wails/v2/internal/shell"
)
// PackageManager is a common interface across all package managers
type PackageManager interface {
Name() string
Packages() packagemap
PackageInstalled(*Package) (bool, error)
PackageAvailable(*Package) (bool, error)
InstallCommand(*Package) string
}
// Package contains information about a system package
type Package struct {
Name string
Version string
InstallCommand map[string]string
SystemPackage bool
Library bool
Optional bool
}
// A list of package manager commands
var pmcommands = []string{
@@ -38,8 +20,6 @@ var pmcommands = []string{
"zypper",
}
type packagemap = map[string][]*Package
// Find will attempt to find the system package manager
func Find(osid string) PackageManager {
@@ -70,58 +50,6 @@ func newPackageManager(pmname string, osid string) PackageManager {
return nil
}
// Dependancy represents a system package that we require
type Dependancy struct {
Name string
PackageName string
Installed bool
InstallCommand string
Version string
Optional bool
External bool
}
// DependencyList is a list of Dependency instances
type DependencyList []*Dependancy
// InstallAllRequiredCommand returns the command you need to use to install all required dependencies
func (d DependencyList) InstallAllRequiredCommand() string {
result := ""
for _, dependency := range d {
if dependency.PackageName != "" {
if !dependency.Installed && !dependency.Optional {
if result == "" {
result = dependency.InstallCommand
} else {
result += " " + dependency.PackageName
}
}
}
}
return result
}
// InstallAllOptionalCommand returns the command you need to use to install all optional dependencies
func (d DependencyList) InstallAllOptionalCommand() string {
result := ""
for _, dependency := range d {
if dependency.PackageName != "" {
if !dependency.Installed && dependency.Optional {
if result == "" {
result = dependency.InstallCommand
} else {
result += " " + dependency.PackageName
}
}
}
}
return result
}
// Dependancies scans the system for required dependancies
// Returns a list of dependancies search for, whether they were found
// and whether they were installed
+77
View File
@@ -0,0 +1,77 @@
package packagemanager
// Package contains information about a system package
type Package struct {
Name string
Version string
InstallCommand map[string]string
SystemPackage bool
Library bool
Optional bool
}
type packagemap = map[string][]*Package
// PackageManager is a common interface across all package managers
type PackageManager interface {
Name() string
Packages() packagemap
PackageInstalled(*Package) (bool, error)
PackageAvailable(*Package) (bool, error)
InstallCommand(*Package) string
}
// Dependancy represents a system package that we require
type Dependancy struct {
Name string
PackageName string
Installed bool
InstallCommand string
Version string
Optional bool
External bool
}
// DependencyList is a list of Dependency instances
type DependencyList []*Dependancy
// InstallAllRequiredCommand returns the command you need to use to install all required dependencies
func (d DependencyList) InstallAllRequiredCommand() string {
result := ""
for _, dependency := range d {
if dependency.PackageName != "" {
if !dependency.Installed && !dependency.Optional {
if result == "" {
result = dependency.InstallCommand
} else {
result += " " + dependency.PackageName
}
}
}
}
return result
}
// InstallAllOptionalCommand returns the command you need to use to install all optional dependencies
func (d DependencyList) InstallAllOptionalCommand() string {
result := ""
for _, dependency := range d {
if dependency.PackageName != "" {
if !dependency.Installed && dependency.Optional {
if result == "" {
result = dependency.InstallCommand
} else {
result += " " + dependency.PackageName
}
}
}
}
return result
}
+8
View File
@@ -0,0 +1,8 @@
// +build darwin
package system
func (i *Info) discover() error {
return nil
}
+1 -1
View File
@@ -15,7 +15,7 @@ func packageProject(options *Options, platform string) error {
var err error
switch platform {
case "linux":
err = packageLinuxApplication(options)
err = packageApplication(options)
default:
err = fmt.Errorf("packing not supported for %s yet", platform)
}
+6
View File
@@ -0,0 +1,6 @@
package build
func packageApplication(options *Options) error {
// TBD
return nil
}
+1 -1
View File
@@ -17,7 +17,7 @@ func deleteLinuxPackFiles(appDirBase string) {
os.RemoveAll(appDir)
}
func packageLinuxApplication(options *Options) error {
func packageApplication(options *Options) error {
// Check we have AppImage tools