# SliTaz package receipt.

PACKAGE="git"
VERSION="2.18.0"
CATEGORY="development"
SHORT_DESC="Fast version control system"
MAINTAINER="b1+slitaz@nagel.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://git.or.cz"
WGET_URL="https://www.kernel.org/pub/software/scm/git/$TARBALL"
CROSS="bug: can't run test and make package."

DEPENDS="zlib openssl curl expat"
BUILD_DEPENDS="zlib-dev openssl-dev curl-dev expat-dev perl python-dev tar bzip2"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	[ -L /bin/tar ] && tazpkg get-install tar --forced
	./configure \
		--prefix=/usr \
		--libexecdir=/usr/lib \
		--without-tcltk \
		--build=$HOST_SYSTEM \
		--host=$HOST_SYSTEM &&
	make THREADED_DELTA_SEARCH=1
	make THREADED_DELTA_SEARCH=1 DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/etc/init.d
	cp -a $stuff/git-daemon $fs/etc/init.d
	cp -a $install/usr $fs/
	strip -s $fs/usr/lib/git-core/* 2>/dev/null || true
}

# edit daemons.conf.
post_install()
{
	local root
	root=$1
	if ! grep -q 'GIT_OPTIONS' $root/etc/daemons.conf; then
		mkdir $root/var/www/git
		echo '# Git daemon options.' >> $root/etc/daemons.conf
		echo 'GIT_REPO="/var/www/git/"' >> $root/etc/daemons.conf
		echo 'GIT_OPTIONS="--detach --syslog --verbose --base-path=$GIT_REPO $GIT_REPO"' >> $root/etc/daemons.conf
		echo '' >> $root/etc/daemons.conf
	fi
}