From 4fd650a1508d5b649b61ebb32693a64c0ef8c4b6 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 17 Oct 2020 11:08:25 -0600 Subject: [PATCH] adding a vagrantfile for testing. Adding 32bit version of binary for freebsd. --- Makefile | 26 +++++++++++++++++++++++++- docker/Vagrantfile | 16 ++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 docker/Vagrantfile diff --git a/Makefile b/Makefile index 89393b2..e63f4f0 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ BINARY=\ .PHONY: all $(BINARY) -all: $(BINARY) windows/amd64 freebsd/amd64 +all: $(BINARY) windows/amd64 freebsd/amd64 freebsd/386 $(BINARY): OS = $(word 1,$(subst /, ,$*)) $(BINARY): ARCH = $(word 2,$(subst /, ,$*)) @@ -60,5 +60,29 @@ freebsd/amd64: file "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" || true ldd "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" || true +freebsd/amd64: OS = freebsd +freebsd/amd64: ARCH = 386 +freebsd/amd64: GOOS = freebsd +freebsd/amd64: GOARCH = 386 +freebsd/amd64: CGO_ENABLED = 1 +freebsd/amd64: + mkdir -p /build + env + @echo "building web binary (OS = $(OS), ARCH = $(ARCH))" + go build -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -o /build/scrutiny-web-$(OS)-$(ARCH) -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go + + chmod +x "/build/scrutiny-web-$(OS)-$(ARCH)" + file "/build/scrutiny-web-$(OS)-$(ARCH)" || true + ldd "/build/scrutiny-web-$(OS)-$(ARCH)" || true + + @echo "building collector binary (OS = $(OS), ARCH = $(ARCH))" + go build -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -o /build/scrutiny-collector-metrics-$(OS)-$(ARCH) -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go + + chmod +x "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" + file "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" || true + ldd "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" || true + + + # clean: # rm scrutiny-collector-metrics-* scrutiny-web-* diff --git a/docker/Vagrantfile b/docker/Vagrantfile new file mode 100644 index 0000000..4efaf98 --- /dev/null +++ b/docker/Vagrantfile @@ -0,0 +1,16 @@ +Vagrant.configure("2") do |config| + config.vm.guest = :freebsd + config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true + config.vm.box = "freebsd/FreeBSD-11.0-CURRENT" + config.ssh.shell = "sh" + config.vm.base_mac = "080027D14C66" + + config.vm.provider :virtualbox do |vb| + vb.customize ["modifyvm", :id, "--memory", "1024"] + vb.customize ["modifyvm", :id, "--cpus", "1"] + vb.customize ["modifyvm", :id, "--hwvirtex", "on"] + vb.customize ["modifyvm", :id, "--audio", "none"] + vb.customize ["modifyvm", :id, "--nictype1", "virtio"] + vb.customize ["modifyvm", :id, "--nictype2", "virtio"] + end +end