Shooting An Iceray

So I am working on learning a few things, all at the same time. The coolest thing is Go, the “programming environment that makes it easy to build simple, reliable, and efficient software” from Google. But I’m also playing with GitHub, as the whole environment can be tightly integrated with it. And so, by extension, I’m playing with Git. More on all of those at a later, probably over on my Daemon Dancing In The Dark more generalized Linux blog.

Anyway, I’m working on a program I call Iceray. It is a command line application that will send MP3 files to an Icecast / Shoutcast server, like my Vehement Flame radio station. I wanted something I could run that would just feed the server without me handholding it.

So I went to work on packaging it up and finally got a PKGBUILD to work. I spent way too much time working on it, especially when it turned out the Go Packing Guidelines wiki page is pretty good. The sample PKGBUILDs should have worked better for me, but I got a few of my streams crossed which took me out of my game for a bit.

The first thing was actually in my Go program. I changed all the package declarations to be ‘package iceray’, not realizing that if it isn’t ‘package main’ it will build a library and not an application. And I also had the _gourl in my PKGBUILD wrong, in that I originally created it as a Git package, so I had the git: protocol in there.

And the page is still a little confusing, in that I needed to use a combination of the sample PKGBUILDs. While iceray in the end boils down to an application, I still found it necessary to use ‘go get‘ in the build() routine, because I don’t think ‘go build‘ pulls in the necessary remote libraries (I use go-libshout, gcfg, and go-id3). And the application ones use the path “$srcdir/$pkgname-$pkgdir”, but “$srcdir” worked just fine for me. So here’s the final PKGBUILD:

# Contributor: Jonathan Arnold <jdarnold@buddydog.org>

pkgname=iceray
pkgver=0.2
pkgrel=2
pkgdesc="Icecast/Shoutcast commandline client"
arch=('i686' 'x86_64')
url="https://github.com/jdarnold/iceray"
license=('MIT')
depends=('libshout')
makedepends=('go')
conflicts=('iceray')
provides=('iceray')
options=('!strip' '!emptydirs')
_gourl="github.com/jdarnold/iceray"
install=${pkgname}.install

build() {
    cd "$srcdir"
    GOPATH="$srcdir" go get -v -x ${_gourl}/...
}

package() {
    install -Dm755 "$srcdir/bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
    install -Dm644 "$srcdir/src/$_gourl/iceray.gcfg.sample" "$pkgdir/usr/share/$pkgname/iceray.gcfg.sample"
    #install -D -m644 iceray.1 $(DESTDIR)$(MANPREFIX)/man1/iceray.1
}

So, in the end, the PKGBUILD was pretty simple, despite my flailing about. Hope this helps someone else!

AUR (en) – iceray.

Leave a Reply