Skip to content

Commit fb103e4

Browse files
author
jld3103
authored
Merge pull request #168 from go-flutter-desktop/improved-packaging-tools-instructions
Improve missing packaging tools instructions
2 parents c69cb58 + b71e3ae commit fb103e4

File tree

16 files changed

+108
-37
lines changed

16 files changed

+108
-37
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ RUN sed -i "s/#XferCommand/XferCommand/g" /etc/pacman.conf
101101
# This makes makepkg believe we are not root. Bypassing the root check is ok, because we are in a container
102102
ENV EUID=1
103103

104+
# Create symlink for darwin-dmg
105+
RUN ln -s $(which genisoimage) /usr/bin/mkisofs
106+
104107
COPY --from=flutterbuilder /opt/flutter /opt/flutter
105108
RUN ln -sf /opt/flutter/bin/flutter /usr/bin/flutter
106109

cmd/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ func subcommandBuild(targetOS string, packagingTask packaging.Task, vmArguments
245245
buildGoBinary(targetOS, vmArguments)
246246
}
247247
if packagingTask != packaging.NoopTask {
248-
log.Infof("Packaging app for %s-%s", targetOS, packagingTask.Name())
248+
log.Infof("Packaging app for %s", packagingTask.Name())
249249
packagingTask.Pack(buildVersionNumber, buildOrRunMode)
250-
log.Infof("Successfully packaged app for %s-%s", targetOS, packagingTask.Name())
250+
log.Infof("Successfully packaged app for %s", packagingTask.Name())
251251
}
252252
}
253253
}

