aboutsummaryrefslogtreecommitdiffstats
path: root/security/libscrypt/Makefile
blob: b32e8d4f279c8c76038968ed25c27cad235032b1 (plain) (blame)
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
# Created by: Horia Racoviceanu <horia@racoviceanu.com>
# $FreeBSD$

PORTNAME=   libscrypt
PORTVERSION=    1.20
DISTVERSIONPREFIX=  v
CATEGORIES= security

MAINTAINER= ports@FreeBSD.org
COMMENT=    C library for the scrypt key derivation function

LICENSE=    BSD2CLAUSE
LICENSE_FILE=   ${WRKSRC}/LICENSE

USES=       compiler
USE_LDCONFIG=   yes
USE_GITHUB= yes
GH_ACCOUNT= technion

MAKE_ARGS+= CC="${CC}" LIBDIR="${PREFIX}"/lib

PLIST_FILES=    include/libscrypt.h \
        lib/libscrypt.so \
        lib/libscrypt.so.0

PORTDOCS=   README.md

OPTIONS_DEFINE= DOCS

.include <bsd.port.pre.mk>

post-patch:
    @${REINPLACE_CMD} -e 's|?=-|+=-|; s|-O2 ||' ${WRKSRC}/Makefile

.if ${ARCH} == i386 && ${COMPILER_TYPE} == gcc && ${OSVERSION} < 1000036
    @${REINPLACE_CMD} -e 's|-lscrypt|& -lssp_nonshared|; \
        s|\.version|&,-lssp_nonshared|' ${WRKSRC}/Makefile
.else
    @${REINPLACE_CMD} -e 's|-fstack-protector ||' ${WRKSRC}/Makefile
.endif

    @${REINPLACE_CMD} -e \
        's|strcpy(mcf2, mcf);|strlcpy(mcf2, mcf, SCRYPT_MCF_LEN);|' \
            ${WRKSRC}/main.c

regression-test: build
    (cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} check)

post-install:
    ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}.so.0

    @${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}

.include <bsd.port.post.mk>