Use MK v0.10.x, zap legacy GeoIP, build also on Linux (#29)

* Gopkg.lock: use MK v0.10.3

* ooni: stop using legacy GeoIP database files

* Some yak shaving of Makefile

1. remove now broken commands to download deps

2. also define the CXX cross compiler

* chore(dep): migrate from dep to go 1.11+ modules

See https://blog.callr.tech/migrating-from-dep-to-go-1.11-modules/

I need this to simplify my life in building for Travis.

* Introduce build.sh and repair build

In going forward, I believe we don't actually need a Makefile but I
didn't want to make such a radical change now.

* Another strategy wrt gopath

* travis: run regress tests on macOS

Closes #30
This commit is contained in:
Simone Basso
2019-05-15 14:48:06 +02:00
committed by Arturo Filastò
parent dd70340b9c
commit 9992690f8f
14 changed files with 275 additions and 357 deletions
-39
View File
@@ -31,11 +31,6 @@ var geoipFiles = map[string]string{
"GeoLite2-Country.mmdb": "http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz",
}
var legacyGeoipFiles = map[string]string{
"GeoIPASNum.dat": "http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz",
"GeoIP.dat": "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz",
}
// Download the file to a temporary location
func downloadToTemp(url string) (string, error) {
out, err := ioutil.TempFile(os.TempDir(), "maxmind")
@@ -56,40 +51,6 @@ func downloadToTemp(url string) (string, error) {
return out.Name(), nil
}
// DownloadLegacyGeoIPDatabaseFiles into the target directory
func DownloadLegacyGeoIPDatabaseFiles(dir string) error {
for filename, url := range legacyGeoipFiles {
dstPath := filepath.Join(dir, filename)
tmpPath, err := downloadToTemp(url)
if err != nil {
return err
}
// Extract the tar.gz file
f, err := os.Open(tmpPath)
defer f.Close()
if err != nil {
return errors.Wrap(err, "failed to read file")
}
gzf, err := gzip.NewReader(f)
if err != nil {
return errors.Wrap(err, "failed to create gzip reader")
}
outFile, err := os.Create(dstPath)
if err != nil {
return errors.Wrap(err, "error creating file")
}
if _, err := io.Copy(outFile, gzf); err != nil {
return errors.Wrap(err, "error reading file from gzip")
}
outFile.Close()
}
return nil
}
// DownloadGeoIPDatabaseFiles into the target directory
func DownloadGeoIPDatabaseFiles(dir string) error {
for filename, url := range geoipFiles {