### this file is sourced not run
PKGVER=2.21
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=fossil-src-$PKGVER.tar.gz
MD5SUM=42bed0df30ba3156442b0efea8078883
SRC_URL=https://fossil-scm.org/home/tarball/f9aa474081f0618c76f4c2f4d6f0277a3fd480aa185d7da0b8b61b00fad1aa78/$TARBALL
BUNDLE=

SLACKREQ='openssl libfuse'
SLACKDESC="fossil2: fossil2 $PKGVER (Fossil SCM)  
fossil2:  
fossil2: Fossil is a distributed version control systems (also known as source 
fossil2: code management - SCM). In addition to the usual SCM functions, Fossil 
fossil2: comes with built-in bug tracker, wiki, events/milestones and 
fossil2: web-interface.  
fossil2: 
fossil2: This is series 2 of Fossil SCM, whose file is not backward compatible
fossil2: with series 1 Fossil. Use with care. The binary is called fossil2.
fossil2: 
fossil2: https://fossil-scm.org/
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/fossil* &&
	# JakeSFR's patch to correct ticket entry
	patch -Np1 -i ../pkg/fossil-fix-append-to-ticket.patch &&
	patch -Np1 -i ../pkg/diff_tk_geometry.patch &&
	true
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/fossil* &&
	
	### old way to build
	# make $MAKEFLAGS -f Makefile.classic &&
	# cp fossil /usr/bin &&
		
	### modern build, needed to support "fossil fuse" command
	./configure --prefix=/usr &&
	make $MAKEFLAGS && make install &&
	mv /usr/bin/fossil{,-2} &&
	
	ln -sf fossil-2 /usr/bin/fossil2 && # compat symlink
	ln -sf fossil-2 /usr/bin/fossil  && # make it as the default fossil

	install -Dm644 ../pkg/Fossil_SCM_logo-64x64.png /usr/share/icons/hicolor/64x64/apps/fossil.png &&

	pkg_build_slackdesc
}
