diff --git a/.travis.yml b/.travis.yml index eb02056..c8905d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - "2.7" script: + - ./configure - make distcheck notifications: diff --git a/INSTALL.md b/INSTALL.md index 3700c62..0f9f17b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -12,8 +12,8 @@ without warranty of any kind. Basic Installation ------------------ - Briefly, the shell commands `make; make install` should -build, and install this package. + Briefly, the shell commands `./configure; make; make install` should +configure, build and install this package. The simplest way to compile this package is: diff --git a/Makefile b/Makefile.in similarity index 73% rename from Makefile rename to Makefile.in index ab6b229..0b616e8 100644 --- a/Makefile +++ b/Makefile.in @@ -1,13 +1,12 @@ -override srcdir = . -override top_srcdir = . +override srcdir = @srcdir@ +override top_srcdir = @top_srcdir@ -override builddir = . -override top_builddir = . +override builddir = @builddir@ +override top_builddir = @top_builddir@ override subdirs = src doc tools -override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk) -include $(bootstrap) +include $(top_builddir)/bootstrap.mk INSTALL_DOCS := $(INSTALL_DOCS) $(srcdir)/COPYING INSTALL_DOCS := $(INSTALL_DOCS) $(srcdir)/LICENSE @@ -36,8 +35,9 @@ dist: FORCE tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \ $(INSTALL_DOCS) \ $(srcdir)/VERSION-GEN \ - $(srcdir)/Makefile - tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap)) + $(srcdir)/configure \ + $(srcdir)/bootstrap.mk.in \ + $(srcdir)/Makefile.in $(fn_finalize_dist_archive) installdirs: diff --git a/README.md b/README.md index 1bb3ffc..ea47d60 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,9 @@ Build requirements Install instructions -------------------- -Briefly the following commands should build, test and install this package. +Briefly the following commands should configure, build, test and install this package. + $ ./configure $ make $ make test $ make install diff --git a/appveyor.yml b/appveyor.yml index 8d990d6..2b5cd80 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -92,6 +92,7 @@ install: build: off test_script: + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; ./configure"' - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make distcheck PYTHON=\"$PYTHON\""' - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make install"' - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make install PYTHON=\"$PYTHON\""' diff --git a/bootstrap.mk b/bootstrap.mk.in similarity index 94% rename from bootstrap.mk rename to bootstrap.mk.in index 66fea88..c27cf7e 100644 --- a/bootstrap.mk +++ b/bootstrap.mk.in @@ -11,9 +11,6 @@ # subdirs # may be empty when there is no subdirectory # -override top_srcdir := $(shell test -f $(top_srcdir)/VERSION-GEN && echo $(top_srcdir) || echo $(srcdir)) -override top_builddir := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir) || echo $(builddir)) - # Default target all: @@ -146,7 +143,7 @@ $(VERSION_FILE): FORCE distdir = $(PACKAGE)-$(VERSION) DIST_ARCHIVE = $(builddir)/$(subst /,-,$(distdir))$(tarext) SUB_DIST_ARCHIVES = $(shell $(fn_get_sub_dist_archives)) -DIST_ARCHIVES = $(DIST_ARCHIVE) $(SUB_DIST_ARCHIVES) +DIST_ARCHIVES = $(DIST_ARCHIVE) ## @@ -181,7 +178,7 @@ install-ps: install-ps-recursive installcheck: installcheck-recursive uninstall: uninstall-recursive dist: dist-recursive -distcheck: distcheck-recursive +distcheck: distclean: distclean-recursive maintainer-clean: maintainer-clean-generic maintainer-clean-recursive @@ -200,6 +197,7 @@ fn_finalize_dist_archive = \ list='$(SUB_DIST_ARCHIVES)'; \ for archive in $$list; do \ tar -Af '$(DIST_ARCHIVE)' $$archive; \ + rm $$archive; \ done; \ (echo "$(distdir) archives built: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ @@ -220,11 +218,17 @@ fn_get_sub_dist_archives = \ distcheck: dist tar -xf '$(DIST_ARCHIVE)' -C $(builddir) \ && cd $(builddir)/$(distdir) \ + && installdir="`pwd`/_inst" \ + && destdir="`pwd`/_dest" \ + && builddir="`pwd`/_build" \ + && mkdir "$$builddir" \ + && cd "$$builddir" \ + && ../configure \ && $(MAKE) check \ - && $(MAKE) installcheck prefix="`pwd`/_inst" \ + && $(MAKE) installcheck prefix="$$installdir" \ && $(MAKE) dist \ && $(MAKE) distclean \ - && $(MAKE) install DESTDIR="`pwd`/_dest" \ + && $(MAKE) install DESTDIR="$$destdir" \ || exit 1 rm -rf $(builddir)/$(distdir) @(echo "$(distdir) archives ready for distribution: "; \ diff --git a/configure b/configure new file mode 100755 index 0000000..081d2ab --- /dev/null +++ b/configure @@ -0,0 +1,51 @@ +#!/bin/sh + +set -e; +set -u; + +dirname () +{ + if expr $1 : '.*/.*' > /dev/null; then + sed -e s,/[^/]*'$',, < ${file}; +done; diff --git a/doc/Makefile b/doc/Makefile.in similarity index 55% rename from doc/Makefile rename to doc/Makefile.in index 4bc2c6b..719ed37 100644 --- a/doc/Makefile +++ b/doc/Makefile.in @@ -1,13 +1,12 @@ -override srcdir = . -override top_srcdir = .. +override srcdir = @srcdir@ +override top_srcdir = @top_srcdir@ -override builddir = . -override top_builddir = .. +override builddir = @builddir@ +override top_builddir = @top_builddir@ override subdirs = -override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk) -include $(bootstrap) +include $(top_builddir)/bootstrap.mk all: $(builddir)/$(PACKAGE)$(man1ext).gz @@ -25,10 +24,9 @@ install: all installdirs dist: FORCE $(fn_remove_dist_archive) - tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \ - $(srcdir)/Makefile \ - $(srcdir)/man.1 - tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap)) + tar -C $(srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', \ + Makefile.in \ + man.1 $(fn_finalize_dist_archive) $(builddir)/$(PACKAGE)$(man1ext).gz: $(srcdir)/man.1 diff --git a/src/Makefile b/src/Makefile.in similarity index 74% rename from src/Makefile rename to src/Makefile.in index 46de53e..9b9f58e 100644 --- a/src/Makefile +++ b/src/Makefile.in @@ -1,13 +1,12 @@ -override srcdir = . -override top_srcdir = .. +override srcdir = @srcdir@ +override top_srcdir = @top_srcdir@ -override builddir = . -override top_builddir = .. +override builddir = @builddir@ +override top_builddir = @top_builddir@ override subdirs = -override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk) -include $(bootstrap) +include $(top_builddir)/bootstrap.mk # Print a warning each time it occurs, used for deprecation tests # see https://docs.python.org/2/using/cmdline.html#cmdoption-W @@ -57,16 +56,13 @@ dist: FORCE $(fn_remove_dist_archive) rm -rf $(srcdir)/build $(PYTHON) $(PYTHONFLAGS) $(srcdir)/setup.py build - tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)/build/lib','$(distdir)', $(srcdir)/build/lib/* - tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \ - $(srcdir)/cygwin.sig \ - $(srcdir)/main.in \ - $(srcdir)/Makefile \ - $(srcdir)/postinstall-gen.sh \ - $(srcdir)/setup.py - tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap)) - tar -C $(top_srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', LICENSE - tar -C $(top_srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', README.md + tar -C $(srcdir)/build/lib -rf '$(DIST_ARCHIVE)' --transform s,'^.','$(distdir)', . + tar -C $(srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', \ + cygwin.sig \ + main.in \ + Makefile.in \ + postinstall-gen.sh \ + setup.py $(fn_finalize_dist_archive) distclean: clean diff --git a/src/setup.py b/src/setup.py index acc9c3e..cd1ff7b 100644 --- a/src/setup.py +++ b/src/setup.py @@ -33,7 +33,7 @@ except KeyError: pkgname = "cygapt"; -f = open("../README.md" if os.path.isfile("../README.md") else "./README.md"); +f = open("../README.md"); long_description = f.read(); f.close(); diff --git a/tools/Makefile b/tools/Makefile.in similarity index 53% rename from tools/Makefile rename to tools/Makefile.in index d6d778e..7123913 100644 --- a/tools/Makefile +++ b/tools/Makefile.in @@ -1,13 +1,12 @@ -override srcdir = . -override top_srcdir = .. +override srcdir = @srcdir@ +override top_srcdir = @top_srcdir@ -override builddir = . -override top_builddir = .. +override builddir = @builddir@ +override top_builddir = @top_builddir@ override subdirs = -override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk) -include $(bootstrap) +include $(top_builddir)/bootstrap.mk all: $(builddir)/$(PACKAGE) @@ -25,10 +24,9 @@ install: all installdirs dist: FORCE $(fn_remove_dist_archive) - tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \ - $(srcdir)/Makefile \ - $(srcdir)/completion.bash - tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap)) + tar -C $(srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', \ + Makefile.in \ + completion.bash $(fn_finalize_dist_archive) $(builddir)/$(PACKAGE): $(srcdir)/completion.bash