summaryrefslogtreecommitdiff
path: root/textproc/docbookrx/Makefile
blob: 4cd3f40db01e30b372ce406faa50dfc3a2131e74 (plain)
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
PORTNAME=	docbookrx
DISTVERSION=	1.0.0.dev
CATEGORIES=	textproc

MAINTAINER=	swills@FreeBSD.org
COMMENT=	DocBook to AsciiDoc converter

LICENSE=	MIT
LICENSE_FILE=	${WRKSRC}/LICENSE

BUILD_DEPENDS=	${LOCALBASE}/bin/rake:devel/rubygem-rake \
		gem:devel/ruby-gems \
		rubygem-bundler>=1.16:sysutils/rubygem-bundler \
		rubygem-rspec>=1.2.2:devel/rubygem-rspec
RUN_DEPENDS=	rubygem-nokogiri>=1.8:textproc/rubygem-nokogiri

USE_RUBY=	yes
USE_GITHUB=	yes

OPTIONS_DEFINE=	DOCS

GH_ACCOUNT=	allanjude
GH_PROJECT=	docbookrx
GH_TAGNAME=	06cae39

GEM_ENV+=	RB_USER_INSTALL=yes
USE_LOCALE?=	en_US.UTF-8
GEM_ENV+=	LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE}
RUBYGEM_ARGS=	-l --no-update-sources --ignore-dependencies \
		--install-dir  ${STAGEDIR}${PREFIX}/lib/ruby/gems/${RUBY_VER} \
		--bindir=${STAGEDIR}${PREFIX}/bin

RUBYGEMBIN=	${LOCALBASE}/bin/gem${RUBY_VER:S/.//}
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
EXT_DIR=	${GEMS_BASE_DIR}/extensions
GEM_LIB_DIR?=	${GEMS_DIR}/${PORTNAME}-${DISTVERSION}

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MDOCS}
RUBYGEM_ARGS+=	--document rdoc,ri
.else
RUBYGEM_ARGS+=	--no-document
.endif

do-build:
	cd ${BUILD_WRKSRC} && ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} build --force ${PORTNAME}.gemspec

do-install:
	cd ${INSTALL_WRKSRC} && ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} install ${RUBYGEM_ARGS} ${PORTNAME}-${DISTVERSION}.gem -- ${CONFIGURE_ARGS}
	${RM} -r ${STAGEDIR}${PREFIX}/${GEMS_BASE_DIR}/build_info
	${FIND} ${STAGEDIR}${PREFIX}/${GEMS_BASE_DIR} -type f -name '*.so' -exec ${STRIP_CMD} {} +
	${FIND} ${STAGEDIR}${PREFIX}/${GEMS_BASE_DIR} -type f \( -name mkmf.log -or -name gem_make.out \) -delete
	${RM} -r ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR}/extensions \
	${STAGEDIR}${PREFIX}/${CACHE_DIR} 2> /dev/null || ${TRUE}
	${RMDIR} ${STAGEDIR}${PREFIX}/${EXT_DIR} 2> /dev/null || ${TRUE}
	${ECHO} bin/docbookrx >> ${TMPPLIST}
	${ECHO} ${GEMS_BASE_DIR}/specifications/${PORTNAME}-${DISTVERSION}.gemspec >> ${TMPPLIST}
.if ${PORT_OPTIONS:MDOCS}
	${FIND} -ds ${STAGEDIR}${PREFIX}/${DOC_DIR} -type f -print | ${SED} -E -e \
		's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
.endif
	${FIND} -ds ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR} -type f -print | ${SED} -E -e \
		's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
		@if [ -d ${STAGEDIR}${PREFIX}/${EXT_DIR} ]; then \
			${FIND} -ds ${STAGEDIR}${PREFIX}/${EXT_DIR} -type f -print | ${SED} -E -e \
			's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST} ; \
		fi

.include <bsd.port.mk>