Skip to content

Commit aa78939

Browse files
committed
Added configure script
1 parent e025035 commit aa78939

11 files changed

Lines changed: 101 additions & 55 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ python:
55
- "2.7"
66

77
script:
8+
- ./configure
89
- make distcheck
910

1011
notifications:

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ without warranty of any kind.
1212
Basic Installation
1313
------------------
1414

15-
Briefly, the shell commands `make; make install` should
16-
build, and install this package.
15+
Briefly, the shell commands `./configure; make; make install` should
16+
configure, build and install this package.
1717

1818
The simplest way to compile this package is:
1919

Makefile renamed to Makefile.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
override srcdir = .
2-
override top_srcdir = .
1+
override srcdir = @srcdir@
2+
override top_srcdir = @top_srcdir@
33

4-
override builddir = .
5-
override top_builddir = .
4+
override builddir = @builddir@
5+
override top_builddir = @top_builddir@
66

77
override subdirs = src doc tools
88

9-
override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk)
10-
include $(bootstrap)
9+
include $(top_builddir)/bootstrap.mk
1110

1211
INSTALL_DOCS := $(INSTALL_DOCS) $(srcdir)/COPYING
1312
INSTALL_DOCS := $(INSTALL_DOCS) $(srcdir)/LICENSE
@@ -36,8 +35,9 @@ dist: FORCE
3635
tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \
3736
$(INSTALL_DOCS) \
3837
$(srcdir)/VERSION-GEN \
39-
$(srcdir)/Makefile
40-
tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap))
38+
$(srcdir)/configure \
39+
$(srcdir)/bootstrap.mk.in \
40+
$(srcdir)/Makefile.in
4141
$(fn_finalize_dist_archive)
4242

4343
installdirs:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ Build requirements
2727
Install instructions
2828
--------------------
2929

30-
Briefly the following commands should build, test and install this package.
30+
Briefly the following commands should configure, build, test and install this package.
3131

32+
$ ./configure
3233
$ make
3334
$ make test
3435
$ make install

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ install:
9292
build: off
9393

9494
test_script:
95+
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; ./configure"'
9596
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make distcheck PYTHON=\"$PYTHON\""'
9697
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make install"'
9798
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make install PYTHON=\"$PYTHON\""'

bootstrap.mk renamed to bootstrap.mk.in

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
# subdirs # may be empty when there is no subdirectory
1212
#
1313

14-
override top_srcdir := $(shell test -f $(top_srcdir)/VERSION-GEN && echo $(top_srcdir) || echo $(srcdir))
15-
override top_builddir := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir) || echo $(builddir))
16-
1714
# Default target
1815
all:
1916

@@ -146,7 +143,7 @@ $(VERSION_FILE): FORCE
146143
distdir = $(PACKAGE)-$(VERSION)
147144
DIST_ARCHIVE = $(builddir)/$(subst /,-,$(distdir))$(tarext)
148145
SUB_DIST_ARCHIVES = $(shell $(fn_get_sub_dist_archives))
149-
DIST_ARCHIVES = $(DIST_ARCHIVE) $(SUB_DIST_ARCHIVES)
146+
DIST_ARCHIVES = $(DIST_ARCHIVE)
150147

151148

152149
##
@@ -181,7 +178,7 @@ install-ps: install-ps-recursive
181178
installcheck: installcheck-recursive
182179
uninstall: uninstall-recursive
183180
dist: dist-recursive
184-
distcheck: distcheck-recursive
181+
distcheck:
185182
distclean: distclean-recursive
186183
maintainer-clean: maintainer-clean-generic maintainer-clean-recursive
187184

