Prune devel/py-EnthoughtBase
[dports.git] / devel / subversion / Makefile
1 # Created by: rooneg@electricjellyfish.net
2 # $FreeBSD$
3
4 PORTREVISION=   1
5
6 MAINTAINER=     lev@FreeBSD.org
7 COMMENT=        Version control system
8
9 CONFLICTS_INSTALL=      subversion-1.[^9].[0-9]* \
10                         subversion1[^9]-1.[^9].[0-9]*
11
12 USE_RC_SUBR=    svnserve
13
14 PORTDOCS=       BUGS CHANGES COMMITTERS INSTALL README
15
16 OPTIONS_DEFINE= \
17                 BDB             \
18                 DOCS            \
19                 FREEBSD_TEMPLATE\
20                 MAINTAINER_DEBUG\
21                 NLS             \
22                 SASL            \
23                 SERF            \
24                 STATIC          \
25                 SVNSERVE_WRAPPER\
26                 TEST            \
27                 TOOLS
28
29 OPTIONS_DEFAULT=FREEBSD_TEMPLATE \
30                 SERF TOOLS
31
32 FREEBSD_TEMPLATE_DESC=  FreeBSD Project log template
33 MAINTAINER_DEBUG_DESC=  Build debug version
34 SERF_DESC=              WebDAV/Delta-V (HTTP/HTTPS) repo access module
35 STATIC_DESC=            Build static version (no shared libs)
36 SVNSERVE_WRAPPER_DESC=  Enable svnserve wrapper (umask setter)
37 TEST_DESC=              Run subversion test suite
38 TOOLS_DESC=             Install several tools
39
40 # Patches required for use with the FreeBSD Project repository only
41 FREEBSD_TEMPLATE_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-fbsd-template
42 SVNSERVE_WRAPPER_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-svnserve-wrapper
43
44 .include "Makefile.common"
45
46 SVNREPOS?=      /home/svn/repos
47 SVNFSTYPE?=     fsfs
48 SVNGROUP?=      svn
49 SVNUSER?=       svn
50
51 CONFIGURE_ARGS+=        --without-gnome-keyring \
52                         --without-kwallet \
53                         --with-apxs=no
54
55 .if ${PORT_OPTIONS:MSVNSERVE_WRAPPER}
56 SUB_LIST+=      SVNSERVE_BIN_EXT=".bin"
57 PLIST_SUB+=     NO_SVNSERVE_WRAPPER="@comment "
58 .else
59 SUB_LIST+=      SVNSERVE_BIN_EXT=""
60 PLIST_SUB+=     NO_SVNSERVE_WRAPPER=""
61 .endif
62
63 .if ${PORT_OPTIONS:MTEST}
64 TEST_DEPENDS=   ${PYTHON_PKGNAMEPREFIX}sqlite3>0:${PORTSDIR}/databases/py-sqlite3
65 .endif
66
67 .if ${PORT_OPTIONS:MSTATIC}
68 .  if ${PORT_OPTIONS:MNLS}
69 USES+=                  gettext-tools
70 .  endif
71 .  if ${PORT_OPTIONS:MBDB}
72 BDB_BUILD_DEPENDS=      yes
73 .  endif
74 OLD_LIB_DEPENDS:=       ${LIB_DEPENDS:S!^!${LOCALBASE}/lib/!:C!(\.so|\.[0-9]+)?:!.a:!}
75 BUILD_DEPENDS+=         ${OLD_LIB_DEPENDS}
76 LIB_DEPENDS=
77 .endif
78
79 .if ${PORT_OPTIONS:MBDB}
80 CONFIGURE_ARGS+=        --enable-bdb6
81 .else
82 CONFIGURE_ARGS+=        --without-berkeley-db
83 .endif
84
85 .if make(repository)
86 WITH_REPOSITORY_CREATION=       yes
87 .endif
88
89 .if defined(WITH_REPOSITORY_CREATION)
90 MKREPOS_TARGET= _mkrepos
91 .endif
92
93 pre-everything::
94         @${ECHO_MSG} ""
95 .if defined(WITH_REPOSITORY_CREATION)
96         @${ECHO_MSG} "I will create (or use, if it exists) '${SVNUSER}' user and '${SVNGROUP}' group."
97         @${ECHO_MSG} "Make sure that all committers are its members."
98         @${ECHO_MSG} ""
99         @${ECHO_MSG} "Repository will be created at '${SVNREPOS}' with user '${SVNUSER}' and group '${SVNGROUP}'."
100         @${ECHO_MSG} "Type of repository will be '${SVNFSTYPE}'."
101         @${ECHO_MSG} "You could change these settings by defining SVNREPOS, SVNGROUP and SVNFSTYPE."
102 .else
103         @${ECHO_MSG} "You can have the repository created for you by defining"
104         @${ECHO_MSG} "WITH_REPOSITORY_CREATION."
105         @${ECHO_MSG} ""
106         @${ECHO_MSG} "Make sure that:"
107         @${ECHO_MSG} "* all your svn users are members of a common group"
108         @${ECHO_MSG} "* this group is the group id of the db/ and locks/"
109         @${ECHO_MSG} "  subdirectories of your repository"
110         @${ECHO_MSG} "* the above subdirectories are writable by this group"
111 .endif
112
113         @${ECHO_MSG} ""
114 .if ${PORT_OPTIONS:MSTATIC}
115         @${ECHO_MSG} "Static binaries will be built."
116 .endif # STATIC
117         @${ECHO_MSG} "Many useful scripts will be installed into ${DATADIR}"
118
119 pre-configure:
120 .if ${PORT_OPTIONS:MBDB}
121         @BDB_VERSION=`${APR_APU_DIR}/${APU_CONFIG} --db-version`; \
122         if [ "$${BDB_VERSION}" != "4" -a "$${BDB_VERSION}" != "5" -a "$${BDB_VERSION}" != "6" ] ; then \
123                 ${ECHO_MSG} "" ; \
124                 ${ECHO_MSG} 'You should build `'"devel/apr1' with Berkeley DB (4, 5 or 6) support to use subversion with it." ; \
125                 ${ECHO_MSG} 'Please rebuild `'"devel/apr1' with option "'`'"BDB' and try again." ; \
126                 ${ECHO_MSG} "" ; \
127                 ${ECHO_MSG} "Or you can disable Berkeley DB support. Only 'fs' repository backend will be available." ; \
128                 ${ECHO_MSG} "" ; \
129                 ${FALSE} ; \
130         fi
131 .endif
132 .if ${PORT_OPTIONS:MSTATIC}
133         @if ${GREP} -q icui18n ${LOCALBASE}/lib/libsqlite3.la ; then \
134                 ${ECHO_MSG} "" ; \
135                 ${ECHO_MSG} "You can not build static subversion if your SQLite3 is built with ICU enabled."; \
136                 ${ECHO_MSG} "Please, reinstall 'devel/sqlite3' port with disabled ICU support."; \
137                 ${ECHO_MSG} "" ; \
138                 ${FALSE} ; \
139         fi
140 .endif
141
142 post-configure:
143 # Enable GNOME Keyring / KWallet support in main code, as it is harmless
144         @${REINPLACE_CMD} -E 's%.*#undef SVN_HAVE_(GNOME_KEYRING|KWALLET).*%#define SVN_HAVE_\1 1%' ${WRKSRC}/subversion/svn_private_config.h
145 # ugly hack: save tools directory so we don't have to cleanup before installing
146         @${CP} -R ${WRKSRC}/tools ${WRKSRC}/tools.examples
147         @${CHMOD} -R a-st,o+rX ${WRKSRC}/tools.examples
148
149 # takes a long time, and will fail but gives maintainer a good oversight
150 .if ${PORT_OPTIONS:MTEST}
151 test: build
152         -@make check -C ${WRKSRC}
153 .endif
154
155 post-build:
156 .if ${PORT_OPTIONS:MTOOLS}
157         @${MAKE} -C ${WRKSRC} tools ${MAKE_ARGS}
158 .endif
159
160 post-install:   ${MKREPOS_TARGET}
161 .if ${PORT_OPTIONS:MTOOLS}
162         @${MAKE} -C ${WRKSRC} install-tools ${MAKE_ARGS}
163 .endif
164         @${MKDIR} ${STAGEDIR}${DATADIR}
165         (cd ${WRKSRC}/tools.examples && ${TAR} --exclude '*.in' -cf - * | ${TAR} -C ${STAGEDIR}${DATADIR} -xof - )
166         @${MKDIR} ${STAGEDIR}${DOCSDIR}
167         ${INSTALL_MAN} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
168
169 post-install-SVNSERVE_WRAPPER-on:
170         @${INSTALL_SCRIPT} ${FILESDIR}/svnserve.wrapper ${STAGEDIR}${PREFIX}/bin/svnserve.sample
171
172 # ===============================================================================
173 repository:     _mkrepos
174
175 _SVNGRPFILES=   db locks locks/db.lock locks/db-logs.lock
176 SVNGRPFILES=    ${_SVNGRPFILES:S,^,${SVNREPOS}/,}
177
178 _mkrepos:       .USE
179 .if !exists(${SVNREPOS})
180 .if ${PORT_OPTIONS:MSVNSERVE_WRAPPER}
181         @if /usr/sbin/pw groupshow "${SVNGROUP}" >/dev/null 2>&1; then \
182             ${ECHO_MSG} "You already have a group \"${SVNGROUP}\", so I will use it."; \
183         else \
184             if /usr/sbin/pw groupadd ${SVNGROUP} -h -; \
185             then \
186                 ${ECHO_MSG} "Added group \"${SVNGROUP}\"."; \
187             else \
188                 ${ECHO_MSG} "Adding group \"${SVNGROUP}\" failed..."; \
189                 ${ECHO_MSG} "Please create it, and try again."; \
190                 ${FALSE}; \
191             fi; \
192         fi
193         @if /usr/sbin/pw usershow "${SVNUSER}" >/dev/null 2>&1; then \
194             ${ECHO_MSG} "You already have a user \"${SVNUSER}\", so I will use it."; \
195         else \
196             if /usr/sbin/pw useradd ${SVNUSER} -h -; \
197             then \
198                 ${ECHO_MSG} "Added user \"${SVNUSER}\"."; \
199             else \
200                 ${ECHO_MSG} "Adding user \"${SVNUSER}\" failed..."; \
201                 ${ECHO_MSG} "Please create it, and try again."; \
202                 ${FALSE}; \
203             fi; \
204         fi
205 .endif
206         @${MKDIR} ${SVNREPOS}
207         @${PREFIX}/bin/svnadmin create --fs-type ${SVNFSTYPE} ${SVNREPOS}
208 .if ${PORT_OPTIONS:MSVNSERVE_WRAPPER}
209         @${CHOWN} ${SVNUSER}:${SVNGROUP} ${SVNGRPFILES}
210         @${CHMOD} g+w ${SVNGRPFILES}
211         @for i in ${SVNREPOS}/db/* ; do \
212             i=$${i##*/}; \
213             case $$i in \
214             DB_CONFIG|fs-type|uuid) ;; \
215             *) ${CHOWN} -R ${SVNUSER}:${SVNGROUP} ${SVNREPOS}/db/$$i; \
216                ${CHMOD} -R g+w ${SVNREPOS}/db/$$i; \
217                ;; \
218             esac; \
219         done
220 .endif
221 .endif
222
223 svn-build-outputs-hack:
224         (cd ${WRKSRC} && ${PATCH} ${PATCH_DIST_ARGS} -p0 < ${PATCHDIR}/extra-patch-build.conf)
225         (cd ${WRKSRC} && python2 gen-make.py --release --installed-libs libsvn_client,libsvn_delta,libsvn_diff,libsvn_fs,libsvn_fs_x,libsvn_ra,libsvn_repos,libsvn_subr,libsvn_wc)
226         ${MV} ${WRKSRC}/build-outputs.mk ${FILESDIR}/build-outputs.mk.addons
227
228 .include <bsd.port.post.mk>