-
Notifications
You must be signed in to change notification settings - Fork 2
Building HDPM
This describes how one can build the hdpm executable itself. These instructions are based on my own experience in building hdpm and not from the original author.
HDPM is written using the go programming language so in order to compile it, one needs go to be installed. You can download the installation package for your OS from the go downloads page. I did this on Mac OS X using the package installer, but the steps below should work for any OS once go is installed. Just make sure it is in your PATH. (For Mac OS X this means adding /usr/local/go/bin to your PATH .)
HDPM requires a few prerequisites in the form of go packages be installed. The system will install these to a directory tree pointed to by your GOPATH environment variable. If this is not set, then it defaults to ~/go . I set mine to a working directory on my laptop, but this is just personal preference.
For hdpm 0.7.2 the four prerequisite packages can be installed with:
go get github.com/cpuguy83/go-md2man
go get github.com/spf13/cobra
go get github.com/spf13/pflag
go get gopkg.in/yaml.v2
These can also be installed all at once with a single go get command. Similarly, you can install the hdpm source itself with:
go get github.com/JeffersonLab/hdpm
It is important that the hdpm source be in the directory tree pointed to by GOPATH. Specifically, it needs to be in $GOPATH/src/github.com/JeffersonLab/hdpm since it will look for the hdpm/cmd directory using GOPATH.
To build the executable, use the go program itself:
cd $GOPATH/src/github.com/JeffersonLab/hdpm
go build -o hdpm main.go
This can now be placed in some directory that is in your PATH so you can use it. The other source can be discarded if you like since everything is now contained in the hdpm executable binary.