Makefile
author Paul Crowley <paul@lshift.net>
Fri, 13 Nov 2009 12:30:06 +0000
changeset 212 ab5e0e4f5a0c
parent 203 d27b41424efb
child 218 ddd0f0d12e12
child 221 c4c3facf5d6b
permissions -rw-r--r--
Use env section of config instead of handling only HGRCPATH

#!/usr/bin/env make -f

PREFIX=/usr/local/share
LIBDIR=$(PREFIX)/mercurial-server
DOCDIR=$(PREFIX)/doc/mercurial-server
ETCDIR=/etc/mercurial-server
NEWUSER=hg

INSTALL=install

build: build/html/index.html pythonbuild

setup-adduser: installfiles adduser inituser

# WARNING: this is experimental
setup-useradd: installfiles useradd inituser

installetc:
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)
	$(INSTALL) -m 644 -t $(DESTDIR)$(ETCDIR) \
	    src/init/conf/remote-hgrc src/init/conf/access.conf
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/root
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/users

installdoc: build/html/index.html
	$(INSTALL) -d $(DESTDIR)$(DOCDIR)
	$(INSTALL) -m 644 -t $(DESTDIR)$(DOCDIR) README 
	$(INSTALL) -d $(DESTDIR)$(DOCDIR)/html
	$(INSTALL) -m 644 -t $(DESTDIR)$(DOCDIR)/html build/html/index.html

build/html/index.html: doc/manual.docbook
	xsltproc --nonet -o $@ /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl $^

build/pdf/manual.pdf: doc/manual.docbook
	mkdir -p build/pdf
	fop -xml $^ -xsl /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl $@

pythonbuild:
	python setup.py build

pythoninstall:
	python setup.py install \
	    --install-purelib=$(DESTDIR)$(LIBDIR) \
	    --install-platlib=$(DESTDIR)$(LIBDIR) \
	    --install-scripts=$(DESTDIR)$(LIBDIR) \
	    --install-data=$(DESTDIR)$(LIBDIR)

installfiles: installetc installdoc pythoninstall 

adduser:
	adduser --system --shell /bin/sh --group --disabled-password \
	    --home /var/lib/mercurial-server \
	    --gecos  "Mercurial repositories" $(NEWUSER)

# WARNING: this is experimental
useradd:
	useradd --system --shell /bin/sh \
	    --home /var/lib/mercurial-server --create-home \
	    --comment  "Mercurial repositories" $(NEWUSER)

inituser:
	su -l -c "$(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)" $(NEWUSER)