aboutsummaryrefslogtreecommitdiffstats
path: root/security/libtomcrypt/Makefile
blob: 39621f7446b0cb426b8dbc12ac269dfb3ad2deba (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
82
83
84
85
86
# Created by: Yonatan <Yonatan@Xpert.com>
# $FreeBSD$

PORTNAME=   libtomcrypt
PORTVERSION=    1.18.1
PORTREVISION=   1
CATEGORIES= security
MASTER_SITES=   https://github.com/libtom/${PORTNAME}/releases/download/v${PORTVERSION}/
DISTNAME=   crypt-${PORTVERSION}

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

LICENSE=    PD
LICENSE_FILE=   ${WRKSRC}/LICENSE

BROKEN_mips=        fails to compile: unrecognized command line option "-Wno-type-limits"
BROKEN_mips64=      fails to compile: unrecognized command line option "-Wno-type-limits"
BROKEN_powerpc64=   fails to compile: unrecognized command line option "-Wno-type-limits"

WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}

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

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:math/libtommath
LIBTOMMATH_CFLAGS=      -DLTM_DESC
LIBTOMMATH_VARS=        EXTRALIBS+=-ltommath

TOMSFASTMATH_BUILD_DEPENDS= ${LOCALBASE}/include/tfm.h:math/tomsfastmath
TOMSFASTMATH_CFLAGS=        -DTFM_DESC
TOMSFASTMATH_VARS=      EXTRALIBS+=-ltfm

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

PORTDOCS=   *

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

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

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

do-test:
    # TomsFastMath
    @${ECHO_CMD} "Testing TomsFastMath"
    ${MAKE_CMD} -C ${WRKSRC} \
        CFLAGS="-I${LOCALBASE}/include -DUSE_TFM -DTFM_DESC" \
        EXTRALIBS="-L${LOCALBASE}/lib -ltfm" clean test
    (cd ${WRKSRC} && ./test)
    # LibTomMath
    @${ECHO_CMD} "Testing LibTomMath"
    ${MAKE_CMD} -C ${WRKSRC} \
        CFLAGS="-I${LOCALBASE}/include -DUSE_LTM -DLTM_DESC" \
        EXTRALIBS="-L${LOCALBASE}/lib -ltommath" clean test
    (cd ${WRKSRC} && ./test)
    # GMP
    @${ECHO_CMD} "Testing GMP"
    ${MAKE_CMD} -C ${WRKSRC} \
        CFLAGS="-I${LOCALBASE}/include -DUSE_GMP -DGMP_DESC" \
        EXTRALIBS="-L${LOCALBASE}/lib -lgmp" clean test
    (cd ${WRKSRC} && ./test)

.include <bsd.port.mk>