Skip to content

Commit

Permalink
Get rid of autoconf
Browse files Browse the repository at this point in the history
Relying on external dependencies to build such a small project as pick has
always been troublesome to me.  Instead, replace auto{conf,make} with a
shell-script and plain Makefile(s).
  • Loading branch information
mptre committed Feb 24, 2019
1 parent 2a5e047 commit 970c5f4
Show file tree
Hide file tree
Showing 21 changed files with 463 additions and 281 deletions.
28 changes: 1 addition & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
*.o
core*
pick
vgcore*

# Generated by Autotools
.deps
INSTALL.md
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.guess
Makefile.inc
config.h
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
stamp-h1
.dirstamp
test-driver
test-suite.log
tests/pick-test
tests/*.log
tests/*.trs
31 changes: 8 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ you agree to abide by its [Code of Conduct][conduct].
2. Build and make sure all tests pass:

```sh
$ ./autogen.sh
$ ./configure
$ make check
$ make test
```

3. Make your changes.
Expand Down Expand Up @@ -56,45 +55,31 @@ Internal documentation on crafting a release.
2. Update `CHANGELOG.md` and commit the change:
```sh
$ git commit -m 'Update CHANGELOG'
$ git commit -m 'update changelog'
```
3. Update the version in `configure.ac`:
```
AC_INIT([pick], [0.0.2], [pick-maintainers@calleerlandsson.com])
```
... and commit the change:
3. Update the version in `Makefile` and commit the change:
```sh
$ git commit -m 'Update version to 0.0.2'
$ git commit -m 'update version to 0.0.2'
```
4. Create and verify the tarball:
```sh
$ make distcheck
$ tar tvzf pick-0.0.2.tar.gz
```
5. Create and verify checksum:
```sh
$ sha256 pick-0.0.2.tar.gz >pick-0.0.2.sha256
$ sha256 -c pick-0.0.2.sha256
$ make dist
```
6. Tag and push:
5. Tag and push:
```sh
$ git tag v0.0.2
$ git push --tags origin master
```
7. [Announce the release on GitHub][announce].
6. [Announce the release on GitHub][announce].
8. Contact package maintainers:
7. Contact package maintainers:
* Aggelos Avgerinos <evaggelos.avgerinos@gmail.com> (Debian & Ubuntu)
* Chunyang Xu <xuchunyang.me@gmail.com> (MacPorts)
Expand Down
4 changes: 4 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.CURDIR= ${CURDIR}
.OBJDIR= ${CURDIR}

include ${.CURDIR}/Makefile
17 changes: 0 additions & 17 deletions INSTALL.md.in

This file was deleted.

112 changes: 112 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
include ${.CURDIR}/Makefile.inc

VERSION= 2.0.2

PROG= pick

SRCS+= compat-pledge.c
SRCS+= compat-reallocarray.c
SRCS+= compat-strtonum.c
SRCS+= pick.c

OBJS= ${SRCS:.c=.o}
DEPS= ${SRCS:.c=.d}

CFLAGS+= ${DEBUG}
CFLAGS+= -DVERSION=\"${VERSION}\"

DISTFILES+= CHANGELOG.md
DISTFILES+= CODE_OF_CONDUCT.md
DISTFILES+= CONTRIBUTING.md
DISTFILES+= GNUmakefile
DISTFILES+= LICENSE
DISTFILES+= Makefile
DISTFILES+= README.md
DISTFILES+= compat-pledge.c
DISTFILES+= compat-reallocarray.c
DISTFILES+= compat-strtonum.c
DISTFILES+= configure
DISTFILES+= pick.1
DISTFILES+= pick.c
DISTFILES+= tests/GNUmakefile
DISTFILES+= tests/Makefile
DISTFILES+= tests/README.md
DISTFILES+= tests/key-alt-enter.t
DISTFILES+= tests/key-backspace.t
DISTFILES+= tests/key-ctrl-a.t
DISTFILES+= tests/key-ctrl-c.t
DISTFILES+= tests/key-ctrl-e.t
DISTFILES+= tests/key-ctrl-k.t
DISTFILES+= tests/key-ctrl-l.t
DISTFILES+= tests/key-ctrl-o.t
DISTFILES+= tests/key-ctrl-u.t
DISTFILES+= tests/key-ctrl-w.t
DISTFILES+= tests/key-del.t
DISTFILES+= tests/key-end.t
DISTFILES+= tests/key-enter.t
DISTFILES+= tests/key-home.t
DISTFILES+= tests/key-left.t
DISTFILES+= tests/key-line-down.t
DISTFILES+= tests/key-line-up.t
DISTFILES+= tests/key-page-down.t
DISTFILES+= tests/key-page-up.t
DISTFILES+= tests/key-printable.t
DISTFILES+= tests/key-right.t
DISTFILES+= tests/key-unknown.t
DISTFILES+= tests/misc-match.t
DISTFILES+= tests/misc-realloc.t
DISTFILES+= tests/opt-d.t
DISTFILES+= tests/opt-h.t
DISTFILES+= tests/opt-k.t
DISTFILES+= tests/opt-o.t
DISTFILES+= tests/opt-q.t
DISTFILES+= tests/opt-s.t
DISTFILES+= tests/opt-unknown.t
DISTFILES+= tests/opt-v.t
DISTFILES+= tests/opt-x.t
DISTFILES+= tests/pick-test.c
DISTFILES+= tests/pick-test.sh

PREFIX= /usr/local

all: ${PROG}

${PROG}: ${OBJS}
${CC} ${DEBUG} -o ${PROG} ${OBJS} ${LDFLAGS}

clean:
rm -f ${DEPS} ${OBJS} ${PROG}
.PHONY: clean

dist:
set -e; \
d=${PROG}-${VERSION}; \
mkdir $$d; \
for f in ${DISTFILES}; do \
mkdir -p $$d/`dirname $$f`; \
cp ${.CURDIR}/$$f $$d/$$f; \
done; \
tar czvf ${.CURDIR}/$$d.tar.gz $$d; \
(cd ${.CURDIR}; sha256 $$d.tar.gz >$$d.sha256); \
rm -r $$d
.PHONY: dist

distclean: clean
rm -f ${.CURDIR}/Makefile.inc ${.CURDIR}/config.h \
${.CURDIR}/config.log ${.CURDIR}/${PROG}-${VERSION}.tar.gz \
${.CURDIR}/${PROG}-${VERSION}.sha256
.PHONY: distclean

install: ${PROG}
@mkdir -p ${DESTDIR}${PREFIX}/bin
${INSTALL} ${PROG} ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/man/man1
${INSTALL} ${.CURDIR}/pick.1 ${DESTDIR}${PREFIX}/man/man1
.PHONY: install

test: ${PROG}
${MAKE} -C ${.CURDIR}/tests \
"MALLOC_OPTIONS=${MALLOC_OPTIONS}" "PICK=${.OBJDIR}/${PROG}"
.PHONY: test

-include ${DEPS}
59 changes: 0 additions & 59 deletions Makefile.am

This file was deleted.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ pkg_add pick

### From source

Download the latest [release] and follow the bundled instructions in
`INSTALL.md`.

If you want to try the latest unreleased version,
follow the instructions in [CONTRIBUTING.md][current].
```sh
./configure
make install
```

## Copyright

Expand Down
3 changes: 0 additions & 3 deletions autogen.sh

This file was deleted.

14 changes: 14 additions & 0 deletions compat-pledge.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "config.h"

int unused;

#ifndef HAVE_PLEDGE

int
pledge(const char *promises __attribute__((__unused__)),
const char *execpromises __attribute__((__unused__)))
{
return 0;
}

#endif /* !HAVE_PLEDGE */
7 changes: 0 additions & 7 deletions compat-reallocarray.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/*
* This file needs a "translation unit" - it needs anything for the compiler to
* compile. Since the point of this file is to not exist, declare an unused
* variable here.
*/
int unused;

#ifndef HAVE_REALLOCARRAY
Expand Down
2 changes: 0 additions & 2 deletions compat-strtonum.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

int unused;

Expand Down
34 changes: 0 additions & 34 deletions compat.h

This file was deleted.

Loading

0 comments on commit 970c5f4

Please sign in to comment.