aboutsummaryrefslogtreecommitdiffstats
path: root/net-p2p/gnunet/Makefile
blob: 1732c5e0cd3996801b3433eb98d90cea8f0972f5 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Created by: ijliao
# $FreeBSD$

PORTNAME=   gnunet
DISTVERSION=    0.9.3
PORTREVISION=   7
CATEGORIES= net-p2p ipv6 security
MASTER_SITES=   GNU

MAINTAINER= bf@FreeBSD.org
COMMENT=    An anonymous, distributed, reputation-based network

LICENSE=    GPLv3

LIB_DEPENDS=    unistring:${PORTSDIR}/devel/libunistring \
        curl:${PORTSDIR}/ftp/curl \
        glpk:${PORTSDIR}/math/glpk \
        gmp:${PORTSDIR}/math/gmp \
        gcrypt:${PORTSDIR}/security/libgcrypt \
        extractor:${PORTSDIR}/textproc/libextractor

OPTIONS_DEFINE =    HTTP

HTTP_DESC=  Enable HTTP transport via libmicrohttpd
MYSQL_DESC= Use MySQL for the data store and cache
PGSQL_DESC= Use PostgreSQL for the data store and cache
SQLITE_DESC=    Use SQLite for the data store and cache

OPTIONS_MULTI=      DB
OPTIONS_MULTI_DB=   MYSQL PGSQL SQLITE

OPTIONS_DEFAULT=    SQLITE

USE_AUTOTOOLS=  libltdl libtool
USE_GMAKE=  yes
USES=       iconv
USE_LDCONFIG=   yes

CONFIGURE_ARGS =    --with-daemon-home-dir=${GNUNET_DAEMON_DIR} \
            --with-daemon-config-dir=${PREFIX}/etc \
            --with-extractor=${LOCALBASE} \
            --with-libcurl=${LOCALBASE} \
            --with-libgcrypt-prefix=${LOCALBASE} \
            --with-libunistring-prefix=${LOCALBASE} \
            --with-ltdl-include=${LOCALBASE}/include \
            --with-ltdl-lib=${LOCALBASE}/lib

GROUPS =    gnunet
USERS=      gnunet

MAN1=   gnunet-arm.1 gnunet-core.1 gnunet-directory.1 gnunet-download.1 \
    gnunet-download-manager.1 gnunet-fs.1 gnunet-gns.1 gnunet-namestore.1 \
    gnunet-nat-server.1 gnunet-peerinfo.1 gnunet-pseudonym.1 \
    gnunet-publish.1 gnunet-rsa.1 gnunet-search.1 gnunet-statistics.1 \
    gnunet-transport.1 gnunet-unindex.1 gnunet-vpn.1

#If a non-default GNUNET_DAEMON_DIR is defined, the home directory
#of the gnunet user may need to be adjusted -- e.g., via:
#pw usermod gnunet -d $GNUNET_DAEMON_DIR
GNUNET_DAEMON_DIR?=     /var/lib/gnunet
PLIST_SUB=  GNUNET_DAEMON_DIR=${GNUNET_DAEMON_DIR}
SUB_FILES=  pkg-message
NO_STAGE=   yes

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MDOCS}
PORTDOCS=   AUTHORS COPYING ChangeLog NEWS README
.endif

.if ${PORT_OPTIONS:MEXAMPLES}
PORTEXAMPLES=   gnunet_janitor.py gnunet_pyexpect.py hostlist.cgi hostlist.php \
report.sh
.endif

.if ${PORT_OPTIONS:MHTTP}
BROKEN =    WITH_HTTP requires libmicrohttpd 0.9.18 or higher
LIB_DEPENDS+=       microhttpd:${PORTSDIR}/www/libmicrohttpd
CONFIGURE_ARGS+=    --with-microhttpd=${LOCALBASE}
PLIST_SUB+=     HTTP=""
.else
CONFIGURE_ARGS+=    --without-microhttpd
PLIST_SUB+=     HTTP="@comment "
.endif

.if ${PORT_OPTIONS:MMYSQL}
USE_MYSQL=      yes
CONFIGURE_ARGS+=    --with-mysql=${LOCALBASE}
PLIST_SUB+=     MYSQL=""
.else
CONFIGURE_ARGS+=    --without-mysql
PLIST_SUB+=     MYSQL="@comment "
.endif

.if ${PORT_OPTIONS:MNLS}
USES+=      gettext
CONFIGURE_ARGS+=    --with-libintl-prefix=${LOCALBASE}
PLIST_SUB+=     NLS=""
.else
CONFIGURE_ARGS+=    --disable-nls
PLIST_SUB+=     NLS="@comment "
.endif

.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL=      yes
CONFIGURE_ARGS+=    --with-postgres=${LOCALBASE}
PLIST_SUB+=     PGSQL=""
.else
CONFIGURE_ARGS+=    --without-postgres
PLIST_SUB+=     PGSQL="@comment "
.endif

.if ${PORT_OPTIONS:MSQLITE}
USE_SQLITE=     yes
CONFIGURE_ARGS+=    --with-sqlite=${LOCALBASE}
PLIST_SUB+=     SQLITE=""
.else
CONFIGURE_ARGS+=    --without-sqlite
PLIST_SUB+=     SQLITE="@comment "
.endif

post-patch:
    @${REINPLACE_CMD} -e 's|postgresql/||g' \
        ${WRKSRC}/configure \
        ${WRKSRC}/gnunet_config.h \
        ${WRKSRC}/src/datacache/plugin_datacache_postgres.c \
        ${WRKSRC}/src/datastore/plugin_datastore_postgres.c \
        ${WRKSRC}/src/include/gnunet_postgres_lib.h
    @${REINPLACE_CMD} \
    -e 's|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g' \
        ${WRKSRC}/pkgconfig/Makefile.in

post-install:
    @${PRINTF} "%s\n%s\n%s\n" "[PATHS]" \
    "SERVICEHOME = ${GNUNET_DAEMON_DIR}" \
    "DEFAULTCONFIG = ${PREFIX}/etc/gnunet.conf" \
    > ${PREFIX}/etc/gnunet.conf.sample
.if !exists(${PREFIX}/etc/gnunet.conf)
    @${CP} ${PREFIX}/etc/gnunet.conf.sample ${PREFIX}/etc/gnunet.conf
.endif
.if !exists(${GNUNET_DAEMON_DIR})
    @${INSTALL} -d -o gnunet -g gnunet -m 700 ${GNUNET_DAEMON_DIR}
.endif
    @${INSTALL_PROGRAM} ${WRKSRC}/contrib/timeout_watchdog ${PREFIX}/bin
.if ${PORT_OPTIONS:MDOCS}
    @${MKDIR} ${DOCSDIR}
    @cd ${WRKSRC}; ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
.endif
.if ${PORT_OPTIONS:MEXAMPLES}
    @${MKDIR} ${EXAMPLESDIR}
    @cd ${WRKSRC}/contrib; ${INSTALL_DATA} ${PORTEXAMPLES} ${EXAMPLESDIR}
.endif
    @${ECHO_CMD} ""
    @${CAT} ${PKGMESSAGE}
    @${ECHO_CMD} ""

.include <bsd.port.mk>