impl

package
v0.1.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFile     = "exwrap.json"
	DefaultBuildDirectory = "build"
	AppArchiveName        = "app.zip"
	DarwinAppArchiveName  = "app.app"
	DarwinAppLockfile     = ".exdarwin"
	AppEmbedExeName       = "embed"
	EmbededArchiveName    = "archive"
	EmbededSetupScript    = "setup"
	EmbededLaunchScript   = "launch"
	TmpExtractDir         = ".exwraptmp"
	WinTmpExtractDir      = "~exwraptmp"
	ExtractDstDir         = "tmp"
	ExtractDstFile        = "app.zip"
)

Variables

View Source
var BuildCombinations = map[OSArch]OsArchInfo{
	{"aix", "ppc64"}:       {CgoSupported: true},
	{"android", "386"}:     {CgoSupported: true},
	{"android", "amd64"}:   {CgoSupported: true},
	{"android", "arm"}:     {CgoSupported: true},
	{"android", "arm64"}:   {CgoSupported: true},
	{"darwin", "amd64"}:    {CgoSupported: true, FirstClass: true},
	{"darwin", "arm64"}:    {CgoSupported: true, FirstClass: true},
	{"dragonfly", "amd64"}: {CgoSupported: true},
	{"freebsd", "386"}:     {CgoSupported: true},
	{"freebsd", "amd64"}:   {CgoSupported: true},
	{"freebsd", "arm"}:     {CgoSupported: true},
	{"freebsd", "arm64"}:   {CgoSupported: true},
	{"freebsd", "riscv64"}: {CgoSupported: true},
	{"illumos", "amd64"}:   {CgoSupported: true},
	{"ios", "amd64"}:       {CgoSupported: true},
	{"ios", "arm64"}:       {CgoSupported: true},
	{"js", "wasm"}:         {},
	{"linux", "386"}:       {CgoSupported: true, FirstClass: true},
	{"linux", "amd64"}:     {CgoSupported: true, FirstClass: true},
	{"linux", "arm"}:       {CgoSupported: true, FirstClass: true},
	{"linux", "arm64"}:     {CgoSupported: true, FirstClass: true},
	{"linux", "loong64"}:   {CgoSupported: true},
	{"linux", "mips"}:      {CgoSupported: true},
	{"linux", "mips64"}:    {CgoSupported: true},
	{"linux", "mips64le"}:  {CgoSupported: true},
	{"linux", "mipsle"}:    {CgoSupported: true},
	{"linux", "ppc64"}:     {},
	{"linux", "ppc64le"}:   {CgoSupported: true},
	{"linux", "riscv64"}:   {CgoSupported: true},
	{"linux", "s390x"}:     {CgoSupported: true},
	{"linux", "sparc64"}:   {CgoSupported: true, Broken: true},
	{"netbsd", "386"}:      {CgoSupported: true},
	{"netbsd", "amd64"}:    {CgoSupported: true},
	{"netbsd", "arm"}:      {CgoSupported: true},
	{"netbsd", "arm64"}:    {CgoSupported: true},
	{"openbsd", "386"}:     {CgoSupported: true},
	{"openbsd", "amd64"}:   {CgoSupported: true},
	{"openbsd", "arm"}:     {CgoSupported: true},
	{"openbsd", "arm64"}:   {CgoSupported: true},
	{"openbsd", "mips64"}:  {CgoSupported: true, Broken: true},
	{"openbsd", "ppc64"}:   {},
	{"openbsd", "riscv64"}: {Broken: true},
	{"plan9", "386"}:       {},
	{"plan9", "amd64"}:     {},
	{"plan9", "arm"}:       {},
	{"solaris", "amd64"}:   {CgoSupported: true},
	{"wasip1", "wasm"}:     {},
	{"windows", "386"}:     {CgoSupported: true, FirstClass: true},
	{"windows", "amd64"}:   {CgoSupported: true, FirstClass: true},
	{"windows", "arm"}:     {},
	{"windows", "arm64"}:   {CgoSupported: true},
}

Functions

func Embed

func Embed(base string, destination string, attachments map[string]string) error

func FileExists

func FileExists(filename string) bool

func Generate

func Generate(config Config, cmd CommandLine) string

func GenerateDarwin

func GenerateDarwin(config Config, cmd CommandLine) string

func GenerateDefault

func GenerateDefault(config Config, cmd CommandLine) string

func GetAbsoluteCommandProgram

func GetAbsoluteCommandProgram(cmd string, isDarwin bool) string

func GetAppDir

func GetAppDir() string

