Mike suggested that compiling all the Go programs into one executable à la BusyBox could save space because there would be only one static copy of the Go runtime.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Here's a script that generates a multi-executable from Go programs. I tested it on obfs4proxy, meek-client, meek-client-torbrowser, and the new tor-fw-helper (#13338 (moved)). With these four programs, bundling saves this much in the linux build:
uncompressed: saves 10 MB (16 MB goes to 5.8 MB)
compressed: saves 0.7 MB (2.0 MB goes to 1.3 MB)
mkmulti is a shell script. Run it like this to create the source for a multi-executable:
export GOPATH=~/goPROGS="git.torproject.org/pluggable-transports/obfs4.git/obfs4proxy git.torproject.org/pluggable-transports/meek.git/meek-client git.torproject.org/pluggable-transports/meek.git/meek-client-torbrowser github.com/yawning/tor-fw-helper"go get -d $PROGS./mkmulti multi $PROGS
The script writes a source file to multi/multi.go. Build it using the same flags we use in tor-browser-bundle.
cd multigo build -ldflags '-s'
This is the multi-executable:
5992352 (5.8M) multi
And these are the constituent programs compiled separately:
On linux and mac, we can use symbolic links to the executable. I don't know what is done on Windows. Maybe batch files, or stub programs that change argv[0] and then exec?
On linux and mac, we can use symbolic links to the executable. I don't know what is done on Windows. Maybe batch files, or stub programs that change argv[0] and then exec?
NTFS kind of sort of has symlinks but assuming that the target filesystem is NTFS instead of FAT32/exFAT will end in tears.
How about adding code to the begining of main() that:
Looks at os.Args[1] for --progname=<name> (Do this manually, and not with the flag package.)
If present (and name in progName), do something like:
{{{
// Rewrite argv[0], and strip out progname from the arguments, so that using the
// 'flag' package doesn't break.
newArgs := make([]string, 0, 1 + len(os.Args) - 2)
newArgs = append(newArgs, progName)
if len(os.Args) > 2 {
newArgs = append(newArgs, os.Args[2:]...)
}
os.Args = newArgs
}}}
Edit the Windows torrc as appropriate. It's a bit kludgey, but it probably beats batchfiles and stub executables, and it's relatively robust, and having that there is relatively harmless across all platforms (assuming that missing argument is treated as a non-fatal error).
On linux and mac, we can use symbolic links to the executable. I don't know what is done on Windows. Maybe batch files, or stub programs that change argv[0] and then exec?
NTFS kind of sort of has symlinks but assuming that the target filesystem is NTFS instead of FAT32/exFAT will end in tears.
How about adding code to the begining of main() that:
Looks at os.Args[1] for --progname=<name> (Do this manually, and not with the flag package.)
Or just always switch on argv[1], and ignore argv[0]. For example,