summaryrefslogtreecommitdiff
path: root/misc/ec2-ami-tools/Makefile
blob: 2a8859aa57f0d939388dcd1c28f7bed0f8f16b5f (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
74
75
76
77
78
79
80
81
82
83
# $NetBSD: Makefile,v 1.4 2012/10/08 09:57:20 asau Exp $
#

PKGNAME=	ec2-ami-tools-1.3.57676
DISTNAME=	ec2-ami-tools-1.3-57676
PKGREVISION=	2

.include "../../misc/ec2-api-tools/Makefile.common"

CATEGORIES=	misc
MASTER_SITES=	http://s3.amazonaws.com/ec2-downloads/
EXTRACT_SUFX=	.zip

MAINTAINER=	jym@NetBSD.org
HOMEPAGE=	http://aws.amazon.com/developertools/368
COMMENT=	Amazon EC2 AMI Tools (bundle, create, upload AMIs to S3)
LICENSE=	amazon-software-license

USE_TOOLS=	bash:run gtar:run gzip:run openssl:run pax tee:run

DEPENDS+=	curl-[0-9]*:../../www/curl
DEPENDS+=	rsync-[0-9]*:../../net/rsync
DEPENDS+=	ruby${RUBY_VER}-base>=1.8.2:../../lang/ruby${RUBY_VER}-base

NO_BUILD=	yes

.include "../../mk/bsd.prefs.mk"

REPLACE_INTERPRETER+=	bash
REPLACE.bash.old=	/bin/bash
REPLACE.bash.new=	/bin/sh
REPLACE_FILES.bash=	bin/*

SUBST_CLASSES+=		ec2-home
SUBST_STAGE.ec2-home=	pre-configure
SUBST_FILES.ec2-home=	bin/*
SUBST_SED.ec2-home+=	-e 's|\$${EC2_HOME.*}|${EC2_HOME}}|g'
SUBST_MESSAGE.ec2-home=	Setting EC2_HOME default path for scripts.

SUBST_CLASSES+=		ruby
SUBST_STAGE.ruby=	pre-configure
SUBST_FILES.ruby=	bin/*
SUBST_SED.ruby+=	-e 's|^ruby |${RUBY_NAME} |g'
SUBST_MESSAGE.ruby=	Fixing ruby interpreter name.

SUBST_CLASSES+=		ec2-rb
SUBST_STAGE.ec2-rb=	pre-configure
SUBST_FILES.ec2-rb+=	lib/ec2/common/curl.rb
SUBST_FILES.ec2-rb+=	lib/ec2/platform/netbsd/constants.rb
SUBST_VARS.ec2-rb+=	EC2_HOME
SUBST_MESSAGE.ec2-rb=	Setting EC2_HOME constant for EC2 Ruby modules.

PLIST_SUBST+=		EC2_DIR=${EC2_DIR:Q}

INSTALLATION_DIRS+=	bin ${EC2_DIR}
INSTALLATION_DIRS+=	${EC2_DIR}/etc ${EC2_DIR}/bin ${EC2_DIR}/lib

post-extract:
	# Create and copy the NetBSD Ruby modules
	${MKDIR} ${WRKSRC}/lib/ec2/platform/netbsd/
	${CP} ${FILESDIR}/netbsd.rb ${WRKSRC}/lib/ec2/platform/
	${CP} ${FILESDIR}/netbsd/*.rb ${WRKSRC}/lib/ec2/platform/netbsd/

	find ${WRKSRC}/lib ${WRKSRC}/etc -type d -exec \
		${CHMOD} ${PKGDIRMODE} {} \;
	find ${WRKSRC}/lib ${WRKSRC}/etc -type f -exec \
		${CHMOD} ${NONBINMODE} {} \;

do-install:
	${FIND} ${WRKSRC} -name \*.orig -type f -print | ${XARGS} ${RM} -f

	cd ${WRKSRC}/etc && pax -rwpam . ${DESTDIR}${EC2_HOME}/etc
	cd ${WRKSRC}/lib && pax -rwpam . ${DESTDIR}${EC2_HOME}/lib

	cd ${WRKSRC}/bin && for f in *; do			\
		${INSTALL_SCRIPT} $$f ${DESTDIR}${EC2_HOME}/bin;\
		${LN} -sf ${DESTDIR}${EC2_HOME}/bin/$$f		\
			${DESTDIR}${PREFIX}/bin;		\
	done

.include "../../lang/ruby/replace.mk"
.include "../../lang/ruby/rubyversion.mk"
.include "../../mk/bsd.pkg.mk"