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

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

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

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

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

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