[tor-bugs] #13770 [Tor Browser]: BusyBox-style bundling of Go programs can save space

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Nov 15 19:08:36 UTC 2014


#13770: BusyBox-style bundling of Go programs can save space
-----------------------------+----------------------
     Reporter:  dcf          |      Owner:  tbb-team
         Type:  enhancement  |     Status:  new
     Priority:  normal       |  Milestone:
    Component:  Tor Browser  |    Version:
   Resolution:               |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+----------------------

Comment (by dcf):

 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). 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)

 attachment:mkmulti is a shell script. Run it like this to create the
 source for a multi-executable:
 {{{
 export GOPATH=~/go
 PROGS="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 multi
 go build -ldflags '-s'
 }}}

 This is the multi-executable:
 {{{
  5992352 (5.8M) multi
 }}}
 And these are the constituent programs compiled separately:
 {{{
  4531488 (4.4M) meek-client
  2090368 (2.0M) meek-client-torbrowser
  5074976 (4.9M) obfs4proxy
  4603264 (4.5M) tor-fw-helper
 ---------------------
 16300096  (16M) total
 }}}
 Here are the compressed sizes:
 {{{
  1263988 (1.3M) multi.tar.xz
  2013728 (2.0M) separate.tar.xz
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13770#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list