summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2013-10-04 15:02:04 +0200
committerJan Lehnardt <jan@apache.org>2013-10-04 15:02:04 +0200
commit839beb049de7815efe48aefe51aa57fb5e491dfb (patch)
treeeb7b252311ed88132a5664957f79a02ba0506fa1
parent6b48a9a950ece981496c9b5a2af66de9f1ae1418 (diff)
downloadcouchdb-839beb049de7815efe48aefe51aa57fb5e491dfb.tar.gz
custom Makefile for my-first-couchdb-plugin
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am13
-rw-r--r--src/my-first-couchdb-plugin/Makefile.am21
-rw-r--r--src/my-first-couchdb-plugin/Makefile.dist38
4 files changed, 62 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 321c65109..09c34dce9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -737,6 +737,7 @@ AC_CONFIG_FILES([src/couch_mrview/Makefile])
AC_CONFIG_FILES([src/couch_plugins/Makefile])
AC_CONFIG_FILES([src/couch_replicator/Makefile])
AC_CONFIG_FILES([src/couchjs-node/Makefile])
+AC_CONFIG_FILES([src/my-first-couchdb-plugin/Makefile])
AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
AC_CONFIG_FILES([src/couchdb/Makefile])
AC_CONFIG_FILES([src/couchdb/priv/Makefile])
diff --git a/src/Makefile.am b/src/Makefile.am
index d306cd5b2..13e73bf93 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,14 +23,5 @@ SUBDIRS = \
ibrowse \
mochiweb \
snappy \
- couchjs-node
-
-EXTRA_DIST = \
- my-first-couchdb-plugin/.gitignore \
- my-first-couchdb-plugin/Makefile.dist \
- my-first-couchdb-plugin/Makefile.am \
- my-first-couchdb-plugin/priv/default.d/my_first_couchdb_plugin.ini \
- my-first-couchdb-plugin/README.md \
- my-first-couchdb-plugin/src/my_first_couchdb_plugin.app.src \
- my-first-couchdb-plugin/src/my_first_couchdb_plugin.erl \
- my-first-couchdb-plugin/test/my_first_couchdb_plugin_tests.erl
+ couchjs-node \
+ my-first-couchdb-plugin
diff --git a/src/my-first-couchdb-plugin/Makefile.am b/src/my-first-couchdb-plugin/Makefile.am
new file mode 100644
index 000000000..cb3b70f94
--- /dev/null
+++ b/src/my-first-couchdb-plugin/Makefile.am
@@ -0,0 +1,21 @@
+## Licensed under the Apache License, Version 2.0 (the "License"); you may not
+## use this file except in compliance with the License. You may obtain a copy of
+## the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+## License for the specific language governing permissions and limitations under
+## the License.
+
+EXTRA_DIST =
+ .gitignore \
+ Makefile.dist \
+ Makefile.am \
+ priv/default.d/my_first_couchdb_plugin.ini \
+ README.md \
+ src/my_first_couchdb_plugin.app.src \
+ src/my_first_couchdb_plugin.erl \
+ test/my_first_couchdb_plugin_tests.erl
diff --git a/src/my-first-couchdb-plugin/Makefile.dist b/src/my-first-couchdb-plugin/Makefile.dist
new file mode 100644
index 000000000..7806bd7b4
--- /dev/null
+++ b/src/my-first-couchdb-plugin/Makefile.dist
@@ -0,0 +1,38 @@
+## Licensed under the Apache License, Version 2.0 (the "License"); you may not
+## use this file except in compliance with the License. You may obtain a copy of
+## the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+## License for the specific language governing permissions and limitations under
+## the License.
+
+# Customize here
+NAME=my_first_couchdb_plugin
+VERSION=1.0.0
+# Stop customizing here
+
+ERL=$(shell couch-config --erl-bin)
+ERLANG_VERSION=$(shell couch-config --erlang-version)
+COUCHDB_VERSION=$(shell couch-config --couch-version | sed 's/\+.*//')
+PLUGIN_DIRS=ebin priv
+PLUGIN_VERSION_SLUG=$(NAME)-$(VERSION)-$(ERLANG_VERSION)-$(COUCHDB_VERSION)
+PLUGIN_DIST=$(PLUGIN_VERSION_SLUG)
+
+all: compile
+
+compile:
+ ERL_LIBS=$(shell couch-config --erl-libs-dir):$(ERL_LIBS) rebar compile
+
+dev:
+ @ERL_LIBS=$(shell pwd) couchdb -i -a priv/default.d/*.ini
+
+plugin: compile
+ @mkdir -p $(PLUGIN_DIRS)
+ @mkdir -p $(PLUGIN_DIST)
+ @cp -r $(PLUGIN_DIRS) $(PLUGIN_DIST)
+ @tar czf $(PLUGIN_VERSION_SLUG).tar.gz $(PLUGIN_DIST)
+ @$(ERL) -eval 'File = "$(PLUGIN_VERSION_SLUG).tar.gz", {ok, Data} = file:read_file(File),io:format("~s: ~s~n", [File, base64:encode(crypto:sha(Data))]),halt()' -noshell