Line # Revision Author
1 8 ahitrov@rambler.ru ##############################################################################
2 # $HeadURL: http://svn.dev.rambler.ru/Contenido/branches/utf8/ports/etc/ports.mk $
3 # $Id: ports.mk 1526 2010-03-29 11:11:10Z ahitrov $
4 ###############################################################################
5
6 PREFIX ?= ${error PREFIX must be defined}
7 PORTSWRK ?= ${error PORTSWRK must be defined}
8
9 PORTSDIR ?= ${basename ${shell cd ../../ && pwd}}
10 PORTSDB ?= ${PORTSWRK}/db
11 DISTDIR ?= ${PORTSWRK}/distfiles
12
13 MASTER_CPAN_SITES ?= \
14 http://www.cpan.dk/modules/by-module/ \
15 ftp://ftp.kddlabs.co.jp/lang/perl/CPAN/modules/by-module/ \
16 ftp://ftp.dti.ad.jp/pub/lang/CPAN/modules/by-module/ \
17 ftp://ftp.sunet.se/pub/lang/perl/CPAN/modules/by-module/ \
18 ftp://mirror.hiwaay.net/CPAN/modules/by-module/ \
19 ftp://ftp.mirrorservice.org/sites/ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module/ \
20 ftp://bioinfo.weizmann.ac.il/pub/software/perl/CPAN/modules/by-module/ \
21 ftp://csociety-ftp.ecn.purdue.edu/pub/CPAN/modules/by-module/ \
22 ftp://ftp.isu.net.sa/pub/CPAN/modules/by-module/ \
23 ftp://ftp.ucr.ac.cr/pub/Unix/CPAN/modules/by-module/ \
24 ftp://ftp.cs.colorado.edu/pub/perl/CPAN/modules/by-module/ \
25 ftp://cpan.pop-mg.com.br/pub/CPAN/modules/by-module/ \
26 ftp://ftp.is.co.za/programming/perl/CPAN/modules/by-module/ \
27 http://at.cpan.org/modules/by-module/ \
28 ftp://ftp.chg.ru/pub/lang/perl/CPAN/modules/by-module/ \
29 ftp://ftp.auckland.ac.nz/pub/perl/CPAN/modules/by-module/
30
31
32 MASTER_SITES ?= /usr/local/dist \
33 495 ahitrov http://contenido.me/repos/Contenido/cnddist
34 8 ahitrov@rambler.ru
35 MASTER_POST_SITES ?=
36
37 ifdef MASTER_CPAN_SUBDIR
38 MASTER_SITES += ${addsuffix ${MASTER_CPAN_SUBDIR},${MASTER_CPAN_SITES}}
39 endif
40
41 PORTDIR = ${basename ${shell pwd}}
42 PORTNAME ?= ${shell echo ${PORTDIR} | sed 's/.*\///'}
43 PORTVERSION ?= ${error PORTVERSION must be defined}
44 DISTFILE ?= ${PORTNAME}${PORTVERSION:%=-%}.tar.gz
45 WRKDIR = ${PORTSWRK}/work/${PORTNAME}
46 WRKSRC ?= ${WRKDIR}/${DISTFILE:%.tar.gz=%}
47
48 OPSYS = ${shell uname}
49
50 FETCH_CMD ?= ${shell which fetch || which wget || echo ''}
51 FETCH_ARGS ?= ${shell perl -e 'print "-o" if "${FETCH_CMD}" =~ /fetch$$/; \
52 print "-P" if "${FETCH_CMD}" =~ /wget$$/;'}
53
54 MAKE_RECURSIVE = ${MAKE} -s MFLAGS= MAKEFLAGS= MAKELEVEL= PERL_CHECKED=
55 MAKE_RECURSIVE_PERL = ${MAKE} -s MFLAGS= MAKEFLAGS= MAKELEVEL=
56
57 include ${PORTSDIR}/etc/perl.mk
58
59
60 #########################
61 # Common for Perl modules
62 #########################
63 ifneq (${PERL_MAKEMAKER}${PERL_MODBUILD},)
64 CONFIGURE_ENV ?= PERL5LIB='${PERL_LIBCOL}' MAKE=${MAKE}
65 BUILD_ENV ?= PERL5LIB='${PERL_LIBCOL}' MAKE=${MAKE}
66 INSTALL_ENV ?= PERL5LIB='${PERL_LIBCOL}' MAKE=${MAKE} OPSYS=${OPSYS}
67
68 PERL_CHECK ?= yes
69 PERL_CHECK_MODULE ?= ${PORTNAME}
70 PERL_CHECK_VERSION ?= ${PORTVERSION}
71 endif
72
73
74 #####################
75 # ExtUtils::MakeMaker
76 #####################
77 ifdef PERL_MAKEMAKER
78 CONFIGURE_COMMAND ?= ${PERL} Makefile.PL
79
80 ifeq (${OPSYS},FreeBSD)
81 CONFIGURE_ARGS ?= INSTALLDIRS="site" \
82 PREFIX="${PREFIX}" \
83 INSTALLPRIVLIB="${PREFIX}/lib/perl5/site_perl/${PERL_VER}" \
84 INSTALLARCHLIB="${PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}"
85 else
86 CONFIGURE_ARGS ?= INSTALLDIRS="site" \
87 PREFIX="${PREFIX}" \
88 INSTALLPRIVLIB="${PREFIX}/lib/perl5/site_perl/${PERL_VER}" \
89 INSTALLARCHLIB="${PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}" \
90 INSTALLSITELIB="${PREFIX}/lib/perl5/site_perl/${PERL_VER}" \
91 INSTALLSITEARCH="${PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}"
92 endif
93
94 endif
95
96
97 #####################
98 # Module::Build
99 #####################
100 ifdef PERL_MODBUILD
101 CONFIGURE_COMMAND ?= ${PERL} Build.PL
102 CONFIGURE_ARGS ?= create_packlist=0 \
103 install_path=lib="${PREFIX}/lib/perl5/site_perl/${PERL_VER}" \
104 install_path=arch="${PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}" \
105 install_path=script="${PREFIX}/bin" \
106 install_path=bin="${PREFIX}/bin" \
107 install_path=libdoc="${PREFIX}/man/man3" \
108 install_path=bindoc="${PREFIX}/man/man1"
109 BUILD_COMMAND ?= ${PERL} Build
110 INSTALL_COMMAND ?= ${PERL} Build install
111 endif
112
113
114 #####################
115 # default
116 #####################
117 PORT_DEPENDS ?=
118
119 CLEAN_PRECMD ?=
120 CLEAN_POSTCMD ?=
121
122 CONFIGURE_PRECMD ?=
123 CONFIGURE_POSTCMD ?=
124 CONFIGURE_ENV ?=
125 CONFIGURE_POSTENV ?=
126 ifeq (${OPSYS},Linux)
127 CONFIGURE_COMMAND ?= bash ./configure
128 else
129 CONFIGURE_COMMAND ?= ./configure
130 endif
131 CONFIGURE_ARGS ?= --prefix=${PREFIX}
132 CONFIGURE_POSTARGS ?=
133
134 BUILD_PRECMD ?=
135 BUILD_POSTCMD ?=
136 BUILD_ENV ?=
137 BUILD_COMMAND ?= ${MAKE}
138 BUILD_ARGS ?=
139 BUILD_POSTARGS ?=
140
141 INSTALL_PRECMD ?=
142 INSTALL_POSTCMD ?=
143 INSTALL_ENV ?=
144 INSTALL_COMMAND ?= ${BUILD_COMMAND}
145 INSTALL_ARGS ?= install
146 INSTALL_POSTARGS ?=
147
148 DEINSTALL_PRECMD ?=
149 DEINSTALL_POSTCMD ?=
150
151 DRY_RUN ?=
152
153
154 # fetching
155 fetch: ${DISTDIR}/${DISTFILE}
156 @echo ${DISTFILE} fetched
157
158 ${DISTDIR}/%:
159 @test -d ${DISTDIR} || mkdir -p ${DISTDIR}
160 @${MAKE_RECURSIVE} do-fetch
161
162 def-fetch:
163 @for SITE in ${MASTER_SITES} ${MASTER_POST_SITES}; do \
164 if [ -f ${DISTDIR}/${DISTFILE} ]; then \
165 exit 0; \
166 fi; \
167 if [ \! -z "`echo $${SITE} | perl -ne '/^svn:\/\// && print 1'`" ]; then \
168 echo "Trying subversion: $${SITE}"; \
169 svn ls $${SITE}/${DISTFILE} >&- 2>&- \
170 && svn cat $${SITE}/${DISTFILE} > ${DISTDIR}/${DISTFILE}; \
171 elif [ \! -z "`echo $${SITE} | perl -ne '/^(ftp|http):\/\// && print 1'`" ]; then \
172 if [ \! -z "${FETCH_CMD}" ]; then \
173 echo "Trying site: $${SITE}"; \
174 ${FETCH_CMD} ${FETCH_ARGS} ${DISTDIR}/ $${SITE}/${DISTFILE} >&- ; \
175 else \
176 echo "Skip site: $${SITE}, no available fetcher found"; \
177 fi; \
178 elif [ \! -z "`echo $${SITE} | perl -ne 'm|^/| && print 1'`" ]; then \
179 echo "Trying local storage: $${SITE}"; \
180 test -f $${SITE}/${DISTFILE} && cp $${SITE}/${DISTFILE} ${DISTDIR}/ >&- ; \
181 else \
182 ${call die,Scheme unknown - $${SITE}/${DISTFILE}}; \
183 fi; \
184 done; \
185 if [ \! -f ${DISTDIR}/${DISTFILE} ]; then \
186 ${call die,Can not fetch ${DISTFILE}}; \
187 fi
188
189
190 # distcleaning
191 distclean:
192 @${MAKE_RECURSIVE} do-$@
193 @echo ${DISTFILE} removed
194
195 def-distclean:
196 @rm -f ${DISTDIR}/${DISTFILE}
197
198
199 # cleaning
200 clean:
201 @${MAKE_RECURSIVE} do-$@
202 @echo ${PORTNAME} cleaned
203
204 def-clean:
205 @${CLEAN_PRECMD}
206
207 @rm -Rf ${WRKDIR}
208
209 @${CLEAN_POSTCMD}
210
211
212 # extracting
213 extract: ${WRKDIR}/.extract
214 @echo ${DISTFILE} extracted
215
216 ${WRKDIR}/.extract:
217 @${MAKE_RECURSIVE} fetch
218 @test -d ${WRKDIR} || mkdir -p ${WRKDIR}
219 @${MAKE_RECURSIVE} do-extract
220 @date > $@
221
222 def-extract:
223 @tar -xzf ${DISTDIR}/${DISTFILE} -C ${WRKDIR}
224
225
226 # configuring
227 configure: ${WRKDIR}/.configure
228 @echo ${PORTNAME} configured
229
230 ${WRKDIR}/.configure:
231 ifneq (${PERL_MAKEMAKER}${PERL_MODBUILD},)
232 @if [ \! -d ${PREFIX}/lib/perl5 ]; then \
233 mkdir -p ${PREFIX}/lib/perl5; \
234 fi;
235 endif
236 @${MAKE_RECURSIVE} extract
237
238 @for DEP in ${PORT_DEPENDS}; do \
239 cd ${PORTSDIR}/all/$${DEP} \
240 && ${MAKE_RECURSIVE} install || exit 1; \
241 done;
242
243 @${MAKE_RECURSIVE} do-configure
244 @date > $@
245
246 def-configure:
247 @${CONFIGURE_PRECMD}
248
249 @cd ${WRKSRC} \
250 && ${CONFIGURE_ENV} ${CONFIGURE_POSTENV} ${CONFIGURE_COMMAND} ${CONFIGURE_ARGS} \
251 ${CONFIGURE_POSTARGS}
252
253 ifdef PERL_MAKEMAKER
254 @cd ${WRKSRC} \
255 && ${PERL} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' Makefile
256 ifeq (${shell perl -e 'print 1 if ${PERL_LEVEL}<=500503'},1)
257 @cd ${WRKSRC} \
258 && ${PERL} -pi -e 's/^(INSTALLSITELIB|INSTALLSITEARCH|SITELIBEXP|SITEARCHEXP|INSTALLMAN1DIR|INSTALLMAN3DIR) = \/usr\/local/$$1 = \$$(PREFIX)/' Makefile
259 endif
260 endif
261
262 @${CONFIGURE_POSTCMD}
263
264
265 # building
266 build: ${WRKDIR}/.build
267 @echo ${PORTNAME} built
268
269 ${WRKDIR}/.build:
270 @${MAKE_RECURSIVE} configure
271 @${MAKE_RECURSIVE} do-build
272 @date > $@
273
274 def-build:
275 @${BUILD_PRECMD}
276
277 @cd ${WRKSRC} \
278 && ${BUILD_ENV} ${BUILD_COMMAND} ${BUILD_ARGS} ${BUILD_POSTARGS}
279
280 @${BUILD_POSTCMD}
281
282 # installing
283 install: ${PORTSDB}/${PORTNAME}
284 ifndef DRY_RUN
285 @echo "${PORTNAME} installed"
286 @echo "----------------------------------------"
287 @cat $^
288 @echo "----------------------------------------"
289 endif
290
291 ${PORTSDB}/%:
292 @test -d ${PORTSDB} || mkdir -p ${PORTSDB}
293 ifneq (${PERL_CHECK},yes)
294 ifndef DRY_RUN
295 @${MAKE_RECURSIVE} build
296 @${PORTSDIR}/etc/snapshot ${PREFIX} > $@.before
297 @${MAKE_RECURSIVE} do-install
298 @echo "State: installed" > $@
299 @echo "Date: "`date` >> $@
300 @echo "Name: ${PORTNAME}" >> $@
301 @echo "Version: ${PORTVERSION}" >> $@
302 @${PORTSDIR}/etc/snapshot -d $@.before ${PREFIX} > $@.content
303 else
304 @echo "UNKNOWN: ${PORTNAME}"
305 endif
306 else
307
308 ifeq (${PERL_CHECKED},cancel)
309 @${call die,Cancelled}
310 else
311 ifeq (${PERL_CHECKED},skip)
312 ifndef DRY_RUN
313 @echo "State: skipped" > $@
314 @echo "Date: "`date` >> $@
315 @echo "Name: ${PORTNAME}" >> $@
316 @echo "Version: ${PORTVERSION}" >> $@
317 @${call warn,Skipped}
318 else
319 @echo "FOUND: ${PORTNAME}"
320 endif
321 else
322 ifeq (${PERL_CHECKED},install)
323 ifndef DRY_RUN
324 @${MAKE_RECURSIVE} build
325 @${PORTSDIR}/etc/snapshot ${PREFIX} > $@.before
326 @${MAKE_RECURSIVE} do-install
327 @echo "State: installed" > $@
328 @echo "Date: "`date` >> $@
329 @echo "Name: ${PORTNAME}" >> $@
330 @echo "Version: ${PORTVERSION}" >> $@
331 @${PORTSDIR}/etc/snapshot -d $@.before ${PREFIX} > $@.content
332 else
333 @echo "NOT FOUND: ${PORTNAME}"
334 endif
335 else
336 @`${PORTSDIR}/etc/chkmod ${PERL_CHECK_MODULE} ${PERL_CHECK_VERSION}` && ${MAKE_RECURSIVE_PERL} $@
337 endif
338 endif
339 endif
340 endif
341
342 def-install:
343 @${INSTALL_PRECMD}
344
345 @cd ${WRKSRC} \
346 && ${INSTALL_ENV} ${INSTALL_COMMAND} ${INSTALL_ARGS} ${INSTALL_POSTARGS}
347
348 @${INSTALL_POSTCMD}
349
350
351 # deinstalling
352 deinstall:
353 @${DEINSTALL_PRECMD}
354
355 @if [ \! -f ${PORTSDB}/${PORTNAME} ]; then \
356 ${call warn,${PORTNAME} is not installed}; \
357 else \
358 ${MAKE_RECURSIVE} clean; \
359 if [ -f ${PORTSDB}/${PORTNAME}.content ]; then \
360 ${PORTSDIR}/etc/snaprm ${PREFIX} ${PORTSDB}/${PORTNAME}.content; \
361 fi; \
362 rm -f ${PORTSDB}/${PORTNAME}; \
363 rm -f ${PORTSDB}/${PORTNAME}.before; \
364 rm -f ${PORTSDB}/${PORTNAME}.content; \
365 fi;
366
367 @${DEINSTALL_POSTCMD}
368
369
370 # reinstalling
371 reinstall: deinstall install
372
373
374 # service
375 get-%:
376 @echo -n ${$*}
377
378
379 # default do-
380 do-%:
381 @${MAKE_RECURSIVE} def-$*
382
383
384 # utils
385 define info
386 echo "##############################################################################"; \
387 echo "#"; \
388 echo "# INFO: "${1}; \
389 echo "#"; \
390 echo "##############################################################################"
391 endef
392
393 define warn
394 echo "##############################################################################"; \
395 echo "#"; \
396 echo "# WARNING: "${1}; \
397 echo "#"; \
398 echo "##############################################################################"
399 endef
400
401 define die
402 echo "##############################################################################"; \
403 echo "#"; \
404 echo "# ERROR: "${1}; \
405 echo "#"; \
406 echo "##############################################################################"; \
407 exit 99
408 endef

Небольшая справка по веткам

cnddist – контейнер, в котором хранятся все дистрибутивы всех библиотек и программных пакетов, которые использовались при построении различных версий Contenido. Если какой-то библиотеки в данном хранилище нет, инсталлятор сделает попытку "подтянуть" ее с веба (например, с CPAN). Если библиотека слишком старая, есть очень большая вероятность, что ее там уже нет. Поэтому мы храним весь хлам от всех сборок. Если какой-то дистрибутив вдруг отсутствует в cnddist - напишите нам, мы положим его туда.

koi8 – отмирающая ветка, чей код, выдача и все внутренние библиотеки заточены на кодировку KOI8-R. Вносятся только те дополнения, которые касаются внешнего вида и функционала админки, баги ядра, обязательные обновления портов и мелочи, которые легко скопипастить. В дальнейшем планируется полная остановка поддержки по данной ветке.

utf8 – актуальная ветка, заточенная под UTF-8.

Внутри каждой ветки: core – исходники ядра; install – скрипт установки инсталляции; plugins – плагины; samples – "готовые к употреблению" проекты, которые можно поставить, запустить и посмотреть, как они работают.