aboutsummaryrefslogtreecommitdiffstats
path: root/www/tdiary/Makefile
blob: e76a5a5e4ac34ae71be89c909f4bfef27ce612f4 (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
# New ports collection makefile for:    tdiary
# Date created:                 21 May 2003
# Whom:                         Fumihiko Kimura <jfkimura@yahoo.co.jp>
#
# $FreeBSD$
#

PORTNAME=   tdiary
PORTVERSION=    3.1.0
CATEGORIES?=    www ruby
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}/ \
        http://www.tdiary.org/download/
DISTNAME=   ${PORTNAME}-full-${PORTVERSION}

MAINTAINER= tota@FreeBSD.org
COMMENT=    A Web-based diary system (like weblog) written in Ruby

LICENSE=    GPLv2
LICENSE_FILE=   ${WRKDIR}/doc/COPYING

RUN_DEPENDS=    hikidoc:${PORTSDIR}/textproc/ruby-hikidoc \
        rubygem-imagesize>=0.1.1:${PORTSDIR}/graphics/rubygem-imagesize \
        rd2:${PORTSDIR}/textproc/ruby-rdtool

NO_BUILD=   yes
USE_RUBY=   yes
RUBY_REQUIRE=   Ruby >= 185

RUBY_SHEBANG_FILES= index.fcgi \
            index.rb \
            update.rb \
            misc/convert2.rb \
            misc/migrate.rb \
            misc/plugin/amazon/amazonimg.rb \
            misc/plugin/squeeze.rb \
            misc/plugin/xmlrpc/xmlrpc.rb \
            misc/standalone_cgi/bin/server

PORTDOCS=   ChangeLog COPYING HOWTO-make-io.rd HOWTO-make-plugin.html \
        HOWTO-make-theme.html HOWTO-use-plugin.html \
        HOWTO-write-tDiary.en.html HOWTO-write-tDiary.html INSTALL.html \
        README.en.html README.html README.md UPGRADE doc.css

SUB_FILES=  pkg-message tdiaryinst.rb
SUB_LIST+=  TDIARY_LANG=${TDIARY_LANG} \
        TDIARY_SCRIPT=${TDIARY_SCRIPT}
WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}
DOCSDIR=    ${PREFIX}/share/doc/${UNIQUENAME}
WWWDIR=     ${PREFIX}/www/${UNIQUENAME}

TDIARY_SCRIPT=  ${UNIQUENAME}-inst.rb

#TDIARY_LANG    ja:Japanese en:English zh:Traditional-Chinese
.if !defined(TDIARY_LANG) || ( defined(TDIARY_LANG) && ${TDIARY_LANG} != ja )
TDIARY_LANG=    en
.endif

REINPLACE_ARGS= -i ''

.include <bsd.port.pre.mk>

.if ${RUBY_VER} == 1.9
.if !defined(RUBY_PROVIDED)
IGNORE= requires Ruby 1.9.1 or later
.endif
.endif

.if ${RUBY_VER} == 1.8
.if !defined(RUBY_PROVIDED)
IGNORE= requires Ruby 1.8.5 or later
.endif
.if !defined(WITHOUT_TDIARY_NORA)
RUN_DEPENDS+=   ${RUBY_SITEARCHLIBDIR}/web/escape_ext.so:${PORTSDIR}/www/ruby-nora
.endif
.endif

post-extract:
    @${RM} ${WRKSRC}/.gitignore
    @${RM} ${WRKSRC}/.rspec
    @${RM} ${WRKSRC}/.travis.yml
    @${RM} ${WRKSRC}/Capfile
    @${RM} ${WRKSRC}/Gemfile
    @${RM} ${WRKSRC}/Gemfile.lock
    @${RM} ${WRKSRC}/Rakefile
    @${RM} ${WRKSRC}/config.ru
    @${RM} -r ${WRKSRC}/public
    @${RM} -r ${WRKSRC}/spec
    @${RM} -r ${WRKSRC}/vendor/hikidoc-0.0.6
    @${RM} -r ${WRKSRC}/vendor/imagesize-0.1.1/*
    @${RM} -r ${WRKSRC}/vendor/rdtool-0.6.22
    @${MV} ${WRKSRC}/ChangeLog ${WRKSRC}/doc
    @${MV} ${WRKSRC}/README.md ${WRKSRC}/doc
    @cd ${WRKSRC} && ${MV} doc ${WRKDIR}

pre-install:
    @${SED} -e 's,#!/usr/bin/env ruby,#!${RUBY},' \
        ${WRKDIR}/tdiaryinst.rb > ${WRKDIR}/${TDIARY_SCRIPT}
    @${REINPLACE_CMD} '/#!\/usr\/bin\/env ruby/d' ${WRKSRC}/misc/convert2.rb
    @${REINPLACE_CMD} '/#!\/usr\/bin\/env ruby/d' ${WRKSRC}/misc/migrate.rb

do-install:
    @${INSTALL_SCRIPT} ${WRKDIR}/${TDIARY_SCRIPT} ${PREFIX}/bin
    @-${MKDIR} ${WWWDIR}
    @${CP} -pR ${WRKSRC}/ ${WWWDIR}
    @${LN} -s ${LOCALBASE}/lib/ruby/gems/${RUBY_VER}/gems/imagesize-0.1.1/lib ${WWWDIR}/vendor/imagesize-0.1.1/lib
    @${CHOWN} -R ${WWWOWN}:${WWWGRP} ${WWWDIR}

post-install:
    @${ECHO_CMD} '@exec ${CHOWN} -R ${WWWOWN}:${WWWGRP} ${WWWDIR}' >> ${TMPPLIST}
    @${ECHO_CMD} bin/${TDIARY_SCRIPT} >> ${TMPPLIST}
.if !defined(NOPORTDOCS)
    @${INSTALL} -d ${DOCSDIR}
    @cd ${WRKDIR}/doc && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
.endif
    @${CAT} ${PKGMESSAGE}

x-generate-plist:
    ${FIND} ${WWWDIR} -type f -o -type l | ${SORT} | ${SED} -e 's,${WWWDIR},%%WWWDIR%%,g' > pkg-plist.new
    ${FIND} ${WWWDIR} -type d -depth | ${SORT} -r | ${SED} -e 's,${WWWDIR},@dirrm %%WWWDIR%%,g' >> pkg-plist.new

.include <bsd.port.post.mk>