aboutsummaryrefslogtreecommitdiffstats
path: root/devel/rubygem-io-like/Makefile
blob: 561a5b1fb5d81ece806af01ae4cee4c119caffde (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
# Created by: TAKATSU Tomonari <tota@FreeBSD.org>
# $FreeBSD$

PORTNAME=   io-like
PORTVERSION=    0.3.0.20130301
CATEGORIES= devel rubygems
MASTER_SITES=   LOCAL
MASTER_SITE_SUBDIR= tota/${PORTNAME}
PKGNAMEPREFIX=  rubygem-

MAINTAINER= tota@FreeBSD.org
COMMENT=    The interface of IO objects to classes providing a few simple methods

LICENSE=    RUBY
LICENSE_FILE=   ${WRKSRC}/LICENSE

BUILD_DEPENDS=  ${RUBYGEMBIN}:${PORTSDIR}/devel/ruby-gems \
        rdoc:${PORTSDIR}/devel/rubygem-rdoc
RUN_DEPENDS=    ${RUBYGEMBIN}:${PORTSDIR}/devel/ruby-gems

USE_RUBY=   yes
USE_RAKE=   yes

GEMS_BASE_DIR=  lib/ruby/gems/${RUBY_VER}
GEMS_DIR=   ${GEMS_BASE_DIR}/gems
DOC_DIR=    ${GEMS_BASE_DIR}/doc
CACHE_DIR=  ${GEMS_BASE_DIR}/cache
SPEC_DIR=   ${GEMS_BASE_DIR}/specifications
GEM_NAME=   ${PORTNAME}-${PORTVERSION:C/(\.[0-9]+)$//}
GEM_LIB_DIR=    ${GEMS_DIR}/${GEM_NAME}
GEM_DOC_DIR=    ${DOC_DIR}/${GEM_NAME}
GEM_SPEC=   ${SPEC_DIR}/${GEM_NAME}.gemspec
GEM_CACHE=  ${CACHE_DIR}/${GEM_NAME}.gem

PLIST_SUB+= PORTVERSION="${PORTVERSION}" \
        REV="${RUBY_GEM}" \
        GEMS_BASE_DIR="lib/ruby/gems/${RUBY_VER}" \
        GEMS_DIR="${GEMS_DIR}" \
        DOC_DIR="${DOC_DIR}" \
        CACHE_DIR="${CACHE_DIR}" \
        SPEC_DIR="${SPEC_DIR}" \
        PORT="${PORTNAME}-${PORTVERSION}" \
        GEM_NAME="${GEM_NAME}" \
        GEM_LIB_DIR="${GEM_LIB_DIR}" \
        GEM_DOC_DIR="${GEM_DOC_DIR}" \
        GEM_SPEC="${GEM_SPEC}" \
        GEM_CACHE="${GEM_CACHE}" \
        EXTRACT_SUFX=".gem"

RUBYGEMBIN= ${LOCALBASE}/bin/gem${RUBY_VER:S/.//}

GEMFILES=   ${GEM_NAME}.gem

RUBYGEM_ARGS=-l --no-update-sources --no-ri --install-dir ${STAGEDIR}${PREFIX}/lib/ruby/gems/${RUBY_VER} --ignore-dependencies --bindir=${STAGEDIR}${PREFIX}/bin

WRKSRC= ${WRKDIR}/${PORTNAME}-ruby-1.9-temp

OPTIONS_DEFINE= DOCS

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MDOCS}
BUILD_DEPENDS+= rubygem-allison>=0:${PORTSDIR}/devel/rubygem-allison
.else
RUBYGEM_ARGS+=  --no-rdoc
.endif

post-patch:
.for l in 1.8.6 1.8.7 1.9.2 1.9.3
    @${ECHO} lib/io/like-${l}.rb >> ${WRKSRC}/MANIFEST
.endfor
.for f in likestringio.rb rot13filter.rb
    @${RUBY} -i -pe "sub %r|((\s*)require 'io/like')|, %Q|\\\2require 'rubygems'\n\\\1|" ${WRKSRC}/examples/${f}
.endfor

do-build:
    @cd ${BUILD_WRKSRC} && ${RAKE_BIN}

do-install:
    @(cd ${INSTALL_WRKSRC}; ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} install ${RUBYGEM_ARGS} pkg/${GEMFILES} -- --build-args ${CONFIGURE_ARGS})

post-install:
    @${ECHO} ${GEM_CACHE} >> ${TMPPLIST}
    @${ECHO} ${GEM_SPEC} >> ${TMPPLIST}
.if ${PORT_OPTIONS:MDOCS}
    @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_DOC_DIR} -type f -print | ${SED} -E -e \
        's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
    @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_DOC_DIR} -type d -print | ${SED} -E -e \
        's,^${STAGEDIR}${PREFIX}/?,@dirrm ,' >> ${TMPPLIST}
.endif
    @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR} -type f -print | ${SED} -E -e \
        's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
    @${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR} -type d -print | ${SED} -E -e \
        's,^${STAGEDIR}${PREFIX}/?,@dirrm ,' >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rmdir %D/${GEMS_DIR} 2>/dev/null || true" >> ${TMPPLIST}
.if ${PORT_OPTIONS:MDOCS}
    @${ECHO_CMD} "@unexec rmdir %D/${DOC_DIR} 2>/dev/null || true" >> ${TMPPLIST}
.endif
    @${ECHO_CMD} "@unexec rmdir %D/${CACHE_DIR} 2>/dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rmdir %D/${SPEC_DIR} 2>/dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rmdir %D/${GEMS_BASE_DIR} 2>/dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rmdir %D/lib/ruby/gems 2>/dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rmdir %D/lib/ruby 2>/dev/null || true" >> ${TMPPLIST}

.include <bsd.port.mk>