Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add `make dev` target. Use `./utils/run` to launch CouchDB from the s…

…ource tree and without `make install`. Useful for development. Patch my Hunter Morris, thanks! Closes COUCHDB-114.

git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@707480 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit efe07f99d52d1c5979340e4f79a80abf19b1c710 1 parent f98d836
Jan Lehnardt authored October 23, 2008
11  Makefile.am
@@ -10,7 +10,7 @@
10 10
 ## License for the specific language governing permissions and limitations
11 11
 ## under the License.
12 12
 
13  
-SUBDIRS = bin etc src/couchdb src/mochiweb share test var
  13
+SUBDIRS = bin etc src/couchdb src/mochiweb share test var utils
14 14
 
15 15
 localdoc_DATA = AUTHORS.gz BUGS.gz CHANGES.gz NEWS.gz README.gz THANKS.gz
16 16
 
@@ -36,6 +36,14 @@ README.gz: $(top_srcdir)/README
36 36
 THANKS.gz: $(top_srcdir)/THANKS
37 37
 	-gzip -9 < $< > $@
38 38
 
  39
+dev: all
  40
+	@echo "This command is intended for developers to use;"
  41
+	@echo "it creates development ini files as well as a"
  42
+	@echo "$(top_srcdir)/tmp structure for development runtime files"
  43
+	mkdir -p $(top_srcdir)/tmp/lib
  44
+	mkdir -p $(top_srcdir)/tmp/log
  45
+	mkdir -p $(top_srcdir)/tmp/run
  46
+
39 47
 .PHONY: local-clean
40 48
 local-clean: maintainer-clean
41 49
 	@echo "This command is intended for maintainers to use;"
