7zplugin

command module
v0.0.0-...-2f76ca4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Command 7zplugin compiles a plugin DLL with the specified plugin packages named by their import paths.

This exists to allow arbitrary plugin choices to be easily built together since there can only be one Go runtime in a process, so only one plugin DLL built using 7zplugin can be used and must contain all desired plugins.

The arch argument must be set to one of:

  • 64 64-bit x86 (CGO_ENABLED=1 GOOS=windows GOARCH=amd64)
  • 32 32-bit x86_64 (CGO_ENABLED=1 GOOS=windows GOARCH=386)
  • A64 64-bit arm (CGO_ENABLED=1 GOOS=windows GOARCH=arm64)

Specify environment variables for go build (CC, CXX, etc) as arguments before the flags.

Flags are passed as-is to go build (see go help build). The only flag explicitly set by this package is -buildmode=c-shared. It is highly recommended to also set -ldflags '-s -w -extldflags=-static'.

Version information is added to the built binary:

  • FileDescription is set to a list of packages/files used to build the plugin.
  • FileVersion is set to YYYY.MM.DD.0 based on the current date, or the unix timestamp in SOURCE_DATE_EPOCH. If GITHUB_ACTION is set, GITHUB_RUN_NUMBER is used as the last component.
  • InternalName is set to the default output dll basename.
  • OriginalFilename is set based on InternalName and the architecture.
  • ProductName describes this library.
  • ProductVersion describes the target 7-Zip version and architecture.

An example invocation of this command to build all default plugins (from within the 7zplugin source dir):

CC=x86_64-w64-mingw32-gcc go run . 64 -ldflags '-s -w -extldflags=-static' -trimpath -v -x ./plugins/...

If using 7zplugin as a library, you can build the default plugins combined with your plugin like:

CC=x86_64-w64-mingw32-gcc go run github.com/pg9182/7zplugin 64 -ldflags '-s -w -extldflags=-static' -trimpath -v -x github.com/pg9182/7zplugin/plugins/...  ./pluginpkg1 ./pluginpkg2

Each plugin package or file should contain an init() function which calls z7plugin.RegisterArc (or imports packages which do).

The built DLL file should be installed to the Formats directory beside the 7-Zip executable. The architecture must match that of 7-Zip.

Directories

Path Synopsis
plugins
tf2vpk
Package tf2vpk is a 7-Zip archive format plugin for Respawn VPKs as used in Titanfall 2.
Package tf2vpk is a 7-Zip archive format plugin for Respawn VPKs as used in Titanfall 2.
Package winext is like github.com/lxn/win, but has some additional functions.
Package winext is like github.com/lxn/win, but has some additional functions.
Package z7 contains a subset of definitions from the 7-Zip headers.
Package z7 contains a subset of definitions from the 7-Zip headers.
Package z7plugin implements 7-Zip's plugin interface.
Package z7plugin implements 7-Zip's plugin interface.

Jump to

Keyboard shortcuts

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