Skip to content

Commit

Permalink
Added configure script
Browse files Browse the repository at this point in the history
  • Loading branch information
alquerci committed Oct 3, 2014
1 parent e025035 commit 19aa0a2
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 55 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ python:
- "2.7"

script:
- ./configure
- make distcheck

notifications:
Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
16 changes: 8 additions & 8 deletions Makefile → Makefile.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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\""'
Expand Down
18 changes: 11 additions & 7 deletions bootstrap.mk → bootstrap.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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)


##
Expand Down Expand Up @@ -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

Expand All @@ -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) | \
Expand All @@ -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: "; \
Expand Down
51 changes: 51 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh

set -e;
set -u;

dirname ()
{
if expr $1 : '.*/.*' > /dev/null; then
sed -e s,/[^/]*'$',, <<EOF
$1
EOF
else
cat <<EOF
.
EOF
fi
}

__DIR__=`dirname $0`

files='
bootstrap.mk
Makefile
src/Makefile
doc/Makefile
tools/Makefile
';

for file in $files; do
dir=`dirname $file`;
test -d $dir || mkdir $dir;

top_builddir='.';
test x"$top_builddir" = x"$dir" || top_builddir=`sed -e s,[^/]*,..,g <<EOF
$dir
EOF`;
top_srcdir=$__DIR__/$top_builddir;
srcdir=$top_srcdir/`dirname $file`;
cat <<EOF
creating $file
EOF
cat < $__DIR__/${file}.in \
| sed -e s,'@'srcdir'@',$srcdir,g \
| sed -e s,'@'top_srcdir'@',$top_srcdir,g \
| sed -e s,'@'builddir'@','.',g \
| sed -e s,'@'top_builddir'@',$top_builddir,g \
| sed -e s,'@'SHELL'@','/bin/sh',g \
> ${file};
done;
18 changes: 8 additions & 10 deletions doc/Makefile → doc/Makefile.in
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
28 changes: 12 additions & 16 deletions src/Makefile → src/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
18 changes: 8 additions & 10 deletions tools/Makefile → tools/Makefile.in
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 19aa0a2

Please sign in to comment.