Makefile
author Paul Crowley <paul@lshift.net>
Fri, 24 Aug 2012 13:49:55 +0100
changeset 365 f2e13e08ea13
parent 349 b271be84da5e
permissions -rw-r--r--
Make it convenient to run the tests with new env vars in sudo
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
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
     8
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
     9
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    10
INSTALL=install
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    11
169
6b34a5421330 Make the build target default
Paul Crowley <paul@lshift.net>
parents: 168
diff changeset
    12
build: build/html/index.html pythonbuild
6b34a5421330 Make the build target default
Paul Crowley <paul@lshift.net>
parents: 168
diff changeset
    13
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    14
setup-adduser: installfiles adduser inituser
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    15
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    16
# WARNING: this is experimental
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    17
setup-useradd: installfiles useradd inituser
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    18
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    19
# WARNING: this is experimental
349
b271be84da5e Fix windows issues that cropped up in the new install
Tom Parker <palfrey@lshift.net>
parents: 348
diff changeset
    20
setup-windows: installfiles adduser-windows
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    21
168
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)
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    24
	$(INSTALL) -m 644 -t $(DESTDIR)$(ETCDIR) \
221
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    25
	    src/init/conf/access.conf
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    26
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/remote-hgrc.d
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    27
	$(INSTALL) -m 644 -t $(DESTDIR)$(ETCDIR)/remote-hgrc.d \
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    28
	    src/init/conf/remote-hgrc.d/access.rc \
c4c3facf5d6b Switch to remote-hgrc.d
Paul Crowley <paul@lshift.net>
parents: 203
diff changeset
    29
	    src/init/conf/remote-hgrc.d/logging.rc
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    30
	$(INSTALL) -d $(DESTDIR)$(ETCDIR)/keys/root
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    31
	$(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
    32
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    33
installdoc: build/html/index.html
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    34
	$(INSTALL) -d $(DESTDIR)$(DOCDIR)
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    35
	$(INSTALL) -m 644 -t $(DESTDIR)$(DOCDIR) README 
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    36
	$(INSTALL) -d $(DESTDIR)$(DOCDIR)/html
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    37
	$(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
    38
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    39
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
    40
	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
    41
184
ec3047e1dadc Add PDF building to Makefile
Paul Crowley <paul@lshift.net>
parents: 173
diff changeset
    42
build/pdf/manual.pdf: doc/manual.docbook
ec3047e1dadc Add PDF building to Makefile
Paul Crowley <paul@lshift.net>
parents: 173
diff changeset
    43
	mkdir -p build/pdf
227
8ce190faa5c2 More descriptive name for var describing path to stylesheets
Paul Crowley <paul@lshift.net>
parents: 226
diff changeset
    44
	fop -xml $^ -xsl $(DOCBOOK_XSL)/fo/docbook.xsl $@
184
ec3047e1dadc Add PDF building to Makefile
Paul Crowley <paul@lshift.net>
parents: 173
diff changeset
    45
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    46
pythonbuild:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    47
	python setup.py build
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    48
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    49
pythoninstall:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    50
	python setup.py install \
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    51
	    --install-purelib=$(DESTDIR)$(LIBDIR) \
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    52
	    --install-platlib=$(DESTDIR)$(LIBDIR) \
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    53
	    --install-scripts=$(DESTDIR)$(LIBDIR) \
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    54
	    --install-data=$(DESTDIR)$(LIBDIR)
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    55
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    56
installfiles: installetc installdoc pythoninstall 
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    57
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    58
adduser:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    59
	adduser --system --shell /bin/sh --group --disabled-password \
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    60
	    --home /var/lib/mercurial-server \
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    61
	    --gecos  "Mercurial repositories" $(NEWUSER)
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    62
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    63
# WARNING: this is experimental
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    64
useradd:
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    65
	useradd --system --shell /bin/sh \
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    66
	    --home /var/lib/mercurial-server --create-home \
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    67
	    --comment  "Mercurial repositories" $(NEWUSER)
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    68
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    69
# WARNING: this is experimental
348
b155c43eaa56 Update windows guide and fix a couple of minor items in the Makefile
Tom Parker <palfrey@lshift.net>
parents: 347
diff changeset
    70
adduser-windows:
b155c43eaa56 Update windows guide and fix a couple of minor items in the Makefile
Tom Parker <palfrey@lshift.net>
parents: 347
diff changeset
    71
	net user $(NEWUSER) /add
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    72
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    73
inituser:
203
d27b41424efb Use DESTDIR instead of TOPDIR
Paul Crowley <paul@lshift.net>
parents: 202
diff changeset
    74
	su -l -c "$(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)" $(NEWUSER)
168
f9bf8f84df7f Kill install in favour of setup.py and Makefile
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    75
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    76
# WARNING: this is experimental
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    77
inituser-windows:
348
b155c43eaa56 Update windows guide and fix a couple of minor items in the Makefile
Tom Parker <palfrey@lshift.net>
parents: 347
diff changeset
    78
	mkdir /home/$(NEWUSER)
349
b271be84da5e Fix windows issues that cropped up in the new install
Tom Parker <palfrey@lshift.net>
parents: 348
diff changeset
    79
	chown $(NEWUSER) /home/$(NEWUSER)
348
b155c43eaa56 Update windows guide and fix a couple of minor items in the Makefile
Tom Parker <palfrey@lshift.net>
parents: 347
diff changeset
    80
	chmod 755 $(DESTDIR)$(LIBDIR)/init/*
b155c43eaa56 Update windows guide and fix a couple of minor items in the Makefile
Tom Parker <palfrey@lshift.net>
parents: 347
diff changeset
    81
	ssh $(NEWUSER)@localhost "sh $(DESTDIR)$(LIBDIR)/init/hginit $(DESTDIR)$(LIBDIR)"
347
301479a4acdf Initial notes and work towards a Windows install
Tom Parker<palfrey@lshift.net>
parents: 227
diff changeset
    82