Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system rewrite #23

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .gitattributes

This file was deleted.

30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated config
config.mk

# Objects
*.o
*.a

# Generated manual pages
runsv.8
runsvchdir.8
sv.8
utmpset.8

# Binaries
src/chpst
src/runit
src/runit-init
src/runsv
src/runsvdir
src/runsvchdir
src/sv
src/svlogd
src/utmpset

# Generated completions
sv.bash
sv.zsh

# Test output
src/*.local
Empty file removed .manpages
Empty file.
68 changes: 26 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,49 +1,33 @@
DESTDIR=
-include config.mk

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

all: clean .manpages $(PACKAGE).tar.gz
.PHONY: all install uninstall check clean

.manpages:
for i in $(MANPAGES); do \
rman -S -f html -r '' < man/$$i | \
sed -e "s}name='sect\([0-9]*\)' href='#toc[0-9]*'>\(.*\)}name='sect\1'>\2}g ; \
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 ; \
s}<!--.*-->}}g" \
> doc/$$i.html ; \
done ; \
echo 'fix up html manually...'
echo 'patch -p0 <manpagehtml.diff && exit'
sh
find . -name '*.orig' -exec rm -f {} \;
touch .manpages
all:
@if test ! -e config.mk; then \
echo "You didn't run ./configure ... exiting."; \
exit 1; \
fi
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir || exit 1; \
done

$(PACKAGE).tar.gz:
rm -rf TEMP
mkdir -p TEMP/admin/$(PACKAGE)
make -C src clean
cp -a $(DIRS) TEMP/admin/$(PACKAGE)/
ln -sf ../etc/debian TEMP/admin/$(PACKAGE)/doc/
for i in TEMP/admin/$(PACKAGE)/etc/*; do \
test -d $$i && ln -s ../2 $$i/2; \
install: all
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir install || exit 1; \
done
chmod -R g-ws TEMP/admin
chmod +t TEMP/admin
find TEMP -exec touch {} \;
su -c '\
chown -R root:root TEMP/admin ; \
(cd TEMP && tar --exclude CVS -cpzf ../$(PACKAGE).tar.gz admin); \
rm -rf TEMP'

clean:
find . -name \*~ -exec rm -f {} \;
find . -name .??*~ -exec rm -f {} \;
find . -name \#?* -exec rm -f {} \;
uninstall:
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir uninstall || exit 1; \
done

cleaner: clean
rm -f $(PACKAGE).tar.gz
for i in $(MANPAGES); do rm -f doc/`basename $$i`.html; done
rm -f .manpages
check: all
$(MAKE) -C src check

clean:
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean || exit 1; \
done
-rm -f result* _ccflag.{,c,err}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ canonical version of the source code and to avoid the inclusion of patches in
[void-packages](https://github.com/void-linux/void-packages). This also makes
reviewing patches much simpler. If you have an issue or patch that you feel fits
inside these objectives, please open an issue or pull request!

## Build instructions

```
$ ./configure
$ make && make install
```
19 changes: 19 additions & 0 deletions completions/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-include ../config.mk

COMPLETIONS = sv.bash sv.zsh

.PHONY: all install clean

all: $(COMPLETIONS)

$(COMPLETIONS):
$(SED) -e "s|@@SERVICEDIR@@|${SERVICEDIR}|g" [email protected] > $@

install: all
install -d $(DESTDIR)$(SHAREDIR)/bash-completion/completions
install -m644 sv.bash $(DESTDIR)$(SHAREDIR)/bash-completion/completions/sv
install -d $(DESTDIR)$(SHAREDIR)/zsh/site-functions
install -m644 sv.zsh $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_sv

clean:
rm -f $(COMPLETIONS)
2 changes: 1 addition & 1 deletion completions/sv.bash → completions/sv.bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _sv()
return
;;
*)
COMPREPLY=( /var/service/* )
COMPREPLY=( @@SERVICEDIR@@/* )
COMPREPLY=( ${COMPREPLY[@]##*/} )
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- ${cur}) )
return
Expand Down
2 changes: 1 addition & 1 deletion completions/sv.zsh → completions/sv.zsh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cmds)
check
ret=0;;
args)
services=( /var/service/*(-/N:t) )
services=( @@SERVICEDIR@@/*(-/N:t) )
(( $#services )) && _values services $services && ret=0
[[ $words[CURRENT] = */* ]] && _directories && ret=0
;;
Expand Down
Loading