You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/11 09:07:25 UTC

[23/41] couch commit: updated refs/heads/import-rcouch to f07bbfc

remove Makefile.am from apps/ and fix couchspawnkillable


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/4c23323e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/4c23323e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/4c23323e

Branch: refs/heads/import-rcouch
Commit: 4c23323ee1fb7456368c02785618cca8b0a61f7c
Parents: 70ce400
Author: benoitc <be...@apache.org>
Authored: Tue Jan 7 19:15:43 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 11 02:05:20 2014 -0600

----------------------------------------------------------------------
 c_src/spawnkillable/couchspawnkillable_win.c | 145 ++++++++++++++++
 priv/Makefile.am                             | 151 -----------------
 priv/couchspawnkillable.sh                   |  20 +++
 priv/spawnkillable/couchspawnkillable.sh     |  20 ---
 priv/spawnkillable/couchspawnkillable_win.c  | 145 ----------------
 rebar.config.script                          |  13 +-
 src/Makefile.am                              | 198 ----------------------
 7 files changed, 177 insertions(+), 515 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/c_src/spawnkillable/couchspawnkillable_win.c
----------------------------------------------------------------------
diff --git a/c_src/spawnkillable/couchspawnkillable_win.c b/c_src/spawnkillable/couchspawnkillable_win.c
new file mode 100644
index 0000000..0678231
--- /dev/null
+++ b/c_src/spawnkillable/couchspawnkillable_win.c
@@ -0,0 +1,145 @@
+// 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.
+
+// Do what 2 lines of shell script in couchspawnkillable does...
+// * Create a new suspended process with the same (duplicated) standard 
+//   handles as us.
+// * Write a line to stdout, consisting of the path to ourselves, plus
+//   '--kill {pid}' where {pid} is the PID of the newly created process.
+// * Un-suspend the new process.
+// * Wait for the process to terminate.
+// * Terminate with the child's exit-code.
+
+// Later, couch will call us with --kill and the PID, so we dutifully
+// terminate the specified PID.
+
+#include <stdlib.h>
+#include "windows.h"
+
+char *get_child_cmdline(int argc, char **argv)
+{
+    // make a new command-line, but skipping me.
+    // XXX - todo - spaces etc in args???
+    int i;
+    char *p, *cmdline;
+    int nchars = 0;
+    int nthis = 1;
+    for (i=1;i<argc;i++)
+        nchars += strlen(argv[i])+1;
+    cmdline = p = malloc(nchars+1);
+    if (!cmdline)
+        return NULL;
+    for (i=1;i<argc;i++) {
+        nthis = strlen(argv[i]);
+        strncpy(p, argv[i], nthis);
+        p[nthis] = ' ';
+        p += nthis+1;
+    }
+    // Replace the last space we added above with a '\0'
+    cmdline[nchars-1] = '\0';
+    return cmdline;
+}
+
+// create the child process, returning 0, or the exit-code we will
+// terminate with.
+int create_child(int argc, char **argv, PROCESS_INFORMATION *pi)
+{
+    char buf[1024];
+    DWORD dwcreate;
+    STARTUPINFO si;
+    char *cmdline;
+    if (argc < 2)
+        return 1;
+    cmdline = get_child_cmdline(argc, argv);
+    if (!cmdline)
+        return 2;
+
+    memset(&si, 0, sizeof(si));
+    si.cb = sizeof(si);
+    // depending on how *our* parent is started, we may or may not have
+    // a valid stderr stream - so although we try and duplicate it, only
+    // failing to duplicate stdin and stdout are considered fatal.
+    if (!DuplicateHandle(GetCurrentProcess(),
+                       GetStdHandle(STD_INPUT_HANDLE),
+                       GetCurrentProcess(),
+                       &si.hStdInput,
+                       0,
+                       TRUE, // inheritable
+                       DUPLICATE_SAME_ACCESS) ||
+       !DuplicateHandle(GetCurrentProcess(),
+                       GetStdHandle(STD_OUTPUT_HANDLE),
+                       GetCurrentProcess(),
+                       &si.hStdOutput,
+                       0,
+                       TRUE, // inheritable
+                       DUPLICATE_SAME_ACCESS)) {
+        return 3;
+    }
+    DuplicateHandle(GetCurrentProcess(),
+                   GetStdHandle(STD_ERROR_HANDLE),
+                   GetCurrentProcess(),
+                   &si.hStdError,
+                   0,
+                   TRUE, // inheritable
+                   DUPLICATE_SAME_ACCESS);
+
+    si.dwFlags = STARTF_USESTDHANDLES;
+    dwcreate = CREATE_SUSPENDED;
+    if (!CreateProcess( NULL, cmdline,
+                        NULL,
+                        NULL,
+                        TRUE, // inherit handles
+                        dwcreate,
+                        NULL, // environ
+                        NULL, // cwd
+                        &si,
+                        pi))
+        return 4;
+    return 0;
+}
+
+// and here we go...
+int main(int argc, char **argv)
+{
+    char out_buf[1024];
+    int rc;
+    DWORD cbwritten;
+    DWORD exitcode;
+    PROCESS_INFORMATION pi;
+    if (argc==3 && strcmp(argv[1], "--kill")==0) {
+        HANDLE h = OpenProcess(PROCESS_TERMINATE, 0, atoi(argv[2]));
+        if (!h)
+            return 1;
+        if (!TerminateProcess(h, 0))
+            return 2;
+        CloseHandle(h);
+        return 0;
+    }
+    // spawn the new suspended process
+    rc = create_child(argc, argv, &pi);
+    if (rc)
+        return rc;
+    // Write the 'terminate' command, which includes this PID, back to couch.
+    // *sob* - what about spaces etc?
+    sprintf_s(out_buf, sizeof(out_buf), "%s --kill %d\n", 
+              argv[0], pi.dwProcessId);
+    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), out_buf, strlen(out_buf), 
+              &cbwritten, NULL);
+    // Let the child process go...
+    ResumeThread(pi.hThread);
+    // Wait for the process to terminate so we can reflect the exit code
+    // back to couch.
+    WaitForSingleObject(pi.hProcess, INFINITE);
+    if (!GetExitCodeProcess(pi.hProcess, &exitcode))
+        return 6;
+    return exitcode;
+}

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/priv/Makefile.am
----------------------------------------------------------------------
diff --git a/priv/Makefile.am b/priv/Makefile.am
deleted file mode 100644
index 9a24222..0000000
--- a/priv/Makefile.am
+++ /dev/null
@@ -1,151 +0,0 @@
-## 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.
-
-MAKE_SAFE = $(MAKE)
-
-couchlibdir = $(localerlanglibdir)/couch-$(version)
-couchprivdir = $(couchlibdir)/priv
-couchprivlibdir = $(couchlibdir)/priv/lib
-man1dir = $(mandir)/man1
-
-man_file = couchjs.1
-
-if BUILD_MAN
-man_file_build = $(man_file)
-else
-man_file_build =
-endif
-
-BUILT_SOURCES = $(man_file_build)
-
-EXTRA_DIST = \
-	spawnkillable/couchspawnkillable.sh \
-	stat_descriptions.cfg.in \
-	couch_ejson_compare/erl_nif_compat.h \
-	couch_js/sm170.c \
-	couch_js/sm180.c \
-	couch_js/sm185.c \
-	$(man_file_build)
-
-CLEANFILES = $(man_file_build) stat_descriptions.cfg
-
-couchprivlib_LTLIBRARIES = couch_icu_driver.la
-if USE_EJSON_COMPARE_NIF
-couchprivlib_LTLIBRARIES += couch_ejson_compare.la
-couch_ejson_compare_la_SOURCES = couch_ejson_compare/couch_ejson_compare.c
-couch_ejson_compare_la_CPPFLAGS = -D_BSD_SOURCE $(ICU_CPPFLAGS) $(ERLANG_FLAGS)
-couch_ejson_compare_la_LDFLAGS = -module -avoid-version
-couch_ejson_compare_la_LIBADD = $(ICU_LIBS)
-if WINDOWS
-couch_ejson_compare_la_LDFLAGS += -no-undefined
-endif
-endif
-couch_icu_driver_la_SOURCES = icu_driver/couch_icu_driver.c
-couch_icu_driver_la_LDFLAGS = -module -avoid-version
-couch_icu_driver_la_CPPFLAGS = $(ICU_CPPFLAGS) $(ERLANG_FLAGS)
-couch_icu_driver_la_LIBADD = $(ICU_LIBS)
-
-if WINDOWS
-couch_icu_driver_la_LDFLAGS += -no-undefined
-endif
-
-COUCHJS_SRCS = \
-	couch_js/help.h \
-	couch_js/http.c \
-	couch_js/http.h \
-	couch_js/main.c \
-	couch_js/utf8.c \
-	couch_js/utf8.h \
-	couch_js/util.h \
-	couch_js/util.c
-
-locallibbin_PROGRAMS = couchjs
-couchjs_SOURCES = $(COUCHJS_SRCS)
-couchjs_CFLAGS = -g -Wall -Werror -D_BSD_SOURCE $(CURL_CFLAGS) $(JS_CFLAGS)
-couchjs_LDADD = $(CURL_LIBS) $(JS_LIBS)
-
-couchpriv_DATA = stat_descriptions.cfg
-couchpriv_PROGRAMS = couchspawnkillable
-
-# Depend on source files so distributed man pages are not rebuilt for end user.
-
-$(man_file): $(COUCHJS_SRCS)
-	$(MAKE_SAFE) -f Makefile couchjs; \
-	$(top_srcdir)/build-aux/missing --run \
-	    help2man \
-	        --no-info \
-	        --help-option="-h" \
-	        --version-option="-V" \
-	        --name="$(package_name) JavaScript interpreter" \
-	        ./couchjs --output $@
-
-install-data-local:
-	if test -s $(man_file); then \
-	    if test `cat $(man_file) | wc -l` -gt 1; then \
-	        $(INSTALL) -d $(DESTDIR)$(man1dir); \
-	        $(INSTALL_DATA) $(man_file) $(DESTDIR)$(man1dir)/$(man_file); \
-	    fi \
-	fi
-
-%.cfg: %.cfg.in
-	cp $< $@
-
-if WINDOWS
-couchspawnkillable_SOURCES = spawnkillable/couchspawnkillable_win.c
-endif
-
-if !WINDOWS
-couchspawnkillable: spawnkillable/couchspawnkillable.sh
-	cp $< $@
-	chmod +x $@
-endif
-
-# libtool and automake have defeated markh.  For each of our executables
-# we end up with 2 copies - one directly in the 'target' folder (eg, 'priv')
-# and another - the correct one - in .libs.  The former doesn't work but is
-# what gets installed for 'couchspawnkillable' - but the correct one for
-# couchjs.exe *does* get copied.  *shrug*  So just clobber it with the
-# correct one as the last step. See bug COUCHDB-439
-install-data-hook:
-	if test -f "$(DESTDIR)$(couchprivlibdir)/couch_icu_driver"; then \
-	    rm -f "$(DESTDIR)$(couchprivlibdir)/couch_icu_driver.so"; \
-	    cd "$(DESTDIR)$(couchprivlibdir)" && \
-	        $(LN_S) couch_icu_driver couch_icu_driver.so; \
-	fi
-	if test -f "$(DESTDIR)$(couchprivlibdir)/couch_ejson_compare_nif"; then \
-	    rm -f "$(DESTDIR)$(couchprivlibdir)/couch_ejson_compare_nif.so"; \
-	    cd "$(DESTDIR)$(couchprivlibdir)" && \
-	        $(LN_S) couch_ejson_compare_nif couch_ejson_compare_nif.so; \
-	fi
-if WINDOWS
-	$(INSTALL) $(ICU_BIN)/icuuc*.dll $(bindir)
-	$(INSTALL) $(ICU_BIN)/icudt*.dll $(bindir)
-	$(INSTALL) $(ICU_BIN)/icuin*.dll $(bindir)
-	$(INSTALL) $(JS_LIB_BINARY) $(bindir)
-	$(INSTALL) .libs/couchspawnkillable.exe \
-		"$(DESTDIR)$(couchprivdir)/couchspawnkillable.exe"
-endif
-
-uninstall-local:
-	rm -f $(DESTDIR)$(man1dir)/$(man_file)
-	if test -f "$(DESTDIR)$(couchprivlibdir)/couch_erl_driver"; then \
-	    rm -f "$(DESTDIR)$(couchprivlibdir)/couch_erl_driver.so"; \
-	fi
-
-distcheck-hook:
-	if test ! -s $(man_file); then \
-	    $(top_srcdir)/build-aux/dist-error $(man_file); \
-	else \
-	    if test ! `cat $(man_file) | wc -l` -gt 1; then \
-	        $(top_srcdir)/build-aux/dist-error $(man_file); \
-	    fi \
-	fi

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/priv/couchspawnkillable.sh
----------------------------------------------------------------------
diff --git a/priv/couchspawnkillable.sh b/priv/couchspawnkillable.sh
new file mode 100755
index 0000000..f8d042e
--- /dev/null
+++ b/priv/couchspawnkillable.sh
@@ -0,0 +1,20 @@
+#! /bin/sh -e
+
+# 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.
+
+# The purpose of this script is to echo an OS specific command before launching
+# the actual process. This provides a way for Erlang to hard-kill its external
+# processes.
+
+echo "kill -9 $$"
+exec $*

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/priv/spawnkillable/couchspawnkillable.sh
----------------------------------------------------------------------
diff --git a/priv/spawnkillable/couchspawnkillable.sh b/priv/spawnkillable/couchspawnkillable.sh
deleted file mode 100644
index f8d042e..0000000
--- a/priv/spawnkillable/couchspawnkillable.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#! /bin/sh -e
-
-# 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.
-
-# The purpose of this script is to echo an OS specific command before launching
-# the actual process. This provides a way for Erlang to hard-kill its external
-# processes.
-
-echo "kill -9 $$"
-exec $*

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/priv/spawnkillable/couchspawnkillable_win.c
----------------------------------------------------------------------
diff --git a/priv/spawnkillable/couchspawnkillable_win.c b/priv/spawnkillable/couchspawnkillable_win.c
deleted file mode 100644
index 0678231..0000000
--- a/priv/spawnkillable/couchspawnkillable_win.c
+++ /dev/null
@@ -1,145 +0,0 @@
-// 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.
-
-// Do what 2 lines of shell script in couchspawnkillable does...
-// * Create a new suspended process with the same (duplicated) standard 
-//   handles as us.
-// * Write a line to stdout, consisting of the path to ourselves, plus
-//   '--kill {pid}' where {pid} is the PID of the newly created process.
-// * Un-suspend the new process.
-// * Wait for the process to terminate.
-// * Terminate with the child's exit-code.
-
-// Later, couch will call us with --kill and the PID, so we dutifully
-// terminate the specified PID.
-
-#include <stdlib.h>
-#include "windows.h"
-
-char *get_child_cmdline(int argc, char **argv)
-{
-    // make a new command-line, but skipping me.
-    // XXX - todo - spaces etc in args???
-    int i;
-    char *p, *cmdline;
-    int nchars = 0;
-    int nthis = 1;
-    for (i=1;i<argc;i++)
-        nchars += strlen(argv[i])+1;
-    cmdline = p = malloc(nchars+1);
-    if (!cmdline)
-        return NULL;
-    for (i=1;i<argc;i++) {
-        nthis = strlen(argv[i]);
-        strncpy(p, argv[i], nthis);
-        p[nthis] = ' ';
-        p += nthis+1;
-    }
-    // Replace the last space we added above with a '\0'
-    cmdline[nchars-1] = '\0';
-    return cmdline;
-}
-
-// create the child process, returning 0, or the exit-code we will
-// terminate with.
-int create_child(int argc, char **argv, PROCESS_INFORMATION *pi)
-{
-    char buf[1024];
-    DWORD dwcreate;
-    STARTUPINFO si;
-    char *cmdline;
-    if (argc < 2)
-        return 1;
-    cmdline = get_child_cmdline(argc, argv);
-    if (!cmdline)
-        return 2;
-
-    memset(&si, 0, sizeof(si));
-    si.cb = sizeof(si);
-    // depending on how *our* parent is started, we may or may not have
-    // a valid stderr stream - so although we try and duplicate it, only
-    // failing to duplicate stdin and stdout are considered fatal.
-    if (!DuplicateHandle(GetCurrentProcess(),
-                       GetStdHandle(STD_INPUT_HANDLE),
-                       GetCurrentProcess(),
-                       &si.hStdInput,
-                       0,
-                       TRUE, // inheritable
-                       DUPLICATE_SAME_ACCESS) ||
-       !DuplicateHandle(GetCurrentProcess(),
-                       GetStdHandle(STD_OUTPUT_HANDLE),
-                       GetCurrentProcess(),
-                       &si.hStdOutput,
-                       0,
-                       TRUE, // inheritable
-                       DUPLICATE_SAME_ACCESS)) {
-        return 3;
-    }
-    DuplicateHandle(GetCurrentProcess(),
-                   GetStdHandle(STD_ERROR_HANDLE),
-                   GetCurrentProcess(),
-                   &si.hStdError,
-                   0,
-                   TRUE, // inheritable
-                   DUPLICATE_SAME_ACCESS);
-
-    si.dwFlags = STARTF_USESTDHANDLES;
-    dwcreate = CREATE_SUSPENDED;
-    if (!CreateProcess( NULL, cmdline,
-                        NULL,
-                        NULL,
-                        TRUE, // inherit handles
-                        dwcreate,
-                        NULL, // environ
-                        NULL, // cwd
-                        &si,
-                        pi))
-        return 4;
-    return 0;
-}
-
-// and here we go...
-int main(int argc, char **argv)
-{
-    char out_buf[1024];
-    int rc;
-    DWORD cbwritten;
-    DWORD exitcode;
-    PROCESS_INFORMATION pi;
-    if (argc==3 && strcmp(argv[1], "--kill")==0) {
-        HANDLE h = OpenProcess(PROCESS_TERMINATE, 0, atoi(argv[2]));
-        if (!h)
-            return 1;
-        if (!TerminateProcess(h, 0))
-            return 2;
-        CloseHandle(h);
-        return 0;
-    }
-    // spawn the new suspended process
-    rc = create_child(argc, argv, &pi);
-    if (rc)
-        return rc;
-    // Write the 'terminate' command, which includes this PID, back to couch.
-    // *sob* - what about spaces etc?
-    sprintf_s(out_buf, sizeof(out_buf), "%s --kill %d\n", 
-              argv[0], pi.dwProcessId);
-    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), out_buf, strlen(out_buf), 
-              &cbwritten, NULL);
-    // Let the child process go...
-    ResumeThread(pi.hThread);
-    // Wait for the process to terminate so we can reflect the exit code
-    // back to couch.
-    WaitForSingleObject(pi.hProcess, INFINITE);
-    if (!GetExitCodeProcess(pi.hProcess, &exitcode))
-        return 6;
-    return exitcode;
-}

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index fb93f97..ca79b39 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -85,13 +85,24 @@ end,
     _ -> {CFLAGS, LDFLAGS ++ " -lcurl"}
 end,
 
