Repository: couchdb Updated Branches: refs/heads/1994-merge-rcouch 7c5af9a90 -> 283a3b7f4
Enable Windows build Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/283a3b7f Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/283a3b7f Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/283a3b7f Branch: refs/heads/1994-merge-rcouch Commit: 283a3b7f4199f240b25474fbe00026d143c8c2e5 Parents: 7c5af9a Author: Joan Touzet <woh...@apache.org> Authored: Fri Apr 18 20:35:36 2014 -0400 Committer: Joan Touzet <woh...@apache.org> Committed: Fri Apr 18 20:37:39 2014 -0400 ---------------------------------------------------------------------- .gitattributes | 2 ++ .gitignore | 5 +++ Makefile | 96 +++++++++++++++++++++++++++++++-------------------- support/cp.py | 46 ++++++++++++++++++++++++ support/mkdir.py | 8 +++++ support/rm.py | 14 ++++++++ 6 files changed, 133 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/283a3b7f/.gitattributes ---------------------------------------------------------------------- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1135ec5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* -text + http://git-wip-us.apache.org/repos/asf/couchdb/blob/283a3b7f/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index a8a57e4..35945f5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,12 @@ !.mailmap *.beam *.diff +*.exe *.gz *.la *.lo *.o +*.obj *.orig *.pyc *.rej @@ -14,6 +16,7 @@ *.tpl *~ .* +!.gitattributes INSTALL Makefile.in THANKS @@ -28,6 +31,7 @@ support/rebar/rebar support/rebar/inttest/rt.work rt.work rebar +rebar.cmd support/rebar/.test # couch_collate @@ -64,3 +68,4 @@ test/etap/*.o test/etap/temp.* share/doc/build +/log http://git-wip-us.apache.org/repos/asf/couchdb/blob/283a3b7f/Makefile ---------------------------------------------------------------------- diff --git a/Makefile b/Makefile index 3112dab..cfed7ba 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,37 @@ -BASE_DIR = $(shell pwd) +BASE_DIR=$(CURDIR) SUPPORT_DIR=$(BASE_DIR)/support -ERLC ?= $(shell which erlc) -ESCRIPT ?= $(shell which escript) OVERLAY_VARS ?= PACKAGE_NAME=apache-couchdb RELDIR=$(BASE_DIR)/rel/$(PACKAGE_NAME) +ifeq ($(OS),Windows_NT) + ERLC ?= "$(shell where erlc)" + ESCRIPT ?= "$(shell where escript)" + PYTHON ?= "$(shell where python)" + CP=python $(SUPPORT_DIR)/cp.py + RM=python $(SUPPORT_DIR)/rm.py + MKDIR=python $(SUPPORT_DIR)/mkdir.py + CC=cl.exe + COUTFLAG ?= /Fe + CDEFINE ?= /D +else + ERLC ?= "$(shell which erlc)" + ESCRIPT ?= "$(shell which escript)" + PYTHON ?= "$(shell which python)" + CP=cp -r + RM=rm -rf + MKDIR=mkdir -p + CC ?= cc + COUTFLAG ?= -o + CDEFINE ?= -D +endif $(if $(ERLC),,$(warning "Warning: No Erlang found in your path, this will probably not work")) $(if $(ESCRIPT),,$(warning "Warning: No escript found in your path, this will probably not work")) +$(if $(PYTHON),,$(warning "Warning: No python found in your path, this may not work, for Windows or for documentation builds")) + .PHONY: rel deps rebar COUCHDB_STATIC=1 @@ -44,7 +65,7 @@ generate: rel: generate relclean: reldocclean - @rm -rf rel/apache-couchdb + @$(RM) rel/apache-couchdb check: test testjs @@ -52,16 +73,18 @@ check: test testjs # rebar # -rebar: - @(test ! -e $(BASE_DIR)/support/rebar/rebar && \ - echo "==> build rebar" && \ - cd $(BASE_DIR)/support/rebar && \ - $(ESCRIPT) bootstrap || true) - @cp $(BASE_DIR)/support/rebar/rebar $(BASE_DIR)/rebar +rebar: $(BASE_DIR)/rebar + +$(BASE_DIR)/rebar: + @echo "==> build rebar" + @(cd $(BASE_DIR)/support/rebar && $(ESCRIPT) bootstrap) + @$(CP) $(BASE_DIR)/support/rebar/rebar $(BASE_DIR)/rebar + @$(CP) $(BASE_DIR)/support/rebar/rebar.cmd $(BASE_DIR)/rebar.cmd rebarclean: @(cd $(BASE_DIR)/support/rebar && \ - rm -rf rebar ebin/*.beam inttest/rt.work rt.work .test) + $(RM) rebar ebin/*.beam inttest/rt.work rt.work .test) + @$(RM) $(BASE_DIR)/rebar # # DOCS @@ -75,38 +98,35 @@ SPHINXOPTS = -n -c $(DOC_SRCDIR) \ $(DOC_SRCDIR) reldoc: reldocclean doc - mkdir -p $(DOC_RELDIR) - cp -r $(DOC_BUILDDIR)/html $(DOC_RELDIR) - cp -r $(DOC_BUILDDIR)/latex/CouchDB.pdf $(DOC_RELDIR) - cp -r $(DOC_BUILDDIR)/texinfo/CouchDB.info $(DOC_RELDIR) + $(MKDIR) $(DOC_RELDIR) + $(CP) $(DOC_BUILDDIR)/html $(DOC_RELDIR) + $(CP) $(DOC_BUILDDIR)/latex/CouchDB.pdf $(DOC_RELDIR) + $(CP) $(DOC_BUILDDIR)/texinfo/CouchDB.info $(DOC_RELDIR) doc: html pdf texinfo html: - @mkdir -p $(DOC_BUILDDIR) + @$(MKDIR) $(DOC_BUILDDIR) $(SUPPORT_DIR)/doc/sphinx-build \ -b html $(SPHINXOPTS) $(DOC_BUILDDIR)/html pdf: - @mkdir -p $(DOC_BUILDDIR) + @$(MKDIR) $(DOC_BUILDDIR) $(SUPPORT_DIR)/doc/sphinx-build \ -b latex $(SPHINXOPTS) $(DOC_BUILDDIR)/latex $(MAKE) -C $(DOC_BUILDDIR)/latex all-pdf texinfo: - @mkdir -p $(DOC_BUILDDIR) + @$(MKDIR) $(DOC_BUILDDIR) $(SUPPORT_DIR)/doc/sphinx-build \ -b texinfo $(SPHINXOPTS) $(DOC_BUILDDIR)/texinfo $(MAKE) -C $(DOC_BUILDDIR)/texinfo info docclean: - rm -rf $(DOC_BUILDDIR)/textinfo - rm -rf $(DOC_BUILDDIR)/latex - rm -rf $(DOC_BUILDDIR)/html - rm -rf $(DOC_BUILDDIR)/doctrees + $(RM) $(DOC_BUILDDIR) reldocclean: - rm -rf $(DOC_RELDIR) + $(RM) $(DOC_RELDIR) # # TESTS @@ -144,26 +164,26 @@ testjs: testbuild @$(ESCRIPT) $(BASE_DIR)/test/javascript/test_js.escript testbuild: testclean - @echo "==> init test environement" + @echo "==> init test environment" @$(ERLC) -v -o $(COUCHDB_ETAP_DIR) $(COUCHDB_ETAP_DIR)/etap.erl @$(ERLC) -v -o $(COUCHDB_ETAP_DIR) $(COUCHDB_ETAP_DIR)/test_web.erl @$(ERLC) -v -o $(COUCHDB_ETAP_DIR) $(COUCHDB_ETAP_DIR)/test_util.erl @$(ERLC) -v -o $(COUCHDB_ETAP_DIR) $(COUCHDB_ETAP_DIR)/mustache.erl - @cc -DBSD_SOURCE $(COUCHDB_ETAP_DIR)/test_cfg_register.c \ - -o $(COUCHDB_ETAP_DIR)/test_cfg_register - @mkdir -p $(BASE_DIR)/test/out/data - @mkdir -p $(BASE_DIR)/test/out/bin - @mkdir -p $(BASE_DIR)/test/out/share - @mkdir -p $(BASE_DIR)/test/out/log - @cp $(BASE_DIR)/src/couch/priv/couchjs $(BASE_DIR)/test/out/bin/ - @cp -r $(BASE_DIR)/share/server $(BASE_DIR)/test/out/share - @cp -r $(BASE_DIR)/share/www $(BASE_DIR)/test/out/share - @cp $(BASE_DIR)/etc/couchdb/local.ini $(BASE_DIR)/test/out/ + @$(CC) $(CDEFINE)BSD_SOURCE $(COUCHDB_ETAP_DIR)/test_cfg_register.c \ + $(COUTFLAG)$(COUCHDB_ETAP_DIR)/test_cfg_register + @$(MKDIR) $(BASE_DIR)/test/out/data + @$(MKDIR) $(BASE_DIR)/test/out/bin + @$(MKDIR) $(BASE_DIR)/test/out/share + @$(MKDIR) $(BASE_DIR)/test/out/log + @$(CP) $(BASE_DIR)/src/couch/priv/couchjs $(BASE_DIR)/test/out/bin/ + @$(CP) $(BASE_DIR)/share/server $(BASE_DIR)/test/out/share + @$(CP) $(BASE_DIR)/share/www $(BASE_DIR)/test/out/share + @$(CP) $(BASE_DIR)/etc/couchdb/local.ini $(BASE_DIR)/test/out/ testclean: - @rm -rf $(COUCHDB_ETAP_DIR)/*.beam - @rm -rf $(BASE_DIR)/test/out - @rm -rf $(COUCHDB_ETAP_DIR)/test_cfg_register - @rm -rf $(COUCHDB_ETAP_DIR)/*.o + @$(RM) $(COUCHDB_ETAP_DIR)/*.beam + @$(RM) $(BASE_DIR)/test/out + @$(RM) $(COUCHDB_ETAP_DIR)/test_cfg_register + @$(RM) $(COUCHDB_ETAP_DIR)/*.o .PHONY: rebar http://git-wip-us.apache.org/repos/asf/couchdb/blob/283a3b7f/support/cp.py ---------------------------------------------------------------------- diff --git a/support/cp.py b/support/cp.py new file mode 100644 index 0000000..8812ac5 --- /dev/null +++ b/support/cp.py @@ -0,0 +1,46 @@ +from glob import glob +import os +import os +import shutil +import stat +import sys + +# thanks to http://stackoverflow.com/questions/1868714 +def copytree(src, dst, symlinks = False, ignore = None): + if not os.path.exists(dst): + os.makedirs(dst) + shutil.copystat(src, dst) + lst = os.listdir(src) + if ignore: + excl = ignore(src, lst) + lst = [x for x in lst if x not in excl] + for item in lst: + s = os.path.join(src, item) + d = os.path.join(dst, item) + if symlinks and os.path.islink(s): + if os.path.lexists(d): + os.remove(d) + os.symlink(os.readlink(s), d) + try: + st = os.lstat(s) + mode = stat.S_IMODE(st.st_mode) + os.lchmod(d, mode) + except: + pass # lchmod not available + elif os.path.isdir(s): + copytree(s, d, symlinks, ignore) + else: + shutil.copy2(s, d) + +def cp_r(frm, to): + src = frm.replace('/','\\') + dst = to.replace('/','\\') + if os.path.isdir(src): + copytree(src, dst) + else: + for fname in glob(src): + shutil.copy(fname, dst) + +if __name__ == "__main__": + if len(sys.argv) >= 2: + cp_r(sys.argv[1], sys.argv[2]) http://git-wip-us.apache.org/repos/asf/couchdb/blob/283a3b7f/support/mkdir.py ---------------------------------------------------------------------- diff --git a/support/mkdir.py b/support/mkdir.py new file mode 100644 index 0000000..47cd963 --- /dev/null +++ b/support/mkdir.py @@ -0,0 +1,8 @@ +import os +import sys + +if __name__ == "__main__": + if len(sys.argv) == 1: + os.makedirs(sys.argv[1].replace('/','\\')) + + http://git-wip-us.apache.org/repos/asf/couchdb/blob/283a3b7f/support/rm.py ---------------------------------------------------------------------- diff --git a/support/rm.py b/support/rm.py new file mode 100644 index 0000000..01ed5a7 --- /dev/null +++ b/support/rm.py @@ -0,0 +1,14 @@ +import os +import shutil +import sys + +def rm_rf(path): + if os.path.isdir(path): + shutil.rmtree(path) + elif os.path.exists(path): + os.remove(path) + +if __name__ == "__main__": + if len(sys.argv) > 1: + [rm_rf(f) for f in sys.argv[1:]] +