Skip to content

Commit

Permalink
chore: sync with ooni/probe-cli@5c50be42
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Nov 20, 2023
1 parent b8025d7 commit 83ad31a
Show file tree
Hide file tree
Showing 108 changed files with 4,218 additions and 2,933 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20.8"
go-version: "1.20.10"
- run: go build ./...
2 changes: 1 addition & 1 deletion UPSTREAM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.19.0-alpha-1-gca2019be
v3.19.0-alpha-35-g5c50be42
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ require (
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
github.com/cloudflare/circl v1.3.3
github.com/cretz/bine v0.2.0
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/google/gopacket v1.1.19
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gorilla/websocket v1.5.0
github.com/hexops/gotextdiff v1.0.3
github.com/miekg/dns v1.1.56
github.com/montanaflynn/stats v0.7.1
github.com/ooni/go-libtor v1.1.8
github.com/ooni/netem v0.0.0-20230920215742-15f3ffec0107
github.com/ooni/oocrypto v0.5.4
github.com/ooni/oohttp v0.6.4
github.com/ooni/oocrypto v0.5.5
github.com/ooni/oohttp v0.6.5
github.com/ooni/probe-assets v0.19.0
github.com/pborman/getopt/v2 v2.1.0
github.com/pion/stun v0.6.1
Expand All @@ -34,7 +33,7 @@ require (
gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib v1.5.0
gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2 v2.6.1
golang.org/x/crypto v0.14.0
golang.org/x/net v0.16.0
golang.org/x/net v0.17.0
golang.org/x/sys v0.13.0
)

Expand Down Expand Up @@ -138,9 +137,9 @@ require (
github.com/xtaci/kcp-go/v5 v5.6.2 // indirect
github.com/xtaci/smux v1.5.24 // indirect
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
30 changes: 13 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/cretz/bine v0.1.0/go.mod h1:6PF6fWAvYtwjRGkAuDEJeWNOv3a2hUouSP/yRYXmvHw=
github.com/cretz/bine v0.2.0 h1:8GiDRGlTgz+o8H9DSnsl+5MeBK4HsExxgl6WgzOCuZo=
github.com/cretz/bine v0.2.0/go.mod h1:WU4o9QR9wWp8AVKtTM1XD5vUHkEqnf2vVSo6dBqbetI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -149,8 +148,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 h1:pUa4ghanp6q4IJHwE9RwLgmVFfReJN+KbQ8ExNEUUoQ=
Expand Down Expand Up @@ -304,14 +303,12 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/ooni/go-libtor v1.1.8 h1:Wo3V3DVTxl5vZdxtQakqYP+DAHx7pPtAFSl1bnAa08w=
github.com/ooni/go-libtor v1.1.8/go.mod h1:q1YyLwRD9GeMyeerVvwc0vJ2YgwDLTp2bdVcrh/JXyI=
github.com/ooni/netem v0.0.0-20230920215742-15f3ffec0107 h1:PktaCPQ1NYZOaK+J8pQGYiPCYFkGR5H3ZURg9zPkQsI=
github.com/ooni/netem v0.0.0-20230920215742-15f3ffec0107/go.mod h1:5X3Lk4+cnrwrQiYgRlCWXgV33IMDgLaO5s1x0DD/fO0=
github.com/ooni/oocrypto v0.5.4 h1:/AkVZd+aq54+OXgOtWEmK8xgZsFQtlmtPf2VgY20YWw=
github.com/ooni/oocrypto v0.5.4/go.mod h1:HjEQ5pQBl6btcWgAsKKq1tFo8CfBrZu63C/vPAUGIDk=
github.com/ooni/oohttp v0.6.4 h1:QZyOO4e88AzLOHGTgapXmsjtn1EVR7Wl+BtHd8okIf4=
github.com/ooni/oohttp v0.6.4/go.mod h1:RipdYAUiw1UTnpm0ISd0r1Kiv/CGaRUgn08xbK1JgVo=
github.com/ooni/oocrypto v0.5.5 h1:x0wIgtBfghVu8Ok0tR/xVyfHlo646hN1LB/5bzuXcIg=
github.com/ooni/oocrypto v0.5.5/go.mod h1:HjEQ5pQBl6btcWgAsKKq1tFo8CfBrZu63C/vPAUGIDk=
github.com/ooni/oohttp v0.6.5 h1:hjMnX2fGNHYHqh1JmfxoTfnN9JmdgT0fa6yIEjoYhG8=
github.com/ooni/oohttp v0.6.5/go.mod h1:RipdYAUiw1UTnpm0ISd0r1Kiv/CGaRUgn08xbK1JgVo=
github.com/ooni/probe-assets v0.19.0 h1:XloDJQt6uxn6EYVwfWCOnlgsJZbmzO7VPFsJ8RPW8Ns=
github.com/ooni/probe-assets v0.19.0/go.mod h1:m0k2FFzcLfFm7dhgyYkLCUR3R0CoRPr0jcjctDS2+gU=
github.com/oschwald/geoip2-golang v1.9.0 h1:uvD3O6fXAXs+usU+UGExshpdP13GAqp4GBrzN7IgKZc=
Expand Down Expand Up @@ -530,7 +527,6 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down Expand Up @@ -568,8 +564,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand All @@ -596,8 +592,8 @@ golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -606,7 +602,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -698,8 +694,8 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
17 changes: 17 additions & 0 deletions pkg/checkincache/checkincache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package checkincache

import (
"encoding/json"
"fmt"
"time"

"github.com/ooni/probe-engine/pkg/model"
Expand All @@ -25,6 +26,9 @@ type checkInFlagsWrapper struct {
}

// Store stores the result of the latest check-in in the given key-value store.
//
// We store check-in feature flags in a file called checkinflags.state. These flags
// are valid for 24 hours, after which we consider them stale.
func Store(kvStore model.KeyValueStore, resp *model.OOAPICheckInResult) error {
// store the check-in flags in the key-value store
wrapper := &checkInFlagsWrapper{
Expand Down Expand Up @@ -52,3 +56,16 @@ func GetFeatureFlag(kvStore model.KeyValueStore, name string) bool {
}
return wrapper.Flags[name] // works even if map is nil
}

// ExperimentEnabledKey returns the [model.KeyValueStore] key to use to
// know whether a disabled experiment has been enabled via check-in.
func ExperimentEnabledKey(name string) string {
return fmt.Sprintf("%s_enabled", name)
}

// ExperimentEnabled returns whether a given experiment has been enabled by a previous
// execution of check-in. Some experiments are disabled by default for different reasons
// and we use the check-in API to control whether and when they should be enabled.
func ExperimentEnabled(kvStore model.KeyValueStore, name string) bool {
return GetFeatureFlag(kvStore, ExperimentEnabledKey(name))
}
84 changes: 46 additions & 38 deletions pkg/cmd/buildtool/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,57 @@ func androidSubcommand() *cobra.Command {
Use: "android",
Short: "Builds ooniprobe, miniooni, and oonimkall for android",
}

cmd.AddCommand(&cobra.Command{
Use: "gomobile",
Short: "Builds oonimkall for android using gomobile",
Run: func(cmd *cobra.Command, args []string) {
// Implementation note: perform the check here such that we can
// run unit test for the building code from any system
runtimex.Assert(
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)
androidBuildGomobile(&buildDeps{})
},
})

cmd.AddCommand(&cobra.Command{
Use: "cli",
Short: "Builds ooniprobe and miniooni for usage within termux",
Run: func(cmd *cobra.Command, args []string) {
// Implementation note: perform the check here such that we can
// run unit test for the building code from any system
runtimex.Assert(
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)
androidBuildCLIAll(&buildDeps{})
},
})

cmd.AddCommand(&cobra.Command{
Use: "cdeps {zlib|openssl|libevent|tor} [zlib|openssl|libevent|tor...]",
Use: "cdeps [zlib|openssl|libevent|tor...]",
Short: "Cross compiles C dependencies for Android",
Run: func(cmd *cobra.Command, args []string) {
for _, arg := range args {
// Implementation note: perform the check here such that we can
// run unit test for the building code from any system
runtimex.Assert(
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)
androidCdepsBuildMain(arg, &buildDeps{})
}
},
Args: cobra.MinimumNArgs(1),
})

return cmd
}

// androidBuildGomobile invokes the gomobile build.
func androidBuildGomobile(deps buildtoolmodel.Dependencies) {
runtimex.Assert(
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)

deps.PsiphonMaybeCopyConfigFiles()
deps.GolangCheck()

Expand Down Expand Up @@ -128,11 +145,6 @@ func androidNDKCheck(androidHome string) string {

// androidBuildCLIAll builds all products in CLI mode for Android
func androidBuildCLIAll(deps buildtoolmodel.Dependencies) {
runtimex.Assert(
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)

deps.PsiphonMaybeCopyConfigFiles()
deps.GolangCheck()

Expand Down Expand Up @@ -161,7 +173,7 @@ func androidBuildCLIProductArch(
androidHome string,
ndkDir string,
) {
cgo := newAndroidCBuildEnv(androidHome, ndkDir, ooniArch)
cgo := androidNewCBuildEnv(androidHome, ndkDir, ooniArch)

log.Infof("building %s for android/%s", product.Pkg, ooniArch)

Expand Down Expand Up @@ -203,33 +215,33 @@ func androidBuildCLIProductArch(
runtimex.Try0(shellx.RunEx(defaultShellxConfig(), argv, envp))
}

// newAndroidCBuildEnv creates a new [cBuildEnv] for the
// androidNewCBuildEnv creates a new [cBuildEnv] for the
// given ooniArch ("arm", "arm64", "386", "amd64").
func newAndroidCBuildEnv(androidHome, ndkDir, ooniArch string) *cBuildEnv {
func androidNewCBuildEnv(androidHome, ndkDir, ooniArch string) *cBuildEnv {
binpath := androidNDKBinPath(ndkDir)
destdir := runtimex.Try1(filepath.Abs(filepath.Join( // must be absolute
"internal", "libtor", "android", ooniArch,
)))
out := &cBuildEnv{
ANDROID_HOME: androidHome,
ANDROID_NDK_ROOT: ndkDir,
AS: "", // later
AR: filepath.Join(binpath, "llvm-ar"),
BINPATH: binpath,
CC: "", // later
CFLAGS: androidCflags(ooniArch),
CONFIGURE_HOST: "", // later
DESTDIR: destdir,
CXX: "", // later
CXXFLAGS: androidCflags(ooniArch),
GOARCH: ooniArch,
GOARM: "", // maybe later
LD: filepath.Join(binpath, "ld"),
LDFLAGS: []string{}, // empty
OPENSSL_API_DEFINE: "-D__ANDROID_API__=21",
OPENSSL_COMPILER: "", // later
RANLIB: filepath.Join(binpath, "llvm-ranlib"),
STRIP: filepath.Join(binpath, "llvm-strip"),
ANDROID_HOME: androidHome,
ANDROID_NDK_ROOT: ndkDir,
AS: "", // later
AR: filepath.Join(binpath, "llvm-ar"),
BINPATH: binpath,
CC: "", // later
CFLAGS: androidCflags(ooniArch),
CONFIGURE_HOST: "", // later
DESTDIR: destdir,
CXX: "", // later
CXXFLAGS: androidCflags(ooniArch),
GOARCH: ooniArch,
GOARM: "", // maybe later
LD: filepath.Join(binpath, "ld"),
LDFLAGS: []string{}, // empty
OPENSSL_COMPILER: "", // later
OPENSSL_POST_COMPILER_FLAGS: []string{"-D__ANDROID_API__=21"},
RANLIB: filepath.Join(binpath, "llvm-ranlib"),
STRIP: filepath.Join(binpath, "llvm-strip"),
}
switch ooniArch {
case "arm":
Expand Down Expand Up @@ -375,10 +387,6 @@ func androidNDKBinPath(ndkDir string) string {

// androidCdepsBuildMain builds C dependencies for android.
func androidCdepsBuildMain(name string, deps buildtoolmodel.Dependencies) {
runtimex.Assert(
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)
androidHome := deps.AndroidSDKCheck()
ndkDir := deps.AndroidNDKCheck(androidHome)
archs := []string{"arm", "arm64", "386", "amd64"}
Expand All @@ -395,7 +403,7 @@ func androidCdepsBuildArch(
ndkDir string,
name string,
) {
cdenv := newAndroidCBuildEnv(androidHome, ndkDir, arch)
cdenv := androidNewCBuildEnv(androidHome, ndkDir, arch)
switch name {
case "libevent":
cdepsLibeventBuildMain(cdenv, deps)
Expand Down
Loading

0 comments on commit 83ad31a

Please sign in to comment.