Skip to content

Commit d1041f8

Browse files
committed
build system: switch to configure script and improved Makefile
This has dramatic effects on the build system complexity, and in the process exposing lots of dead weight. Split header files (.h1 .h2) are merged, and header files that only contained a single define have been fully replaced with -D. The makefile is no longer geneating scripts, and their files that hardcoded cc/ld/ar calls are gone. The build system is now fully compatible with standard variables like CC, PREFIX, DESTDIR, and such. The compiler is autodetected when unspecified, build flags are checked for compatibility, and installation directories can now be specified with configure flags. The configure script was heavily inspired by XBPS's. The "compile" script is gone along with the original top-level Makefile, both replaced with straightforward and more conventional makefiles. The "man" and "completions" subdirs are now integrated into the build system and use configure-time variables for the paths. No sed calls or patches should be required to set any paths or toolchain settings. Usage of .gitattributes and "$Id$" strings is now replaced with a VERSION define in the configure script, which optionally uses git to append the 8-digit commit hash to the version string. This also makes '-V' more meaningful.
1 parent d1a1f35 commit d1041f8

79 files changed

Lines changed: 788 additions & 880 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 0 additions & 13 deletions
This file was deleted.

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generated config
2+
config.mk
3+
4+
# Objects
5+
*.o
6+
*.a
7+
8+
# Generated manual pages
9+
runsv.8
10+
runsvchdir.8
11+
sv.8
12+
utmpset.8
13+
14+
# Binaries
15+
src/chpst
16+
src/runit
17+
src/runit-init
18+
src/runsv
19+
src/runsvdir
20+
src/runsvchdir
21+
src/sv
22+
src/svlogd
23+
src/utmpset
24+
25+
# Generated completions
26+
sv.bash
27+
sv.zsh

.manpages

Whitespace-only changes.

Makefile

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,33 @@
1-
DESTDIR=
1+
-include config.mk
22

3-
PACKAGE=runit-2.1.2
4-
DIRS=doc man etc package src
5-
MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 sv.8 utmpset.8 \
6-
runsvchdir.8 svlogd.8 chpst.8
3+
SUBDIRS = src man completions
74

8-
all: clean .manpages $(PACKAGE).tar.gz
5+
.PHONY: all install uninstall check clean
96

10-
.manpages:
11-
for i in $(MANPAGES); do \
12-
rman -S -f html -r '' < man/$$i | \
13-
sed -e "s}name='sect\([0-9]*\)' href='#toc[0-9]*'>\(.*\)}name='sect\1'>\2}g ; \
14-
s}<a href='#toc'>Table of Contents</a>}<a href='http://smarden.org/pape/'>G. Pape</a><br><a href='index.html'>runit</A><hr>}g ; \
15-
s}<!--.*-->}}g" \
16-
> doc/$$i.html ; \
17-
done ; \
18-
echo 'fix up html manually...'
19-
echo 'patch -p0 <manpagehtml.diff && exit'
20-
sh
21-
find . -name '*.orig' -exec rm -f {} \;
22-
touch .manpages
7+
all:
8+
@if test ! -e config.mk; then \
9+
echo "You didn't run ./configure ... exiting."; \
10+
exit 1; \
11+
fi
12+
@for dir in $(SUBDIRS); do \
13+
$(MAKE) -C $$dir || exit 1; \
14+
done
2315

24-
$(PACKAGE).tar.gz:
25-
rm -rf TEMP
26-
mkdir -p TEMP/admin/$(PACKAGE)
27-
make -C src clean
28-
cp -a $(DIRS) TEMP/admin/$(PACKAGE)/
29-
ln -sf ../etc/debian TEMP/admin/$(PACKAGE)/doc/
30-
for i in TEMP/admin/$(PACKAGE)/etc/*; do \
31-
test -d $$i && ln -s ../2 $$i/2; \
16+
install: all
17+
@for dir in $(SUBDIRS); do \
18+
$(MAKE) -C $$dir install || exit 1; \
3219
done
33-
chmod -R g-ws TEMP/admin
34-
chmod +t TEMP/admin
35-
find TEMP -exec touch {} \;
36-
su -c '\
37-
chown -R root:root TEMP/admin ; \
38-
(cd TEMP && tar --exclude CVS -cpzf ../$(PACKAGE).tar.gz admin); \
39-
rm -rf TEMP'
4020

41-
clean:
42-
find . -name \*~ -exec rm -f {} \;
43-
find . -name .??*~ -exec rm -f {} \;
44-
find . -name \#?* -exec rm -f {} \;
21+
uninstall:
22+
@for dir in $(SUBDIRS); do \
23+
$(MAKE) -C $$dir uninstall || exit 1; \
24+
done
4525

46-
cleaner: clean
47-
rm -f $(PACKAGE).tar.gz
48-
for i in $(MANPAGES); do rm -f doc/`basename $$i`.html; done
49-
rm -f .manpages
26+
check: all
27+
$(MAKE) -C src check
28+
29+
clean:
30+
@for dir in $(SUBDIRS); do \
31+
$(MAKE) -C $$dir clean || exit 1; \
32+
done
33+
-rm -f result* _ccflag.{,c,err}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ canonical version of the source code and to avoid the inclusion of patches in
1313
[void-packages](https://github.com/void-linux/void-packages). This also makes
1414
reviewing patches much simpler. If you have an issue or patch that you feel fits
1515
inside these objectives, please open an issue or pull request!
16+
17+
## Build instructions
18+
19+
```
20+
$ ./configure
21+
$ make && make install
22+
```

completions/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-include ../config.mk
2+
3+
COMPLETIONS = sv.bash sv.zsh
4+
5+
.PHONY: all install clean
6+
7+
all: $(COMPLETIONS)
8+
9+
$(COMPLETIONS):
10+
$(SED) -e "s|@@SERVICEDIR@@|${SERVICEDIR}|g" $@.in > $@
11+
12+
install: all
13+
install -d $(DESTDIR)$(SHAREDIR)/bash-completion/completions
14+
install -m644 sv.bash $(DESTDIR)$(SHAREDIR)/bash-completion/completions/sv
15+
install -d $(DESTDIR)$(SHAREDIR)/zsh/site-functions
16+
install -m644 sv.zsh $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_sv
17+
18+
clean:
19+
rm -f $(COMPLETIONS)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _sv()
1616
return
1717
;;
1818
*)
19-
COMPREPLY=( /var/service/* )
19+
COMPREPLY=( @@SERVICEDIR@@/* )
2020
COMPREPLY=( ${COMPREPLY[@]##*/} )
2121
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- ${cur}) )
2222
return
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cmds)
3535
check
3636
ret=0;;
3737
args)
38-
services=( /var/service/*(-/N:t) )
38+
services=( @@SERVICEDIR@@/*(-/N:t) )
3939
(( $#services )) && _values services $services && ret=0
4040
[[ $words[CURRENT] = */* ]] && _directories && ret=0
4141
;;

0 commit comments

Comments
 (0)