aboutsummaryrefslogtreecommitdiffstats
path: root/net-p2p/mldonkey/Makefile
blob: e3deab6c230faa3e6111b217288c64580e6ad9e2 (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# New ports collection makefile for:    mldonkey
# Date created:     21 August 2002
# Whom:         Holger Lamm <holger@e-gitt.net>
#
# $FreeBSD$
#

PORTNAME=   mldonkey
PORTVERSION=    3.0.4
PORTREVISION=   1
CATEGORIES+=    net-p2p
MASTER_SITES=   SF

MAINTAINER?=    lioux@FreeBSD.org
COMMENT?=   A OCAML client for multiple peer-to-peer networks

BUILD_DEPENDS=  ocamlc:${PORTSDIR}/lang/ocaml

LICENSE=    GPLv2
LICENSE_FILE=   ${WRKSRC}/Copying.txt

NO_LATEST_LINK= yes
CONFLICTS=  mldonkey{-{core,gui},}-devel-[0-9]*

USE_BZIP2=  yes
USE_ICONV=  yes
USE_AUTOTOOLS=  autoconf:267:env
GNU_CONFIGURE=  yes
USE_GMAKE=  yes
ALL_TARGET= opt
MAKE_ENV+=  OCAMLRUNPARAM="l=256M"
MAKE_JOBS_UNSAFE=   yes

CONFIGURE_ARGS+=\
        --enable-ocamlver=3 \
        --with-libiconv-prefix=${LOCALBASE}
CONFIGURE_ENV+= \
        NEWCXX="${CXX}" \
        CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \
        LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib" \
        PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
        PTHREAD_LIBS="${PTHREAD_LIBS}"
# FreeBSD has reentrant dns code
PTHREAD_CFLAGS+=    -D_REENTRANT

###
## Library dependency handling
###
.if !exists(/usr/lib/libbz2.so)
LIB_DEPENDS+=   bz2:${PORTSDIR}/archivers/bzip2
.endif

###
## Options activation
###
.if defined(WITHOUT_GUI) && defined(WITHOUT_CORE)
IGNORE= cannot install: you defined both WITHOUT_GUI and WITHOUT_CORE. I think I'll do nothing
.endif

.if !(defined(WITHOUT_GUI) || defined(WITHOUT_CORE))
CONFLICTS+= mldonkey-core-[0.9]*
CONFLICTS+= mldonkey-gui-[0.9]*

PLIST_SUB+= CORE="" GUI="" GUICORE=""
.else # (defined(WITHOUT_GUI) || defined(WITHOUT_CORE))

. if defined(WITHOUT_GUI)
PKGNAMESUFFIX=  -core

CONFLICTS+= mldonkey-gui-[0.9]*

CONFIGURE_ARGS+=--disable-gui
PLIST_SUB+= CORE="" GUI="@comment " GUICORE="@comment "
. endif # defined(WITHOUT_GUI)

. if defined(WITHOUT_CORE)
PKGNAMESUFFIX=  -gui

CONFLICTS+= mldonkey-core-[0.9]*

PLIST_SUB+= CORE="@comment " GUI="" GUICORE="@comment "
. endif # defined(WITHOUT_CORE)

.endif # !(defined(WITHOUT_GUI) || defined(WITHOUT_CORE))

.if !defined(WITHOUT_GUI)
BUILD_DEPENDS+= ${LOCALBASE}/lib/ocaml/lablgtk2/lablrsvg.cma:${PORTSDIR}/x11-toolkits/ocaml-lablgtk2
LIB_DEPENDS+=   rsvg-2.2:${PORTSDIR}/graphics/librsvg2

CONFIGURE_ARGS+=--enable-gui=newgui2
# we don't need lablgtk as RUN dependency, but we need gtk+glib
USE_GNOME=  gtk20
.endif # !defined(WITHOUT_GUI)

.if !defined(WITHOUT_CORE)
USE_RC_SUBR=    mlnet
SUB_LIST+=  SH=${SH:Q}

. if !defined(WITHOUT_GD)
LIB_DEPENDS+=   gd.4:${PORTSDIR}/graphics/gd
. else
CONFIGURE_ARGS+=--disable-gd
. endif
.endif

DOCFILES=   Authors.txt Bugs.txt ChangeLog Developers.txt \
        Install.txt Todo.txt ed2k_links.txt
PORTDOCS=   ${DOCFILES}
PKGMESSAGE= ${WRKDIR}/pkg-message

# build additional tools
ALL_TARGET+=    \
        mld_hash

.include <bsd.port.pre.mk>

### Development version
## Thus, we will use non standard threading library
## We will switch from libpthread to libthr which should produce
## better results in some scenarios. You can read more at pthread(3)
.if defined(WITH_THR_THREAD_MODEL)
PTHREAD_CFLAGS= -D_THREAD_SAFE
PTHREAD_LIBS=   -lthr
.endif

pre-everything::
.if !defined(WITHOUT_GUI) && !defined(WITHOUT_CORE)
    @${ECHO_MSG} "You can disable the GUI by defining WITHOUT_GUI."
    @${ECHO_MSG} "You can disable the CORE by defining WITHOUT_CORE."
    @${ECHO_MSG}
.endif
.ifndef(WITH_THR_THREAD_MODEL)
    @${ECHO_MSG} "Define WITH_THR_THREAD_MODEL to switch from"
    @${ECHO_MSG} "pthread to thr threading model which could produce better"
    @${ECHO_MSG} "results in some scenarios.  Use at your discretion."

.endif

post-patch:
    @${SED} \
        -e "s|%%PREFIX%%|${PREFIX}|" \
        -e "s|%%SH%%|${SH}|" \
        ${FILESDIR}/wrapper.sh > \
        ${WRKDIR}/wrapper.sh
    @${REINPLACE_CMD} -E \
        -e 's|%%AUTOCONF%%|${AUTOCONF}|' \
        ${BUILD_WRKSRC}/config/Makefile.in
# update server.met provider
.for file in \
    src/daemon/common/commonOptions.ml \
    src/networks/donkey/donkeyServers.ml
    @${REINPLACE_CMD} -E \
        -e 's|http://www.gruk.org/server.met.gz|http://www.jd2k.com/server.met|' \
        -e 's|http://www.bluetack.co.uk/config/antip2p.txt|http://www.bluetack.co.uk/config/level1.gz|' \
        ${WRKSRC}/${file}
.endfor

pre-configure:
    @cd ${WRKSRC}/config && ${AUTOCONF}

post-configure:
    @${REINPLACE_CMD} -E \
        -e 's|^(PTHREAD_CFLAGS[^=]*=).*$$|\1${PTHREAD_CFLAGS}|' \
        -e 's|^(PTHREAD_LIBS[^=]*=).*$$|\1${PTHREAD_LIBS}|' \
        ${BUILD_WRKSRC}/config/Makefile.config

pre-install:
.if exists(${.CURDIR}/pkg-message)
    @${SED} -e 's,%%DOCSDIR%%,${DOCSDIR},' \
        < ${.CURDIR}/pkg-message > ${PKGMESSAGE}
.elif exists(${MASTERDIR}/pkg-message)
    @${SED} -e 's,%%DOCSDIR%%,${DOCSDIR},' \
        < ${MASTERDIR}/pkg-message > ${PKGMESSAGE}
.endif

do-install:
.ifndef(WITHOUT_CORE)
    @${INSTALL_PROGRAM} ${WRKSRC}/mld_hash      ${PREFIX}/bin
    @${INSTALL_PROGRAM} ${WRKSRC}/mlnet     ${PREFIX}/bin/mlnet-real
    @${INSTALL_SCRIPT} ${WRKDIR}/wrapper.sh     ${PREFIX}/bin/mlnet
    @${MKDIR} ${EXAMPLESDIR}
    @${INSTALL_SCRIPT} ${FILESDIR}/kill_mldonkey    ${EXAMPLESDIR}
.endif
.ifndef(WITHOUT_GUI)
    @${INSTALL_PROGRAM} ${WRKSRC}/mlgui     ${PREFIX}/bin
.endif
.ifndef(WITHOUT_CORE && WITHOUT_GUI)
    @${INSTALL_SCRIPT} ${WRKSRC}/distrib/mldonkey_previewer ${PREFIX}/bin
    @${INSTALL_PROGRAM} ${WRKSRC}/mlguistarter  ${PREFIX}/bin
    @${INSTALL_PROGRAM} ${WRKSRC}/mlnet+gui     ${PREFIX}/bin
.endif
.ifndef(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
.for _file in ${DOCFILES}
    @${INSTALL_DATA} ${WRKSRC}/distrib/${_file} ${DOCSDIR}
.endfor
.endif

post-install:
    @${CAT} ${PKGMESSAGE}

install-user: extract
.if !defined(LANG)
    @${ECHO_MSG} "Please call as:  make install-user LANG=<lang>"
    @${ECHO_MSG} "with <lang> one of en,de,fr,fr.noaccents,sp !"
.else
    @${CP} ${WRKSRC}/distrib/i18n/gui_messages.ini.${LANG}\
        ${HOME}/.mldonkey_gui_messages.ini
.endif

.include <bsd.port.post.mk>