@@ -49,6 +57,7 @@ local-clean: maintainer-clean
49 57
 	rm -f $(top_srcdir)/*.tar.gz.*
50 58
 	rm -fr $(top_srcdir)/build-aux
51 59
 	rm -fr $(top_srcdir)/m4
  60
+	rm -fr $(top_srcdir)/tmp
52 61
 	find $(top_srcdir) -name Makefile.in -exec rm {} \;
53 62
 
54 63
 .PHONY: distsign
19  bin/Makefile.am
@@ -11,12 +11,13 @@
11 11
 ## under the License.
12 12
 
13 13
 bin_SCRIPTS = couchdb couchjs
  14
+noinst_SCRIPTS = couchjs_dev
14 15
 
15 16
 if HELP2MAN
16 17
 dist_man1_MANS = couchdb.1 couchjs.1
17 18
 endif
18 19
 
19  
-CLEANFILES = $(bin_SCRIPTS) $(dist_man1_MANS)
  20
+CLEANFILES = $(bin_SCRIPTS) $(dist_man1_MANS) $(noinst_SCRIPTS)
20 21
 
21 22
 transform = @program_transform_name@
22 23
 couchdb_command_name = `echo couchdb | sed '$(transform)'`
@@ -26,8 +27,11 @@ couchdb: couchdb.tpl
26 27
 	sed -e "s|%ERL%|$(ERL)|g" \
27 28
 	    -e "s|%ICU_CONFIG%|$(ICU_CONFIG)|g" \
28 29
 	    -e "s|%bindir%|@bindir@|g" \
29  
-	    -e "s|%localerlangbindir%|@localerlangbindir@|g" \
30 30
 	    -e "s|%localerlanglibdir%|@localerlanglibdir@|g" \
  31
+	    -e "s|%mochiwebebindir%|couch-@version@/ebin|g" \
  32
+	    -e "s|%couchdbebindir%|mochiweb-r82/ebin|g" \
  33
+	    -e "s|%defaultini%|default.ini|g" \
  34
+	    -e "s|%localini%|local.ini|g" \
31 35
 	    -e "s|%localconfdir%|@localconfdir@|g" \
32 36
 	    -e "s|%localstatelogdir%|@localstatelogdir@|g" \
33 37
 	    -e "s|%localstatelibdir%|@localstatelibdir@|g" \
@@ -52,6 +56,17 @@ couchjs: couchjs.tpl
52 56
 	$@ < $<
53 57
 	chmod +x $@
54 58
 
  59
+couchjs_dev: couchjs.tpl
  60
+	sed -e "s|%locallibbindir%|$(abs_top_srcdir)/src/couchdb|g" \
  61
+	    -e "s|%bug_uri%|@bug_uri@|g" \
  62
+	    -e "s|%package_author_address%|@package_author_address@|g" \
  63
+	    -e "s|%package_author_name%|@package_author_name@|g" \
  64
+	    -e "s|%package_name%|@package_name@|g" \
  65
+	    -e "s|%version%|@version@|g" \
  66
+	    -e "s|%couchjs_command_name%|$(couchjs_command_name)|g" > \
  67
+	$@ < $<
  68
+	chmod +x $@
  69
+
55 70
 HELP2MAN_OPTION=--no-info --help-option="-h" --version-option="-V"
56 71
 
57 72
 # XXX: Because the scripts are made at build time for the user we need to
8  bin/couchdb.tpl.in
@@ -23,8 +23,8 @@ RECURSED_BOOLEAN=false
23 23
 
24 24
 RESPAWN_TIMEOUT=0
25 25
 
26  
-DEFAULT_INI_FILE=%localconfdir%/default.ini
27  
-LOCAL_INI_FILE=%localconfdir%/local.ini
  26
+DEFAULT_INI_FILE=%localconfdir%/%defaultini%
  27
+LOCAL_INI_FILE=%localconfdir%/%localini%
28 28
 
29 29
 PID_FILE=%localstatedir%/run/couchdb.pid
30 30
 
@@ -181,8 +181,8 @@ start_couchdb () {
181 181
     done
182 182
     command="`%ICU_CONFIG% --invoke` \
183 183
         %ERL% $interactive_option -smp auto -sasl errlog_type error +K true \
184  
-        -pa %localerlanglibdir%/couch-%version%/ebin \
185  
-            %localerlanglibdir%/mochiweb-r82/ebin \
  184
+        -pa %localerlanglibdir%/%couchdbebindir% \
  185
+            %localerlanglibdir%/%mochiwebebindir% \
186 186
         -eval \"application:load(inets)\" \
187 187
         -eval \"application:load(crypto)\" \
188 188
         -eval \"application:load(couch)\" \
1  configure.ac
@@ -248,6 +248,7 @@ AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
248 248
 AC_CONFIG_FILES([src/couchdb/Makefile])
249 249
 AC_CONFIG_FILES([src/mochiweb/Makefile])
250 250
 AC_CONFIG_FILES([test/Makefile])
  251
+AC_CONFIG_FILES([utils/Makefile])
251 252
 AC_CONFIG_FILES([var/Makefile])
252 253
 
253 254
 AC_OUTPUT
15  etc/couchdb/Makefile.am
@@ -11,14 +11,17 @@
11 11
 ## under the License.
12 12
 
13 13
 couchprivlibdir = $(localerlanglibdir)/couch-$(version)/priv/lib
  14
+devcouchprivlibdir = $(abs_top_srcdir)/src/couchdb/.libs
14 15
 
15 16
 localconf_DATA = default.ini
16 17
 EXTRA_DIST = local.ini
  18
+noinst_DATA = default_dev.ini
17 19
 
18  
-CLEANFILES = $(localconf_DATA)
  20
+CLEANFILES = $(localconf_DATA) $(noinst_DATA)
19 21
 
20 22
 transform = @program_transform_name@
21 23
 couchjs_command_name = `echo couchjs | sed '$(transform)'`
  24
+couchjs_dev_command_name = `echo couchjs_dev | sed '$(transform)'`
22 25
 
23 26
 default.ini: default.ini.tpl
24 27
 	sed -e "s|%bindir%|$(bindir)|g" \
@@ -30,6 +33,16 @@ default.ini: default.ini.tpl
30 33
 	    -e "s|%couchjs_command_name%|$(couchjs_command_name)|g" \
31 34
 	< $< > $@
32 35
 
  36
+default_dev.ini: default.ini.tpl
  37
+	sed -e "s|%bindir%|$(abs_top_srcdir)/bin|g" \
  38
+	    -e "s|%localconfdir%|$(abs_top_srcdir)/etc/couchdb|g" \
  39
+	    -e "s|%localdatadir%|$(abs_top_srcdir)/share|g" \
  40
+	    -e "s|%localstatelibdir%|$(abs_top_srcdir)/tmp/lib|g" \
  41
+	    -e "s|%localstatelogdir%|$(abs_top_srcdir)/tmp/log|g" \
  42
+	    -e "s|%couchprivlibdir%|$(devcouchprivlibdir)|g" \
  43
+	    -e "s|%couchjs_command_name%|$(couchjs_dev_command_name)|g" \
  44
+	< $< > $@
  45
+
33 46
 install-data-hook:
34 47
 	if test ! -f "$(DESTDIR)/$(localconfdir)/local.ini"; then \
35 48
 	    cp local.ini "$(DESTDIR)/$(localconfdir)/local.ini"; \
26  etc/couchdb/local_dev.ini
... ...
@@ -0,0 +1,26 @@
  1
+; CouchDB Configuration Settings
  2
+
  3
+; Custom settings should be made in this file. They will override settings
  4
+; in default.ini, but unlike changes made to default.ini, this file won't be
  5
+; overwritten on server upgrade.
  6
+
  7
+[couchdb]
  8
+;max_document_size = 4294967296 ; bytes
  9
+
  10
+[httpd]
  11
+;port = 5984
  12
+;bind_address = 127.0.0.1
  13
+
  14
+[log]
  15
+;level = info
  16
+
  17
+[update_notification]
  18
+;unique notifier name=/full/path/to/exe -with "cmd line arg"
  19
+
  20
+
  21
+
  22
+[test]
  23
+foo = bar
  24
+
  25
+[test]
  26
+foo = bar
41  utils/Makefile.am
... ...
@@ -0,0 +1,41 @@
  1
+## Licensed under the Apache License, Version 2.0 (the "License"); you may not
  2
+## use this file except in compliance with the License.  You may obtain a copy
  3
+## of the License at
  4
+##
  5
+##   http://www.apache.org/licenses/LICENSE-2.0
  6
+##
  7
+## Unless required by applicable law or agreed to in writing, software
  8
+## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  9
+## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
  10
+## License for the specific language governing permissions and limitations
  11
+## under the License.
  12
+
  13
+noinst_SCRIPTS = run
  14
+
  15
+CLEANFILES = $(noinst_SCRIPTS)
  16
+
  17
+transform = @program_transform_name@
  18
+couchdb_command_name = `echo couchdb | sed '$(transform)'`
  19
+
  20
+run: ../bin/couchdb.tpl
  21
+	sed -e "s|%ERL%|$(ERL)|g" \
  22
+	    -e "s|%ICU_CONFIG%|$(ICU_CONFIG)|g" \
  23
+	    -e "s|%bindir%|$(abs_top_srcdir)/bin|g" \
  24
+	    -e "s|%localerlanglibdir%|$(abs_top_srcdir)/src|g" \
  25
+	    -e "s|%mochiwebebindir%|mochiweb|g" \
  26
+	    -e "s|%couchdbebindir%|couchdb|g" \
  27
+	    -e "s|%defaultini%|default_dev.ini|g" \
  28
+	    -e "s|%localini%|local_dev.ini|g" \
  29
+	    -e "s|%localerlanglibdir%|$(abs_top_srcdir)/src|g" \
  30
+	    -e "s|%localconfdir%|$(abs_top_srcdir)/etc/couchdb|g" \
  31
+	    -e "s|%localstatelogdir%|$(abs_top_srcdir)/tmp/log|g" \
  32
+	    -e "s|%localstatelibdir%|$(abs_top_srcdir)/tmp/lib|g" \
  33
+	    -e "s|%localstatedir%|$(abs_top_srcdir)/tmp|g" \
  34
+	    -e "s|%bug_uri%|@bug_uri@|g" \
  35
+	    -e "s|%package_author_address%|@package_author_address@|g" \
  36
+	    -e "s|%package_author_name%|@package_author_name@|g" \
  37
+	    -e "s|%package_name%|@package_name@|g" \
  38
+	    -e "s|%version%|@version@|g" \
  39
+	    -e "s|%couchdb_command_name%|$(couchdb_command_name)|g" > \
  40
+	$@ < $<
  41
+	chmod +x $@

0 notes on commit efe07f9

Please sign in to comment.
Something went wrong with that request. Please try again.