-
Notifications
You must be signed in to change notification settings - Fork 184
Build from source
We regularly develop and test with Ubuntu 14.04. Release binaries are built with Debian 7 and Raspbian 7.
Install Go. Don't use your distribution's package because it's either out of date, or will be soon. In particular, Go >= 1.4 is required to build. To check what version of Go you have:
$ go version
go version go1.5.2 linux/arm
Install a few dev packages. The connector uses:
- build tools to interface with C libraries via cgo
- CUPS to, you know, print
- Net-SNMP to collect extra status info directly from printers
- Avahi to announce it's presence via mDNS/DNS-SD
- Git to clone Git repositories containing Go libraries and the CUPS Connector
- Bazaar to clone Bazaar repositories containing Go libraries
If your distro is based on Debian (Ubuntu, Raspbian, Mint, others) then this one-liner will get all dependencies:
$ sudo apt-get install build-essential libcups2-dev libsnmp-dev libavahi-client-dev git bzr
Fedora 22:
sudo dnf install gcc cups-devel net-snmp-devel avahi-devel git bzr
RPM distros like CentOS:
yum install gcc cups-devel net-snmp-devel avahi-devel git bzr
Install XCode: https://itunes.apple.com/us/app/xcode/id497799835
Install the command line developer tools:
$ xcode-select --install
Accept the license agreement:
$ xcodebuild -license
Install MSYS2. Open the "MinGW-w64 Win64 Shell", and make sure things are up-to-date.
$ pacman -Syu
Restart the MinGW shell. Install some dev packages.
$ pacman -S mingw-w64-x86_64-go mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gcc mingw-w64-x86_64-cairo mingw-w64-x86_64-poppler git bzr
Not sure why, but go
and bzr
don't seem to get along. To get around that, you can fetch the necessary code with something like bzr branch lp:go-xdg $GOPATH/src/launchpad.net/go-xdg/v0
.
It should work on any BSD, but ~10 lines of code need to be adjusted. If you would like to use the connector with a BSD, let us know with GitHub issue.
$ go get github.com/google/cups-connector/...
You should now have two new binaries: gcp-cups-connector
and gcp-cups-connector-util
.
If you need to install Go from source (because there isn't a Go binary for your platform at https://golang.org/dl) then this might help. You will need:
- git, to clone the GitHub repository
- C toolchain, to compile the Go compiler
If your Linux distro is based on Debian (Ubuntu, Raspbian, Mint, others):
$ sudo apt-get install git build-essential
Install the Go programming language version 1.4
$ git clone https://go.googlesource.com/go ~/go1.4
$ cd ~/go1.4/src
$ git checkout go1.4.3
$ ./all.bash
Install the Go programming language version 1.5 (this requires Go 1.4; long story)
$ git clone https://go.googlesource.com/go ~/go1.5
$ cd ~/go1.5/src
$ git checkout go1.5.2
$ ./all.bash
$ echo 'export GOPATH=$HOME/go' >> ~/.bashrc
$ echo 'PATH="$PATH:$HOME/go1.5/bin:$GOPATH/bin"' >> ~/.bashrc
$ source ~/.bashrc
$ go version
go version go1.5.2 linux/arm