func GetAppName

func GetAppName() string

func GetInstallDir

func GetInstallDir(installPath string) string

func GetInstallExtractDir

func GetInstallExtractDir() string

func GetInstallExtractFile

func GetInstallExtractFile() string

func GetLaunchCommand

func GetLaunchCommand(installPath string) []string

func GetLaunchScript

func GetLaunchScript(installPath string) string

func GetSelfInstallExtractFile

func GetSelfInstallExtractFile() string

func RemoveEmbed

func RemoveEmbed(base string, destination string) error

func Unzip

func Unzip(src, dest string) error

Types

type CommandLine

type CommandLine struct {
	ConfigFile     string
	BuildDirectory string
}

type Config

type Config struct {
	// The root of the entire application.
	// Defaults to the current working directory.
	Root string `json:"root,omitempty"`

	// The entry point describes the command to run when
	// the executable starts. For example, ["python", "app.py"]
	EntryPoint []string `json:"entry_point"`

	// The name of the final executable.
	// Defaults to the name of the root folder.
	TargetName string `json:"target_name,omitempty"`

	// A list of commands to be run in order before installation begins
	PostInstallCommands []string `json:"post_install_cmds,omitempty"`

	// A list of commands to be run in order after installation completes.
	PreInstallCommands []string `json:"pre_install_cmds,omitempty"`

	// The OS on which exwrap is being run on (Defaults to your OS)
	SourceOs string `json:"source_os,omitempty"`

	// The processor architecture on which exwrap is being run on.
	// Defaults to your processor architecture
	SourceArch string `json:"source_arch,omitempty"`

	// The OS for which you are generating an executable for.
	// Defaults to your OS.
	TargetOs string `json:"os,omitempty"`

	// The processor architecture for which you are generating an
	// executable for.
	// Defaults to your processor architecture.
	TargetArch string `json:"arch,omitempty"`

	// A key/value pair that tells exwrap to replace any path the
	// matches or starts with the pattern indicated in the value
	// with the one indicated in the key.
	// In the format "override => match"
	PathOverrides map[string]string `json:"path_overrides,omitempty"`

	// Extra directories to add to the final executable.
	// In the format "source => destination"
	ExtraDirectories map[string]string `json:"extra_dirs"`

	// Extra files to add to the final executable.
	// In the format "source => destination"
	ExtraFiles map[string]string `json:"extra_files"`

	// A list of directories to not add to the final executable.
	ExcludeDirectories []string `json:"exclude_dirs"`

	// A list of files to not add to the final executable.
	ExcludeFiles []string `json:"exclude_files"`

	// The path that the final executable should be installed on.
	//
	// It is advisable that the install path should be a relative path.
	// On windows, it is relative to C:\Program Files\,
	// On Unix, it is relative to /home/$USERNAME/.
	// If empty, it defaults to the app name.
	// If an absolute path is given, it's used as is.
	InstallPath string `json:"install_path,omitempty"`

	// List of files that must be granted execute permission
	// when installation is extracted.
	Executables []string `json:"executables,omitempty"`

	// The application icon. This path should omit the extension as
	// exwrap will add the appropriate extension to the file.
	// Best practice is to have the icon in .icns (MacOS),
	// .ico (Windows), and .svg (Linux) format in a directory with
	// the same name
	Icon string `json:"icon,omitempty"`

	// Darwin (MacOS) specific configurations.
	Darwin DarwinConfig `json:"mac_os,omitempty"`
}

func LoadConfig

func LoadConfig(cmd CommandLine) Config

func LoadDefaultConfig

func LoadDefaultConfig() Config

type DarwinConfig

type DarwinConfig struct {
	// Allows user to point to their own plist file for macos.
	PlistFile string `json:"plist,omitempty"`

	// When true, exwrap generates and app bundle instead of an installer.
	// Default: false
	CreateApp bool `json:"create_app,omitempty"`
}

MacOS specific configuration

type LaunchScript

type LaunchScript struct {
	EntryPoint []string `json:"entrypoint"`
}

type OSArch

type OSArch struct {
	GOOS, GOARCH string
}

type OsArchInfo

type OsArchInfo struct {
	CgoSupported bool
	FirstClass   bool
	Broken       bool
}

type SetupScript

type SetupScript struct {
	InstallDirectory    string   `json:"install_dir"`
	ExeName             string   `json:"exe_name"`
	Executables         []string `json:"executables"`
	PreInstallCommands  []string `json:"pre_install_cmds"`
	PostInstallCommands []string `json:"post_install_cmds"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL