summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7376cd2f3f4524788096110b651d2e396c743dda (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
67
68
69
70
71
72
# Maintainer: KUMAX <kumax2048@pm.me>

_pkgbase=yafu
pkgname=yafu-git
pkgrel=1
pkgver=r611.53d86bb
pkgdesc="Automated integer factorization."
url=https://github.com/bbuhrow/yafu
license=("MIT")
arch=('x86_64')
conflicts=(${_pkgbase})
provides=('yafu' 'ysieve')
#makedepends=('zlib' 'msieve') ## These dependencies are related to some features, but they are not tested for being sufficient to make yafu work.
makedepends=('git' 'subversion')
depends=('gmp' 'gmp-ecm')
optdepends=('ggnfs')
source=(
	"git+https://github.com/bbuhrow/yafu.git"
	"git+https://github.com/bbuhrow/ytools.git"
	"git+https://github.com/bbuhrow/ysieve.git"
	msieve::"svn+svn://svn.code.sf.net/p/msieve/code/trunk"
    "avx_ecm_main.patch"
	)
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            '2fa4529955996166f4d258e2cb1a93685a4a8485129314d44fa3e140ae97e595')

prepare() {
	cd ${srcdir}/yafu
	sed -i "s%^LIBS += -lecm /users/buhrow/src%#LIBS += -lecm /users/buhrow/src%" Makefile
	sed -i "s/^\#LIBS += -lecm -lgmp -lytools -lysieve/LIBS += -lecm -lgmp -lytools -lysieve/" Makefile
    patch --forward --strip=1 --input=../avx_ecm_main.patch
}

pkgver() {
	cd "${_pkgbase}"
	( set -o pipefail
		git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
		printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
	)
}

build() {
	cd ${srcdir}/ytools
	make CC=gcc
	cp libytools.a ${srcdir}/ysieve/

	cd ${srcdir}/ysieve
	make CC=gcc
	cp libytools.a ${srcdir}/yafu/
	cp libysieve.a ${srcdir}/yafu/
	
	cd ${srcdir}/msieve
	make all NO_ZLIB=1

	cd ${srcdir}/yafu
	make yafu CC=gcc NFS=1
}

package() {
	cd ${srcdir}/ysieve
	install -Dm755 ysieve ${pkgdir}/usr/bin/ysieve

	cd ${srcdir}/yafu
	install -Dm755 yafu ${pkgdir}/usr/bin/yafu
	install -Dm644 yafu.ini -t ${pkgdir}/etc/yafu
	install -Dm644 README -t ${pkgdir}/usr/share/doc/yafu
	install -Dm644 CHANGES -t ${pkgdir}/usr/share/doc/yafu
	install -Dm644 docfile.txt -t ${pkgdir}/usr/share/doc/yafu
}