+PortSpecs0 = case os:type() of
+    {win32, _} ->
+        [{filename:join(["priv", "couchspawnkillable"]),
+            ["c_src/spawnkillable/*.c"]}];
+    _ ->
+        {ok, _} = file:copy("priv/couchspawnkillable.sh",
+                            "priv/couchspawnkillable"),
+        os:cmd("chmod +x priv/couchspawnkillable"),
+        []
+    end,
+
 PortEnv = [{port_env, [
             {"CFLAGS",  "$CFLAGS -Wall -c -g -O2 " ++ CFLAGS1},
             {"LDFLAGS", "$LDFLAGS " ++ LDFLAGS1}]},
 
            {port_specs, [
             {filename:join(["priv", CouchJSName]),
-            ["c_src/couch_js/*.c"]}]}
+            ["c_src/couch_js/*.c"]}] ++ PortSpecs0}
 ],
 
 lists:keymerge(1,lists:keysort(1, PortEnv), lists:keysort(1, CONFIG)).

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/4c23323e/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 9fe19bc..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,198 +0,0 @@
-## 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.
-
-SUBDIRS = priv
-
-# devdocdir = $(localdocdir)/developer/couchdb
-couchlibdir = $(localerlanglibdir)/couch-$(version)
-couchincludedir = $(couchlibdir)/include
-couchebindir = $(couchlibdir)/ebin
-
-couchinclude_DATA = couch_db.hrl couch_js_functions.hrl
-couchebin_DATA = $(compiled_files)
-
-# dist_devdoc_DATA = $(doc_base) $(doc_modules)
-
-CLEANFILES = $(compiled_files) $(doc_base)
-
-# CLEANFILES = $(doc_modules) edoc-info
-
-source_files = \
-    couch.erl \
-    couch_app.erl \
-    couch_auth_cache.erl \
-    couch_btree.erl \
-    couch_changes.erl \
-    couch_compaction_daemon.erl \
-    couch_compress.erl \
-    couch_config.erl \
-    couch_config_writer.erl \
-    couch_db.erl \
-    couch_db_update_notifier.erl \
-    couch_db_update_notifier_sup.erl \
-    couch_doc.erl \
-    couch_drv.erl \
-    couch_ejson_compare.erl \
-    couch_event_sup.erl \
-    couch_external_manager.erl \
-    couch_external_server.erl \
-    couch_file.erl \
-    couch_httpd.erl \
-    couch_httpd_db.erl \
-    couch_httpd_auth.erl \
-    couch_httpd_cors.erl \
-    couch_httpd_oauth.erl \
-    couch_httpd_external.erl \
-    couch_httpd_misc_handlers.erl \
-    couch_httpd_proxy.erl \
-    couch_httpd_rewrite.erl \
-    couch_httpd_stats_handlers.erl \
-    couch_httpd_vhost.erl \
-    couch_key_tree.erl \
-    couch_log.erl \
-    couch_native_process.erl \
-    couch_os_daemons.erl \
-    couch_os_process.erl \
-    couch_passwords.erl \
-    couch_primary_sup.erl \
-    couch_query_servers.erl \
-    couch_ref_counter.erl \
-    couch_secondary_sup.erl \
-    couch_server.erl \
-    couch_server_sup.erl \
-    couch_stats_aggregator.erl \
-    couch_stats_collector.erl \
-    couch_stream.erl \
-    couch_task_status.erl \
-    couch_users_db.erl \
-    couch_util.erl \
-    couch_uuids.erl \
-    couch_db_updater.erl \
-    couch_work_queue.erl \
-    json_stream_parse.erl
-
-EXTRA_DIST = $(source_files) couch_db.hrl couch_js_functions.hrl
-
-compiled_files = \
-    couch.app \
-    couch.beam \
-    couch_app.beam \
-    couch_auth_cache.beam \
-    couch_btree.beam \
-    couch_changes.beam \
-    couch_compaction_daemon.beam \
-    couch_compress.beam \
-    couch_config.beam \
-    couch_config_writer.beam \
-    couch_db.beam \
-    couch_db_update_notifier.beam \
-    couch_db_update_notifier_sup.beam \
-    couch_doc.beam \
-    couch_drv.beam \
-    couch_ejson_compare.beam \
-    couch_event_sup.beam \
-    couch_external_manager.beam \
-    couch_external_server.beam \
-    couch_file.beam \
-    couch_httpd.beam \
-    couch_httpd_db.beam \
-    couch_httpd_auth.beam \
-    couch_httpd_oauth.beam \
-    couch_httpd_cors.beam \
-    couch_httpd_proxy.beam \
-    couch_httpd_external.beam \
-    couch_httpd_misc_handlers.beam \
-    couch_httpd_rewrite.beam \
-    couch_httpd_stats_handlers.beam \
-    couch_httpd_vhost.beam \
-    couch_key_tree.beam \
-    couch_log.beam \
-    couch_native_process.beam \
-    couch_os_daemons.beam \
-    couch_os_process.beam \
-    couch_passwords.beam \
-    couch_primary_sup.beam \
-    couch_query_servers.beam \
-    couch_ref_counter.beam \
-    couch_secondary_sup.beam \
-    couch_server.beam \
-    couch_server_sup.beam \
-    couch_stats_aggregator.beam \
-    couch_stats_collector.beam \
-    couch_stream.beam \
-    couch_task_status.beam \
-    couch_users_db.beam \
-    couch_util.beam \
-    couch_uuids.beam \
-    couch_db_updater.beam \
-    couch_work_queue.beam \
-    json_stream_parse.beam
-
-# doc_base = \
-#     erlang.png \
-#     index.html \
-#     modules-frame.html \
-#     overview-summary.html \
-#     packages-frame.html \
-#     stylesheet.css
-
-# doc_modules = \
-#     couch_btree.html \
-#     couch_config.html \
-#     couch_config_writer.html \
-#     couch_db.html \
-#     couch_db_update_notifier.html \
-#     couch_db_update_notifier_sup.html \
-#     couch_doc.html \
-#     couch_event_sup.html \
-#     couch_file.html \
-#     couch_httpd.html \
-#     couch_key_tree.html \
-#     couch_log.html \
-#     couch_query_servers.html \
-#     couch_rep.html \
-#     couch_rep_sup.html \
-#     couch_server.html \
-#     couch_server_sup.html \
-#     couch_stream.html \
-#     couch_util.html
-
-if WINDOWS
-couch.app: couch.app.tpl
-	modules=`find . -name "*.erl" \! -name ".*" -exec basename {} .erl \; | tr '\n' ',' | sed "s/,$$//"`; \
-	sed -e "s|%package_name%|@package_name@|g" \
-			-e "s|%version%|@version@|g" \
-			-e "s|@modules@|$$modules|g" \
-			-e "s|%localconfdir%|../etc/couchdb|g" \
-			-e "s|@defaultini@|default.ini|g" \
-			-e "s|@localini@|local.ini|g" > \
-	$@ < $<
-else
-couch.app: couch.app.tpl
-	modules=`{ find . -name "*.erl" \! -name ".*" -exec basename {} .erl \; | tr '\n' ','; echo ''; } | sed "s/,$$//"`; \
-	sed -e "s|%package_name%|@package_name@|g" \
-			-e "s|%version%|@version@|g" \
-			-e "s|@modules@|$$modules|g" \
-			-e "s|%localconfdir%|@localconfdir@|g" \
-			-e "s|@defaultini@|default.ini|g" \
-			-e "s|@localini@|local.ini|g" > \
-	$@ < $<
-	chmod +x $@
-endif
-
-# $(dist_devdoc_DATA): edoc-info
-
-# $(ERL) -noshell -run edoc_run files [\"$<\"]
-
-%.beam: %.erl couch_db.hrl couch_js_functions.hrl
-	$(ERLC) $(ERLC_FLAGS) ${TEST} $<;
-