This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile.am
94 lines (84 loc) · 4.15 KB
/
Makefile.am
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
SUBDIRS = deps/jemalloc deps/ruby
bin_SCRIPTS = td
sbin_SCRIPTS = td-agent
MOSTLYCLEANFILES = $(sbin_SCRIPTS)
unexport GEM_HOME
unexport GEM_PATH
DEST_RUBY = $(DESTDIR)$(RUBY_BINDIR)/ruby
DEST_GEM = $(DEST_RUBY) -rrubygems -rrubygems/gem_runner -rrubygems/exceptions -rrubygems/installer -e 'class Gem::Installer; def shebang(bin_file_name) "\#\!$(RUBY_BINDIR)/ruby" end; end; Gem::GemRunner.new.run ARGV'
DEST_FLUENTD_GEM = $(DEST_RUBY) $(DESTDIR)$(RUBY_BINDIR)/gem build fluentd.gemspec
DEST_RUBY_LIBDIR = $(DESTDIR)$(RUBY_LIBDIR)/ruby
PLUGINS = \
httpclient-2.5.3.3.gem td-client-0.8.68.gem td-0.11.8.2.gem fluent-plugin-td-0.10.26.gem \
thrift-0.8.0.gem fluent-plugin-scribe-0.10.14.gem \
fluent-plugin-flume-0.1.1.gem \
bson-1.12.0.gem bson_ext-1.12.0.gem mongo-1.12.0.gem fluent-plugin-mongo-0.7.8.gem \
nokogiri-1.5.10.gem aws-sdk-v1-1.63.0.gem fluent-plugin-s3-0.5.7.gem \
webhdfs-0.6.0.gem fluent-plugin-webhdfs-0.4.1.gem \
fluent-plugin-rewrite-tag-filter-1.4.1.gem \
fluent-plugin-td-monitoring-0.2.0.gem
td: plugins
echo '#!/bin/sh' > $@
echo 'export GEM_HOME="$(RUBY_LIBDIR)/ruby/gems/1.9.1/"' >> $@
echo 'export GEM_PATH="$(RUBY_LIBDIR)/ruby/gems/1.9.1/"' >> $@
echo '$(RUBY_BINDIR)/td "$$@"' >> $@
chmod 755 $@
td-agent: plugins
echo '#!$(RUBY_BINDIR)/ruby' > $@
echo 'ENV["GEM_HOME"]="$(RUBY_LIBDIR)/ruby/gems/1.9.1/"' >> $@
echo 'ENV["GEM_PATH"]="$(RUBY_LIBDIR)/ruby/gems/1.9.1/"' >> $@
echo 'ENV["FLUENT_CONF"]="$(sysconfdir)/td-agent/td-agent.conf"' >> $@
echo 'ENV["FLUENT_PLUGIN"]="$(sysconfdir)/td-agent/plugin"' >> $@
echo 'ENV["FLUENT_SOCKET"]="$(localstatedir)/run/td-agent/td-agent.sock"' >> $@
echo 'load "$(RUBY_BINDIR)/fluentd"' >> $@
chmod 755 $@
plugins:
mkdir -p "$(srcdir)/plugins/"
for gem in $(PLUGINS); do \
if [ ! -f "$(srcdir)/plugins/$$gem" ]; then \
wget "http://rubygems.org/downloads/$$gem" -O "$(srcdir)/plugins/$$gem"; \
fi; \
done
extplugin:
if [ ! -f "$(srcdir)/plugins/$(EXTGEM)" ]; then \
wget "http://rubygems.org/downloads/$(EXTGEM)" -O "$(srcdir)/plugins/$(EXTGEM)"; \
fi
# duplicate of PLUGINS and $(srcdir)/plugins/*.gem depends on install order of nokogiri and aws-sdk (and others)
install: install-recursive
for gem in $(srcdir)/deps/*.gem; do \
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
$(DEST_GEM) install --no-rdoc --no-ri "$$gem"; \
done
cd "$(srcdir)" && \
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
$(DEST_FLUENTD_GEM); \
mkdir -p $(srcdir)/pkg; \
cp -f fluentd-*.gem $(srcdir)/pkg
for gem in $(srcdir)/pkg/*.gem; do \
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
$(DEST_GEM) install --no-rdoc --no-ri "$$gem"; \
done
for gemname in $(PLUGINS); do \
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
$(DEST_GEM) install --no-rdoc --no-ri "$(srcdir)/plugins/$$gemname"; \
done
for gem in $(srcdir)/plugins/*.gem; do \
RUBYLIB="$(DEST_RUBY_LIBDIR)/1.9.1:$(DEST_RUBY_LIBDIR)/1.9.1/$(shell $(DEST_RUBY) --version | sed 's/.*\[\(.*\)\]/\1/')" \
$(DEST_GEM) install --no-rdoc --no-ri "$$gem"; \
done
rm -fR $(DEST_RUBY_LIBDIR)/gems/1.9.1/gems/bson-*/bin/b2json
rm -fR $(DEST_RUBY_LIBDIR)/gems/1.9.1/gems/bson-*/bin/j2bson
rm -fR $(DEST_RUBY_LIBDIR)/gems/1.9.1/gems/td-*/dist/resources/pkg/td
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent
cp -f $(srcdir)/td-agent.conf $(DESTDIR)$(sysconfdir)/td-agent/td-agent.conf.tmpl
if [ -f "$(srcdir)/td-agent.conf.custom" ]; then \
cp -f $(srcdir)/td-agent.conf.custom $(DESTDIR)$(sysconfdir)/td-agent/td-agent.conf.tmpl; \
fi
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent/prelink.conf.d
cp -f $(srcdir)/td-agent.prelink.conf $(DESTDIR)$(sysconfdir)/td-agent/prelink.conf.d/td-agent.conf
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent/logrotate.d
cp -f $(srcdir)/td-agent.logrotate $(DESTDIR)$(sysconfdir)/td-agent/logrotate.d/td-agent.logrotate
mkdir -p $(DESTDIR)$(sysconfdir)/td-agent/plugin
dist:
cd $(srcdir) && ./make_dist.sh
.PHONY: plugins