Building Cardigann which is coded in Go Lang was tricky. Here are the steps you need to follow if you want to setup in your Jail on FreeNAS (FreeBSD). Personally, I have it setup in my Transmission jail.
It took me few hours to figure this out since I do not know GO Lang.
Regards,
vinchi007
- First, you need to install GO Lang if you dont have it already in your Jail:
Code:pkg install go
- Verify that GO is installed
Code:go version go version go1.7.4 freebsd/amd64
- Very important! Determine your GO PATH, where you will pull repositories, compile, etc. You can setup your path in any location, but remember all Go packages will go there. I setup mine in /usr/local/etc/cardigann
Code:Create PATH directory mkdir -p /usr/local/etc/cardigann Export this location for your GO to use setenv GOPATH /usr/local/etc/cardigann Export BIN location for your GO where all of the compiled binaries will be stored setenv GOBIN /usr/local/etc/cardigann/bin
- Get all of the packages required by Kardigann
Code:go get github.com/Sirupsen/logrus go get github.com/cardigann/cardigann go get gopkg.in/alecthomas/kingpin.v2 go get github.com/equinox-io/equinox go get github.com/kardianos/service
Note: All packages downloaded by 'go get <name>' will be stored in 'src' directory in GOPATH location. All these packages you will find in /usr/local/etc/cardigann/src/<location> (example: /usr/local/etc/cardigann/src/github.com/Sirupsen/logrus) - Setup Environments for XDG-GO package () so it compiles correctly.
Code:mkdir -p /var/db/cardigann/data mkdir -p /var/db/cardigann/config setenv XDG_CONFIG_HOME /var/db/cardigann setenv XDG_DATA_HOME /var/db/cardigann setenv XDG_CACHE_HOME /var/db/cardigann setenv XDG_DATA_DIRS /var/db/cardigann/data setenv XDG_CONFIG_DIRS /var/db/cardigann/config
[OPTIONAL] Alternatively you can let XDG-GO use a default location (users $HOME path) but XDG-GO does not have "freebsd" logic. You can create it yourself, by copying a linux version
Code:cd /usr/local/etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go cp -p xdg_linux.go xdg_freebsd.go Now you should have 'xdg_freebsd.go' file which will be used by xdg.go when identifying your OS (`go env|grep GOOS` --> "freebsd") ls -rw-r--r-- 1 root wheel 1080 Jan 13 11:04 LICENSE -rw-r--r-- 1 root wheel 2703 Jan 13 11:04 README.md -rw-r--r-- 1 root wheel 412 Jan 13 11:04 xdg_darwin.go -rw-r--r-- 1 root wheel 518 Jan 13 11:04 xdg_linux.go -rw-r--r-- 1 root wheel 390 Jan 13 11:04 xdg_windows.go -rw-r--r-- 1 root wheel 2491 Jan 13 12:10 xdg.go -rw-r--r-- 1 root wheel 518 Jan 13 12:14 xdg_freebsd.go
- Ready to compile. Very important: navigate to the directory where cardigann source was downloaded by go get command.
Code:cd /usr/local/etc/cardigann/src/github.com/cardigann/cardigann make make build make install
You will find your cardigann binary in your GOBIN location (/usr/local/etc/cardigann/bin)
It took me few hours to figure this out since I do not know GO Lang.
Regards,
vinchi007