@@ -200,6 +197,7 @@ fn_finalize_dist_archive = \
200197
list='$(SUB_DIST_ARCHIVES)'; \
201198
for archive in $$list; do \
202199
tar -Af '$(DIST_ARCHIVE)' $$archive; \
200+
rm $$archive; \
203201
done; \
204202
(echo "$(distdir) archives built: "; \
205203
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
@@ -220,11 +218,17 @@ fn_get_sub_dist_archives = \
220218
distcheck: dist
221219
tar -xf '$(DIST_ARCHIVE)' -C $(builddir) \
222220
&& cd $(builddir)/$(distdir) \
221+
&& installdir="`pwd`/_inst" \
222+
&& destdir="`pwd`/_dest" \
223+
&& builddir="`pwd`/_build" \
224+
&& mkdir "$$builddir" \
225+
&& cd "$$builddir" \
226+
&& ../configure \
223227
&& $(MAKE) check \
224-
&& $(MAKE) installcheck prefix="`pwd`/_inst" \
228+
&& $(MAKE) installcheck prefix="$$installdir" \
225229
&& $(MAKE) dist \
226230
&& $(MAKE) distclean \
227-
&& $(MAKE) install DESTDIR="`pwd`/_dest" \
231+
&& $(MAKE) install DESTDIR="$$destdir" \
228232
|| exit 1
229233
rm -rf $(builddir)/$(distdir)
230234
@(echo "$(distdir) archives ready for distribution: "; \

configure

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
set -e;
4+
set -u;
5+
6+
dirname ()
7+
{
8+
if expr $1 : '.*/.*' > /dev/null; then
9+
sed -e s,/[^/]*'$',, <<EOF
10+
$1
11+
EOF
12+
else
13+
cat <<EOF
14+
.
15+
EOF
16+
fi
17+
}
18+
19+
__DIR__=`dirname $0`
20+
21+
files='
22+
bootstrap.mk
23+
Makefile
24+
src/Makefile
25+
doc/Makefile
26+
tools/Makefile
27+
';
28+
29+
for file in $files; do
30+
dir=`dirname $file`;
31+
test -d $dir || mkdir $dir;
32+
33+
top_builddir='.';
34+
test x"$top_builddir" = x"$dir" || top_builddir=`sed -e s,[^/]*,..,g <<EOF
35+
$dir
36+
EOF`;
37+
top_srcdir=$__DIR__/$top_builddir;
38+
srcdir=$top_srcdir/`dirname $file`;
39+
40+
cat < $__DIR__/${file}.in \
41+
| sed -e s,'@'srcdir'@',$srcdir,g \
42+
| sed -e s,'@'top_srcdir'@',$top_srcdir,g \
43+
| sed -e s,'@'builddir'@','.',g \
44+
| sed -e s,'@'top_builddir'@',$top_builddir,g \
45+
| sed -e s,'@'SHELL'@','/bin/sh',g \
46+
> ${file};
47+
done;

doc/Makefile renamed to doc/Makefile.in

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
override srcdir = .
2-
override top_srcdir = ..
1+
override srcdir = @srcdir@
2+
override top_srcdir = @top_srcdir@
33

4-
override builddir = .
5-
override top_builddir = ..
4+
override builddir = @builddir@
5+
override top_builddir = @top_builddir@
66

77
override subdirs =
88

9-
override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk)
10-
include $(bootstrap)
9+
include $(top_builddir)/bootstrap.mk
1110

1211
all: $(builddir)/$(PACKAGE)$(man1ext).gz
1312

@@ -25,10 +24,9 @@ install: all installdirs
2524

2625
dist: FORCE
2726
$(fn_remove_dist_archive)
28-
tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \
29-
$(srcdir)/Makefile \
30-
$(srcdir)/man.1
31-
tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap))
27+
tar -C $(srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', \
28+
Makefile.in \
29+
man.1
3230
$(fn_finalize_dist_archive)
3331

3432
$(builddir)/$(PACKAGE)$(man1ext).gz: $(srcdir)/man.1

src/Makefile renamed to src/Makefile.in

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
override srcdir = .
2-
override top_srcdir = ..
1+
override srcdir = @srcdir@
2+
override top_srcdir = @top_srcdir@
33

4-
override builddir = .
5-
override top_builddir = ..
4+
override builddir = @builddir@
5+
override top_builddir = @top_builddir@
66

77
override subdirs =
88

9-
override bootstrap := $(shell test -f $(top_builddir)/bootstrap.mk && echo $(top_builddir)/bootstrap.mk || echo $(builddir)/bootstrap.mk)
10-
include $(bootstrap)
9+
include $(top_builddir)/bootstrap.mk
1110

1211
# Print a warning each time it occurs, used for deprecation tests
1312
# see https://docs.python.org/2/using/cmdline.html#cmdoption-W
@@ -57,16 +56,13 @@ dist: FORCE
5756
$(fn_remove_dist_archive)
5857
rm -rf $(srcdir)/build
5958
$(PYTHON) $(PYTHONFLAGS) $(srcdir)/setup.py build
60-
tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)/build/lib','$(distdir)', $(srcdir)/build/lib/*
61-
tar -rf '$(DIST_ARCHIVE)' --transform s,'^$(srcdir)','$(distdir)', \
62-
$(srcdir)/cygwin.sig \
63-
$(srcdir)/main.in \
64-
$(srcdir)/Makefile \
65-
$(srcdir)/postinstall-gen.sh \
66-
$(srcdir)/setup.py
67-
tar -C $(dir $(bootstrap)) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', $(notdir $(bootstrap))
68-
tar -C $(top_srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', LICENSE
69-
tar -C $(top_srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', README.md
59+
tar -C $(srcdir)/build/lib -rf '$(DIST_ARCHIVE)' --transform s,'^.','$(distdir)', .
60+
tar -C $(srcdir) -rf '$(DIST_ARCHIVE)' --transform s,'^','$(distdir)/', \
61+
cygwin.sig \
62+
main.in \
63+
Makefile.in \
64+
postinstall-gen.sh \
65+
setup.py
7066
$(fn_finalize_dist_archive)
7167

7268
distclean: clean

src/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
except KeyError:
3434
pkgname = "cygapt";
3535

36-
f = open("../README.md" if os.path.isfile("../README.md") else "./README.md");
36+
f = open("../README.md");
3737
long_description = f.read();
3838
f.close();
3939

0 commit comments

Comments
 (0)