cmd/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func dockerHoverBuild(targetOS string, packagingTask packaging.Task, buildFlags
9292
dockerArgs = append(dockerArgs, dockerImage)
9393
targetOSAndPackaging := targetOS
9494
if packName := packagingTask.Name(); packName != "" {
95-
targetOSAndPackaging += "-" + packName
95+
targetOSAndPackaging = packName
9696
}
9797
hoverCommand := []string{"hover-safe.sh", "build", targetOSAndPackaging}
9898
hoverCommand = append(hoverCommand, buildFlags...)

cmd/doctor.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/spf13/cobra"
1414
"gopkg.in/yaml.v2"
1515

16+
"github.com/go-flutter-desktop/hover/cmd/packaging"
1617
"github.com/go-flutter-desktop/hover/internal/build"
1718
"github.com/go-flutter-desktop/hover/internal/config"
1819
"github.com/go-flutter-desktop/hover/internal/log"
@@ -38,6 +39,24 @@ var doctorCmd = &cobra.Command{
3839
hoverVersion := version.HoverVersion()
3940
log.Infof("Hover version %s running on %s", hoverVersion, runtime.GOOS)
4041

42+
log.Infof("Sharing packaging tools")
43+
for _, task := range []packaging.Task{
44+
packaging.DarwinBundleTask,
45+
packaging.DarwinDmgTask,
46+
packaging.DarwinPkgTask,
47+
packaging.LinuxAppImageTask,
48+
packaging.LinuxDebTask,
49+
packaging.LinuxPkgTask,
50+
packaging.LinuxRpmTask,
51+
packaging.LinuxSnapTask,
52+
packaging.WindowsMsiTask,
53+
} {
54+
if task.IsSupported() {
55+
log.Infof("%s is supported", task.Name())
56+
}
57+
}
58+
log.Printf("")
59+
4160
log.Infof("Sharing flutter version")
4261
cmdFlutterVersion := exec.Command(build.FlutterBin(), "--version")
4362
cmdFlutterVersion.Stderr = os.Stderr

cmd/packaging/darwin-bundle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var DarwinBundleTask = &packagingTask{
4848

4949
return outputFileName, nil
5050
},
51-
requiredTools: map[string][]string{
51+
requiredTools: map[string]map[string]string{
5252
"linux": {},
5353
"darwin": {},
5454
"windows": {},

cmd/packaging/darwin-dmg.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,31 @@ var DarwinDmgTask = &packagingTask{
3131
return "", err
3232
}
3333

34-
var cmdGenisoimage *exec.Cmd
34+
var cmdCreateBundle *exec.Cmd
3535
switch os := runtime.GOOS; os {
3636
case "darwin":
37-
cmdGenisoimage = exec.Command("hdiutil", "create", "-volname", packageName, "-srcfolder", "dmgdir", "-ov", "-format", "UDBZ", outputFileName)
37+
cmdCreateBundle = exec.Command("hdiutil", "create", "-volname", packageName, "-srcfolder", "dmgdir", "-ov", "-format", "UDBZ", outputFileName)
3838
case "linux":
39-
cmdGenisoimage = exec.Command("genisoimage", "-V", packageName, "-D", "-R", "-apple", "-no-pad", "-o", outputFileName, "dmgdir")
39+
cmdCreateBundle = exec.Command("mkisofs", "-V", packageName, "-D", "-R", "-apple", "-no-pad", "-o", outputFileName, "dmgdir")
4040
}
41-
cmdGenisoimage.Dir = tmpPath
42-
cmdGenisoimage.Stdout = os.Stdout
43-
cmdGenisoimage.Stderr = os.Stderr
44-
err = cmdGenisoimage.Run()
41+
cmdCreateBundle.Dir = tmpPath
42+
cmdCreateBundle.Stdout = os.Stdout
43+
cmdCreateBundle.Stderr = os.Stderr
44+
err = cmdCreateBundle.Run()
4545
if err != nil {
4646
return "", err
4747
}
4848
return outputFileName, nil
4949
},
5050
skipAssertInitialized: true,
51-
requiredTools: map[string][]string{
52-
"linux": {"ln", "genisoimage"},
53-
"darwin": {"ln", "hdiutil"},
51+
requiredTools: map[string]map[string]string{
52+
"linux": {
53+
"ln": "Install ln from your package manager",
54+
"mkisofs": "Install mkisofs from your package manager. Some distros ship genisoimage which is a fork of mkisofs. Create a symlink for it like this: ln -s $(which genisoimage) /usr/bin/mkisofs",
55+
},
56+
"darwin": {
57+
"ln": "Install ln from your package manager",
58+
"hdiutil": "Install hdiutil from your package manager",
59+
},
5460
},
5561
}

cmd/packaging/darwin-pkg.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,20 @@ var DarwinPkgTask = &packagingTask{
115115
}
116116
return outputFileName, nil
117117
},
118-
requiredTools: map[string][]string{
119-
"linux": {"find", "cpio", "gzip", "mkbom", "xar"},
120-
"darwin": {"find", "cpio", "gzip", "mkbom", "xar"},
118+
requiredTools: map[string]map[string]string{
119+
"linux": {
120+
"find": "Install find from your package manager",
121+
"cpio": "Install cpio from your package manager",
122+
"gzip": "Install gzip from your package manager",
123+
"mkbom": "Install bomutils from your package manager or from https://github.com/hogliux/bomutils",
124+
"xar": "Install xar from your package manager or from https://github.com/mackyle/xar",
125+
},
126+
"darwin": {
127+
"find": "Install find from your package manager",
128+
"cpio": "Install cpio from your package manager",
129+
"gzip": "Install gzip from your package manager",
130+
"mkbom": "Install bomutils from your package manager or from https://github.com/hogliux/bomutils",
131+
"xar": "Install xar from your package manager or from https://github.com/mackyle/xar",
132+
},
121133
},
122134
}

cmd/packaging/linux-appimage.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ var LinuxAppImageTask = &packagingTask{
6161
}
6262
return fmt.Sprintf("%s-%s-x86_64.AppImage", strings.ReplaceAll(applicationName, " ", "_"), version), nil
6363
},
64-
requiredTools: map[string][]string{
65-
"linux": {"appimagetool"},
64+
requiredTools: map[string]map[string]string{
65+
"linux": {
66+
"appimagetool": "Install appimagetool from your package manager or from https://github.com/AppImage/AppImageKit#appimagetool-usage",
67+
},
6668
},
6769
}

cmd/packaging/linux-deb.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ var LinuxDebTask = &packagingTask{
3333
}
3434
return outputFileName, nil
3535
},
36-
requiredTools: map[string][]string{
37-
"linux": {"dpkg-deb"},
36+
requiredTools: map[string]map[string]string{
37+
"linux": {
38+
"makepkg": "You need to be on Debian, Ubuntu or another distro that uses apt/dpkg as package manager to use this. Installing dpkg on other distros is hard and dangerous.",
39+
},
3840
},
3941
}

cmd/packaging/linux-pkg.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ var LinuxPkgTask = &packagingTask{
3434
}
3535
return fmt.Sprintf("%s-%s-%s-x86_64%s", packageName, version, release, extension), nil
3636
},
37-
requiredTools: map[string][]string{
38-
"linux": {"makepkg"},
37+
requiredTools: map[string]map[string]string{
38+
"linux": {
39+
"makepkg": "You need to be on Arch Linux or another distro that uses pacman as package manager to use this. Installing makepkg on other distros is hard and dangerous.",
40+
},
3941
},
4042
}

0 commit comments

Comments
 (0)