summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f0bb694686efd863e5daafd606b776d3057e357e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Maintainer: Jonathan Wright <jon@than.io>
pkgname=journey
pkgver=0.2.0
pkgrel=2
pkgdesc='Ghost-compatible blogging platform written in golang'
url='https://kabukky.github.io/journey/'

arch=('i686' 'x86_64')
makedepends=('go')
conflicts=('journey-bin' 'journey-git')
license=('MIT')

options=('emptydirs')
backup=('opt/journey/config.json')
install='journey.install'

_srcpath='src/github.com/kabukky/journey'
_promenade_sha='59388206534e37aeabdbf672ea1a8e1cf93ee09f'

source=("https://github.com/kabukky/journey/archive/v${pkgver}.tar.gz"
        "promenade.zip::https://github.com/kabukky/promenade/archive/${_promenade_sha}.zip"
        'journey.service'
        'journey.install')
sha256sums=('534964f9b1019dde2498d5d402c5263171f0db91eca2b123dc500a9a80a3d455'
            '2597207a112f69ec0de94bef063681a6d2f3920fff02c2117e5ccf392a4a1ca4'
            '71ff0fd4afd25bcc9e91fe2f9d9f9b8dd89884081e05c93bbd5f3c4c84b71428'
            '20b809dbe7553acbd940c6bd0a83b6b529d3ebc8fa5c4ac20ae74c1bb7c6b22c')


prepare () {
	if [[ ! -r ${srcdir}/${_srcpath} ]] ; then
		mkdir -p ${srcdir}/$(dirname ${_srcpath})
		ln -s ${srcdir}/${pkgname}-${pkgver} ${srcdir}/${_srcpath}
	fi
}

build () {
	export GOPATH="${srcdir}"
	cd ${srcdir}/${_srcpath}
  msg2 "Generating..."
	go generate ./...
  msg2 "Fetching..."
  go get -v ./...
  msg2 "Building..."
	go build -v -o ${srcdir}/journey-${pkgver}/journey
  msg2 "Extracting Promenade..."
  unzip -qu ${srcdir}/promenade.zip -d ${srcdir}
  cp -ar ${srcdir}/promenade-${_promenade_sha}/* ${srcdir}/journey-${pkgver}/content/themes/promenade/
}

package() {
  cd ${srcdir}/journey-${pkgver}

  # Binary, configuration, and service Unit file
  install -Dm755 journey ${pkgdir}/opt/journey/journey
  install -Dm644 config.json ${pkgdir}/opt/journey/config.json
  install -Dm644 ${srcdir}/journey.service ${pkgdir}/usr/lib/systemd/system/journey.service
  # License
  install -Dm644 LICENSE.md ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md
  # Private files for journey's Admin area and the persistant data for the blog
  cp -ar built-in ${pkgdir}/opt/journey/
  cp -ar content ${pkgdir}/opt/journey/
  # Make sure there is absolutly no way the SQLite database can ever make it
  # into the package and overwrite the local copy during upgrade
  rm -f ${pkgdir}/opt/journey/content/data/journey.db
}