Skip to content

Commit

Permalink
Merge pull request #6 from lucor/feature/freebsd-package
Browse files Browse the repository at this point in the history
Add support for creating packaged .tar.gz bundles on freebsd
  • Loading branch information
lucor committed Nov 18, 2020
2 parents c918ed4 + 9bb2a43 commit e3c1710
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/command/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ func fynePackage(ctx Context) error {
workDir = volume.JoinPathContainer(workDir, ctx.Package)
}

// set executable flag for linux and darwin targets
if ctx.OS == linuxOS || ctx.OS == darwinOS {
// linux, darwin and freebsd targets are built by fyne-cross
// in these cases fyne tool is used only to package the app specifying the executable flag
if ctx.OS == linuxOS || ctx.OS == darwinOS || ctx.OS == freebsdOS {
args = append(args, "-executable", volume.JoinPathContainer(ctx.BinDirContainer(), ctx.ID, ctx.Output))
workDir = volume.JoinPathContainer(ctx.TmpDirContainer(), ctx.ID)
}
Expand Down
32 changes: 31 additions & 1 deletion internal/command/freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ package command

import (
"fmt"
"os"
"path/filepath"
"runtime"

"github.com/fyne-io/fyne-cross/internal/log"
"github.com/fyne-io/fyne-cross/internal/volume"
)

const (
Expand Down Expand Up @@ -98,7 +101,34 @@ func (cmd *FreeBSD) Run() error {
//
// package
//
log.Infof("[!] Packaging for %s not implemented yet", ctx.OS)
log.Info("[i] Packaging app...")

packageName := fmt.Sprintf("%s.tar.gz", ctx.Output)

err = prepareIcon(ctx)
if err != nil {
return err
}

err = fynePackage(ctx)
if err != nil {
return fmt.Errorf("could not package the Fyne app: %v", err)
}

// move the dist package into the "dist" folder
srcFile := volume.JoinPathHost(ctx.TmpDirHost(), ctx.ID, packageName)
distFile := volume.JoinPathHost(ctx.DistDirHost(), ctx.ID, packageName)
err = os.MkdirAll(filepath.Dir(distFile), 0755)
if err != nil {
return fmt.Errorf("could not create the dist package dir: %v", err)
}

err = os.Rename(srcFile, distFile)
if err != nil {
return err
}

log.Infof("[✓] Package: %s", distFile)
}

return nil
Expand Down

0 comments on commit e3c1710

Please sign in to comment.