# Contributor: sillysausage <sillysausage@privatedemail.net>
# Maintainer:
pkgname=3proxy
pkgver=0.7.1.3
pkgrel=1
pkgdesc="Really tiny cross-platform proxy servers set"
url="http://3proxy.ru"
arch="all"
license="3proxy"
pkgusers="3proxy"
pkggroups="3proxy"
depends=
makedepends="linux-headers"
install="3proxy.pre-install"
subpackages="$pkgname-doc"
source="https://github.com/z3APA3A/$pkgname/archive/$pkgname-$pkgver.tar.gz
        $pkgname.initd"

_builddir=$srcdir/$pkgname-$pkgname-$pkgver

prepare() {
	cd "$srcdir/$pkgname-$pkgname-$pkgver"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	make -f Makefile.Linux prefix="/usr" || return 1
}

package() {
	cd "$_builddir"
	make -f Makefile.Linux DESTDIR="$pkgdir" prefix="/usr" install || return 1
	install -Dm755 "$srcdir"/3proxy.initd "$pkgdir"/etc/init.d/3proxy || return 1
	mv "$pkgdir"/usr/etc/3proxy "$pkgdir"/etc/3proxy || return 1
	chown -R 3proxy:3proxy "$pkgdir"/etc/3proxy || return 1
	install -Dm644 copying "$pkgdir"/usr/share/licenses/$pkgname/COPYING || return 1

}

md5sums="4754d5cf7071db9eb8013bbd739836f8  3proxy-0.7.1.3.tar.gz
debcf0b8c2a6827e438ad3addec5fbc4  3proxy.initd"
sha256sums="4d1f3cf539c8a32f5845b54e8a3fdbabef6fe8a6bbb06dfc80f7361804f6cb60  3proxy-0.7.1.3.tar.gz
b7837c5817cbb45a96c92fa119ba623f3a1a5ca6849dfd85518bbea163baefe8  3proxy.initd"
sha512sums="d72e5ca79a55ad9cde6c9becfc1674aa7a38fb52ee73b479aee8747d52bb9966c8cf73f348f2a2c8319afcbedb9e7ba8bea485a785204d7ee1a9ab21e3a1d9ef  3proxy-0.7.1.3.tar.gz
5425792d0babc75221b5a35996a1fa47a6d0b9a435edde7b63e0344b7d58ab96b18f1c5fb28e798df36cb342d9793d530dbcdd0102cc5fb04a70ca525c924576  3proxy.initd"
