Skip to content

Commit

Permalink
Creates a version.go file at compile time to embeds version info as w…
Browse files Browse the repository at this point in the history
…ell as commit Id
  • Loading branch information
qjerome committed Jun 4, 2019
1 parent bc3b158 commit 9fbc137
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Here are some of our motivations:
# Documentation
Please visit: https://rawsec.lu/doc/gene/1.4/

# Notes
# Changelog

This project is quite new and may still have little bugs, so do not hesitate to
open issues for those.
## v1.5.0
* Support for Mitre ATT&CK framework
* Changes in the reducer function
6 changes: 3 additions & 3 deletions gene/gene.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ func reduce(e *engine.Engine) {
const (
exitFail = 1
exitSuccess = 0
version = "1.4"
copyright = "Gene Copyright (C) 2017 RawSec SARL (@0xrawsec)"
license = "License GPLv3: This program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions;"
//version = "1.5.0"
copyright = "Gene Copyright (C) 2017 RawSec SARL (@0xrawsec)"
license = "License GPLv3: This program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions;"
)

var (
Expand Down
19 changes: 12 additions & 7 deletions gene/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
RELEASE=$(GOPATH)/release
MAIN_BASEN_SRC=gene
VERSION=v1.4.1
VERSION=1.5.0
COMMITID=$(shell git rev-parse HEAD)
# Strips symbols and dwarf to make binary smaller
OPTS=-ldflags "-s -w"
ifdef DEBUG
Expand All @@ -10,6 +11,7 @@ endif
all:
$(MAKE) clean
$(MAKE) init
$(MAKE) buildversion
$(MAKE) compile

init:
Expand All @@ -20,21 +22,24 @@ init:

compile:linux windows darwin

buildversion:
printf "package main\n\nconst(\n version=\"$(VERSION)\"\n commitID=\"$(COMMITID)\"\n)\n" > version.go

linux:
GOARCH=386 GOOS=linux go build $(OPTS) -o $(RELEASE)/linux/$(MAIN_BASEN_SRC)-386 $(MAIN_BASEN_SRC).go
GOARCH=amd64 GOOS=linux go build $(OPTS) -o $(RELEASE)/linux/$(MAIN_BASEN_SRC)-amd64 $(MAIN_BASEN_SRC).go
GOARCH=386 GOOS=linux go build $(OPTS) -o $(RELEASE)/linux/$(MAIN_BASEN_SRC)-386 ./
GOARCH=amd64 GOOS=linux go build $(OPTS) -o $(RELEASE)/linux/$(MAIN_BASEN_SRC)-amd64 ./
cd $(RELEASE)/linux; md5sum * > md5.txt
cd $(RELEASE)/linux; tar -cvzf ../linux-$(VERSION).tar.gz *

windows:
GOARCH=386 GOOS=windows go build $(OPTS) -o $(RELEASE)/windows/$(MAIN_BASEN_SRC)-386.exe $(MAIN_BASEN_SRC).go
GOARCH=amd64 GOOS=windows go build $(OPTS) -o $(RELEASE)/windows/$(MAIN_BASEN_SRC)-amd64.exe $(MAIN_BASEN_SRC).go
GOARCH=386 GOOS=windows go build $(OPTS) -o $(RELEASE)/windows/$(MAIN_BASEN_SRC)-386.exe ./
GOARCH=amd64 GOOS=windows go build $(OPTS) -o $(RELEASE)/windows/$(MAIN_BASEN_SRC)-amd64.exe ./
cd $(RELEASE)/windows; md5sum * > md5.txt
cd $(RELEASE)/windows; tar -cvzf ../windows-$(VERSION).tar.gz *

darwin:
GOARCH=386 GOOS=darwin go build $(OPTS) -o $(RELEASE)/darwin/$(MAIN_BASEN_SRC)-386 $(MAIN_BASEN_SRC).go
GOARCH=amd64 GOOS=darwin go build $(OPTS) -o $(RELEASE)/darwin/$(MAIN_BASEN_SRC)-amd64 $(MAIN_BASEN_SRC).go
GOARCH=386 GOOS=darwin go build $(OPTS) -o $(RELEASE)/darwin/$(MAIN_BASEN_SRC)-386 ./
GOARCH=amd64 GOOS=darwin go build $(OPTS) -o $(RELEASE)/darwin/$(MAIN_BASEN_SRC)-amd64 ./
cd $(RELEASE)/darwin; md5sum * > md5.txt
cd $(RELEASE)/darwin; tar -cvzf ../darwin-$(VERSION).tar.gz *

Expand Down

0 comments on commit 9fbc137

Please sign in to comment.