[aur-general] Packaging a go application
Hi, I am currently trying to package an application for use in the aur. The problem I am having is the install() section. The only thing i need to be done is for the package to move '$srcdir/$_gitname/fathom' into '/bin/'. How would I turn that into a .tar.gz? Sorry if my question doesn't make sense, but here is my current PKGBUILD (it is not finished as I can't seem to get git to provide a version) ####### PKGBUILD STARTS HERE ####### pkgname="fathom-git" pkgrel=1 pkgver="i.dont.know.what.to.put.here" pkgdesc="Fathom - simple website analytics (Community Edition)" url="https://github.com/usefathom/fathom" license=("MIT") arch=("any") provides=("fathom") conflicts=("fathom") makedepends=("git" "go" "npm") source=("git://github.com/usefathom/fathom.git") md5sums=("SKIP") _gitname="fathom" prepare(){ mkdir -p gopath/src/github.com/usefathom ln -rTsf $_gitname gopath/src/github.com/usefathom/fathom export GOPATH="$srcdir"/gopath } build(){ export GOPATH="$srcdir"/gopath cd $srcdir/$_gitname make build } package(){ echo "I don't know what to do now" } ####### PKGBUILD ENDS HERE ###### Also, if you have any problems with other things in the PKGBUILD then please feel free to give me tips on better ways to do them. Yours sincerely, Rhys Perry
On Sat, Sep 07, 2019 at 02:37:13PM +0200, Rhys Perry via aur-general wrote:
Hi, I am currently trying to package an application for use in the aur. The problem I am having is the install() section. The only thing i need to be done is for the package to move '$srcdir/$_gitname/fathom' into '/bin/'. How would I turn that into a .tar.gz?
Why would you need to turn anything into `.tar.gz`? Are you thinking about a package? `makepkg` does that for you. Reading the PKGBUILD it seems like you haven't read all the relevant package guideline pages we provide. https://wiki.archlinux.org/index.php/Go_package_guidelines https://wiki.archlinux.org/index.php/VCS_package_guidelines#Git
####### PKGBUILD STARTS HERE ####### license=("MIT")
The license needs to be installed in `package()`.
arch=("any")
This isn't an "any" package as it contains compiled code. `x86_64` should be enough
makedepends=("git" "go" "npm")
Usually you want to build towards `go-pie` to provide PIE enabled binaries. But since it's an AUR package this isn't super important.
source=("git://github.com/usefathom/fathom.git")
You want "git+https://github.com....."
build(){ export GOPATH="$srcdir"/gopath cd $srcdir/$_gitname make build }
You need to cd into the complete gopath of the source.
package(){ echo "I don't know what to do now" }
Read any normal PKGBUILD from our repository or guidelines. It should be fairly obvious. You can also look at examples by taking a look at the PKGBUILDs from other go projects. Click on the ones listing `go-pie` as a "(make)" dependency. https://www.archlinux.org/packages/community/x86_64/go-pie/ -- Morten Linderud PGP: 9C02FF419FECBE16
participants (2)
-
Morten Linderud
-
Rhys Perry