Makefile
author Mahlon E. Smith <mahlon@martini.nu>
Tue, 24 Jul 2012 10:48:17 -0700
changeset 350 bb7ee0a13ea9
parent 227 8ce190faa5c2
permissions -rw-r--r--
Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     1
#!/usr/bin/env make -f
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     2
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
     3
PREFIX=/usr/local/share
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     4
LIBDIR=$(PREFIX)/mercurial-server
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     5
DOCDIR=$(PREFIX)/doc/mercurial-server
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
     6
ETCDIR=/etc/mercurial-server
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     7
NEWUSER=hg
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
     8
HOMEDIR=/var/lib/mercurial-server
227
8ce190faa5c2 More descriptive name for var describing path to stylesheets
Paul Crowley <paul@lshift.net>
parents: 226
diff changeset
     9
DOCBOOK_XSL=/usr/share/xml/docbook/stylesheet/nwalsh
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    10
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    11
INSTALL=install
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    12
169
6b34a5421330 Make the build target default
Paul Crowley <paul@lshift.net>
parents: 168
diff changeset
    13
build: build/html/index.html pythonbuild
6b34a5421330 Make the build target default
Paul Crowley <paul@lshift.net>
parents: 168
diff changeset
    14
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    15
setup-freebsd: installetc pythoninstall bsduseradd inituser
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    16
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    17
setup-adduser: installfiles adduser inituser
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    18
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    19
# WARNING: this is experimental
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    20
setup-useradd: installfiles useradd inituser
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    21
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    22
installetc:
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    23
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    24
	$(INSTALL) -m 644 src/init/conf/access.conf \
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    25
	    $(DESTDIR)$(ETCDIR)
221
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    26
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/remote-hgrc.d
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    27
	$(INSTALL) -m 644 \
221
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    28
	    src/init/conf/remote-hgrc.d/access.rc \
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    29
	    src/init/conf/remote-hgrc.d/logging.rc \
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    30
	    $(DESTDIR)$(ETCDIR)/remote-hgrc.d
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    31
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/root
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    32
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/users
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    33
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    34
installdoc: build/html/index.html
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    35
	$(INSTALL) -d $(DESTDIR)$(DOCDIR)
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    36
	$(INSTALL) -m 644 -t $(DESTDIR)$(DOCDIR) README 
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    37
	$(INSTALL) -d $(DESTDIR)$(DOCDIR)/html
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    38
	$(INSTALL) -m 644 -t $(DESTDIR)$(DOCDIR)/html build/html/index.html
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    39
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    40
build/html/index.html: doc/manual.docbook
227
8ce190faa5c2 More descriptive name for var describing path to stylesheets
Paul Crowley <paul@lshift.net>
parents: 226
diff changeset
    41
	xsltproc --nonet -o $@ $(DOCBOOK_XSL)/html/docbook.xsl $^
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    42
184
ec3047e1dadc Add PDF building to Makefile
Paul Crowley <paul@lshift.net>
parents: 173
diff changeset
    43
build/pdf/manual.pdf: doc/manual.docbook
ec3047e1dadc Add PDF building to Makefile
Paul Crowley <paul@lshift.net>
parents: 173
diff changeset
    44
	mkdir -p build/pdf
227
8ce190faa5c2 More descriptive name for var describing path to stylesheets
Paul Crowley <paul@lshift.net>
parents: 226
diff changeset
    45
	fop -xml $^ -xsl $(DOCBOOK_XSL)/fo/docbook.xsl $@
184
ec3047e1dadc Add PDF building to Makefile
Paul Crowley <paul@lshift.net>
parents: 173
diff changeset
    46
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    47
pythonbuild:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    48
	python setup.py build
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    49
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    50
dot-mercurial: src/init/dot-mercurial-server.tmpl
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    51
	sed -e "s|_ETCDIR_|$(ETCDIR)|" \
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    52
	    src/init/dot-mercurial-server.tmpl \
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    53
	    > src/init/dot-mercurial-server
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    54
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    55
pythoninstall: dot-mercurial
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    56
	python setup.py install \
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    57
	    --install-purelib=$(DESTDIR)$(LIBDIR) \
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    58
	    --install-platlib=$(DESTDIR)$(LIBDIR) \
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    59
	    --install-scripts=$(DESTDIR)$(LIBDIR) \
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    60
	    --install-data=$(DESTDIR)$(LIBDIR)
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    61
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    62
installfiles: installetc installdoc pythoninstall 
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    63
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    64
adduser:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    65
	adduser --system --shell /bin/sh --group --disabled-password \
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    66
	    --home $(HOMEDIR) \
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    67
	    --gecos  "Mercurial repositories" $(NEWUSER)
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    68
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    69
# WARNING: this is experimental
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    70
useradd:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    71
	useradd --system --shell /bin/sh \
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    72
	    --home $(HOMEDIR) --create-home \
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    73
	    --comment  "Mercurial repositories" $(NEWUSER)
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    74
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    75
bsduseradd:
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    76
	pw useradd $(NEWUSER) -c "Mercurial repositories" -m -s /bin/sh \
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    77
	    -d $(HOMEDIR)
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    78
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    79
inituser:
350
bb7ee0a13ea9 Allow the HOMEDIR and ETCDIR to be configurable via Makefile ENV. Add FreeBSD user creation support.
Mahlon E. Smith <mahlon@martini.nu>
parents: 227
diff changeset
    80
	su $(NEWUSER) -c "$(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)" -
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    81