aboutsummaryrefslogtreecommitdiffstats
path: root/security/libtomcrypt/Makefile
blob: e8059d860e884b40641080fa5931b26668761c76 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Created by: Yonatan <Yonatan@Xpert.com>
# $FreeBSD$

PORTNAME=   libtomcrypt
PORTVERSION=    1.17
PORTREVISION=   4
CATEGORIES= security
MASTER_SITES=   http://libtom.net/files/
DISTNAME=   crypt-${PORTVERSION}

MAINTAINER= ports@FreeBSD.org
COMMENT=    Comprehensive, modular, and portable cryptographic toolkit

LICENSE=    PD
LICENSE_NAME=   Public Domain
LICENSE_FILE=   ${WRKSRC}/LICENSE
LICENSE_PERMS=  dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

CFLAGS+=    -I${LOCALBASE}/include
EXTRALIBS=  -L${LOCALBASE}/lib
MAKEFILE=   makefile.shared
ALL_TARGET= library
MAKE_ARGS=  IGNORE_SPEED=yes INCPATH="${PREFIX}/include" \
        LIBPATH="${PREFIX}/lib" EXTRALIBS="${EXTRALIBS}"
WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}
USES=       gmake libtool:build tar:bzip2

OPTIONS_DEFINE=     DOCS
OPTIONS_MULTI=      MATH
OPTIONS_MULTI_MATH= LIBTOMMATH TOMSFASTMATH GMP
OPTIONS_DEFAULT=    LIBTOMMATH

LIBTOMMATH_DESC=    Use LibTomMath
TOMSFASTMATH_DESC=  Use TomsFastMath

LIBTOMMATH_BUILD_DEPENDS=   ${LOCALBASE}/include/tommath.h:${PORTSDIR}/math/libtommath
LIBTOMMATH_CFLAGS=      -DLTM_DESC
LIBTOMMATH_VARS=        EXTRALIBS+=-ltommath

LIBTOMSFASTMATH_BUILD_DEPENDS=  ${LOCALBASE}/include/tfm.h:${PORTSDIR}/math/tomsfastmath
LIBTOMSFASTMATH_CFLAGS=     -DTFM_DESC
LIBTOMSFASTMATH_VARS=       EXTRALIBS+=-ltfm

GMP_LIB_DEPENDS=        libgmp.so:${PORTSDIR}/math/gmp
GMP_CFLAGS=         -DGMP_DESC
GMP_VARS=           EXTRALIBS+=-lgmp

DOCS_MAKE_ARGS_OFF=     NODOCS=yes

post-patch:
    @${REINPLACE_CMD} -e 's|gcc|${CC}|' -e 's| make | $$(MAKE) |' \
        -e 's|-g $$(GROUP)||' -e 's|-o $$(USER)||' \
        ${WRKSRC}/makefile.shared ${WRKSRC}/testprof/makefile.shared

post-install:
    @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libtomcrypt_prof.so.0
    @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libtomcrypt.so.0

post-install-DOCS-on:
    @${MKDIR} ${STAGEDIR}${DOCSDIR}/pdf
    ${INSTALL_DATA} ${WRKSRC}/doc/crypt.pdf ${STAGEDIR}${DOCSDIR}/pdf

do-test:
    @${ECHO_MSG} "Testing with -DUSE_TFM..."
    (cd ${WRKSRC} && CFLAGS="${CFLAGS} -DUSE_TFM" EXTRALIBS="-L${PREFIX}/lib -ltfm" ${MAKE_CMD} test && ${WRKSRC}/test)

    @${ECHO_MSG} "Cleaning up test binary..."
    @${RM} ${WRKSRC}/test
    @${RM} ${WRKSRC}/demos/test.o

    @${ECHO_MSG} "Testing with -DUSE_LTM..."
    (cd ${WRKSRC} && CFLAGS="${CFLAGS} -DUSE_LTM" EXTRALIBS="-L${PREFIX}/lib -ltommath" ${MAKE_CMD} test && ${WRKSRC}/test)

    @${ECHO_MSG} "Cleaning up test binary..."
    @${RM} ${WRKSRC}/test
    @${RM} ${WRKSRC}/demos/test.o

    @${ECHO_MSG} "Testing with -DUSE_GMP..."
    (cd ${WRKSRC} && CFLAGS="${CFLAGS} -DUSE_GMP" EXTRALIBS="-L${PREFIX}/lib -lgmp" ${MAKE_CMD} test && ${WRKSRC}/test)

.include <bsd.port.mk>