1SUMMARY="A password-hashing function"
2DESCRIPTION="Argon2 is a password-hashing function that summarizes the state \
3of the art in the design of memory-hard functions and can be used to hash \
4passwords for credential storage, key derivation, or other applications."
5HOMEPAGE="https://github.com/p-h-c/phc-winner-argon2"
6COPYRIGHT="2015-2017 Daniel Dinu
7	2013-2017 Samuel Neves
8	2015-2017 Dmitry Khoravich
9	2015-2017 Jean-Philippe Aumasson
10	2015 Thomas Pornin"
11LICENSE="Apache v2
12	Public Domain"
13REVISION="2"
14srcGitRev="440ceb9612d5a20997e3e12728542df2de713ca4"
15SOURCE_URI="https://github.com/P-H-C/phc-winner-argon2/archive/$srcGitRev.tar.gz"
16CHECKSUM_SHA256="bb7a9d6fa631fdb61b95a93596f2c9c38ad3035b774459b793acf46cd3502647"
17SOURCE_FILENAME="argon2-$srcGitRev.tar.gz"
18SOURCE_DIR="phc-winner-argon2-$srcGitRev"
19PATCHES="argon2-$portVersion.patchset"
20if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
21	PATCHES="$PATCHES
22	argon2-$portVersion-gcc2.patchset"
23fi
24
25ARCHITECTURES="all"
26SECONDARY_ARCHITECTURES="x86"
27
28PROVIDES="
29	argon2$secondaryArchSuffix = $portVersion
30	lib:libargon2$secondaryArchSuffix = 1
31	"
32if [ -z "$secondaryArchSuffix" ]; then
33PROVIDES="$PROVIDES
34	cmd:argon2 = $portVersion
35	"
36fi
37
38REQUIRES="
39	haiku$secondaryArchSuffix
40	"
41
42PROVIDES_devel="
43	argon2${secondaryArchSuffix}_devel = $portVersion
44	devel:libargon2$secondaryArchSuffix = 1
45	"
46REQUIRES_devel="
47	argon2$secondaryArchSuffix == $portVersion base
48	"
49
50BUILD_REQUIRES="
51	haiku${secondaryArchSuffix}_devel
52	"
53BUILD_PREREQUIRES="
54	cmd:gcc$secondaryArchSuffix
55	cmd:make
56	"
57
58TEST_REQUIRES="
59	cmd:diff
60	"
61
62defineDebugInfoPackage argon2$secondaryArchSuffix \
63	$libDir/libargon2.so.1
64
65PATCH()
66{
67	if [ -n "$secondaryArchSuffix" ]; then
68		sed -i 's,develop/headers,develop/headers/x86,g' Makefile
69		sed -i 's,LIBRARY_REL ?= lib,LIBRARY_REL ?= lib/x86,g' Makefile
70	fi
71	sed -i 's/-march=\$(OPTTARGET)//' Makefile
72}
73
74BUILD()
75{
76	export ARGON2_VERSION=$portVersion
77	make PREFIX=$prefix
78}
79
80INSTALL()
81{
82	make install PREFIX=$prefix
83
84	# remove static library
85	rm $libDir/libargon2.a
86
87	if [ -n "$secondaryArchSuffix" ]; then
88		rm -rf $prefix/bin
89		rm -rf $manDir
90	fi
91
92	prepareInstalledDevelLib libargon2
93	fixPkgconfig
94
95	packageEntries devel \
96		$developDir
97}
98
99TEST()
100{
101	make OPTTARGET=none test
102}
103