Skip to content

Commit

Permalink
Make app.config platform-specific for Debian.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmundkur committed Mar 9, 2012
1 parent 872397f commit caec97c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 94 deletions.
39 changes: 25 additions & 14 deletions Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ TARGETLIB = $(DESTDIR)$(libdir)/disco
TARGETCFG = $(DESTDIR)$(sysconfdir)/disco TARGETCFG = $(DESTDIR)$(sysconfdir)/disco
TARGETSRV = $(DESTDIR)$(localstatedir)/disco TARGETSRV = $(DESTDIR)$(localstatedir)/disco


DISCO_LOG_DIR = $(TARGETSRV)/log

# options to python and sphinx for building the lib and docs # options to python and sphinx for building the lib and docs
PYTHONENVS = DISCO_VERSION=$(DISCO_VERSION) DISCO_RELEASE=$(DISCO_RELEASE) PYTHONENVS = DISCO_VERSION=$(DISCO_VERSION) DISCO_RELEASE=$(DISCO_RELEASE)
SPHINXOPTS = "-D version=$(DISCO_VERSION) -D release=$(DISCO_RELEASE)" SPHINXOPTS = "-D version=$(DISCO_VERSION) -D release=$(DISCO_RELEASE)"


# used to choose which conf file will be generated
UNAME = $(shell uname)

# utilities used for building disco # utilities used for building disco
REBAR = ./rebar # relative to ./master REBAR = ./rebar # relative to ./master
ERL = erl ERL = erl
Expand All @@ -40,8 +35,6 @@ DIALYZER = dialyzer
TYPER = typer TYPER = typer
PYTHON = python PYTHON = python
PY_INSTALL = $(PYTHONENVS) $(PYTHON) setup.py install --root=$(DESTDIR)/ --prefix=$(prefix) PY_INSTALL = $(PYTHONENVS) $(PYTHON) setup.py install --root=$(DESTDIR)/ --prefix=$(prefix)
RE_VERSION = sed -e s/%DISCO_VERSION%/$(DISCO_VERSION)/
RE_LOG_DIR = sed -e s@%DISCO_LOG_DIR%@$(DISCO_LOG_DIR)@


EHOME = master EHOME = master
WWW = master/www WWW = master/www
Expand All @@ -65,6 +58,20 @@ ETESTOBJECTS = $(ETESTSOURCES:.erl=.beam)


EPLT = .dialyzer_plt EPLT = .dialyzer_plt


# used to override default installation settings
UNAME = $(shell uname)
-include mk/mk.$(UNAME)
# default settings to be generated for installation
DISCO_HOME ?= $(TARGETLIB)
DISCO_ROOT ?= $(TARGETSRV)
DISCO_LOG_DIR ?= $(TARGETSRV)/log
DISCO_RUN_DIR ?= $(DISCO_ROOT)/run

# installation utilities
RE_VERSION = sed -e s/%DISCO_VERSION%/$(DISCO_VERSION)/
RE_INSTALL_LOG_DIR = sed -e s@%DISCO_LOG_DIR%@$(DISCO_LOG_DIR)@
RE_LOCAL_LOG_DIR = sed -e s@%DISCO_LOG_DIR%@root/log@

.PHONY: all master clean distclean doc docclean doctest .PHONY: all master clean distclean doc docclean doctest
.PHONY: install \ .PHONY: install \
install-master \ install-master \
Expand All @@ -79,14 +86,14 @@ EPLT = .dialyzer_plt


all: master all: master


master: $(ESRC)/disco.app.src master: $(EAPPCFG) $(ESRC)/disco.app.src Makefile
cd master && $(REBAR) get-deps && $(REBAR) compile cd master && $(REBAR) get-deps && $(REBAR) compile


$(ESRC)/disco.app.src: $(ESRC)/disco.app.src.src $(ESRC)/disco.app.src: $(ESRC)/disco.app.src.src
- $(RE_VERSION) $< > $@ - $(RE_VERSION) $< > $@


$(EAPPCFG): $(EAPPCFG).src $(EAPPCFG): $(EAPPCFG).src
- $(RE_LOG_DIR) $< > $@ $(RE_LOCAL_LOG_DIR) $< > $(EAPPCFG)


clean: clean:
- cd master && $(REBAR) clean - cd master && $(REBAR) clean
Expand Down Expand Up @@ -160,13 +167,17 @@ $(TARGETBIN)/%: bin/% | $(TARGETBIN)
$(TARGETCFG): $(TARGETCFG):
$(INSTALL) -d $(TARGETCFG) $(INSTALL) -d $(TARGETCFG)


$(TARGETCFG)/settings.py: | $(TARGETCFG) $(TARGETCFG)/settings.py: conf/gen.settings | $(TARGETCFG)
(TARGETLIB=$(TARGETLIB) TARGETSRV=$(TARGETSRV) \ (DISCO_HOME=$(DISCO_HOME) \
conf/gen.settings.sys-$(UNAME) > $@ && chmod 644 $@) DISCO_ROOT=$(DISCO_ROOT) \
DISCO_USER=$(DISCO_USER) \
DISCO_PID_DIR=$(DISCO_PID_DIR) \
DISCO_RUN_DIR=$(DISCO_RUN_DIR) \
conf/gen.settings > $@ && chmod 644 $@)


$(ETARGETAPPCFG): $(EAPPCFG) $(ETARGETAPPCFG): $(EAPPCFG).src
$(INSTALL) -d `$(DIRNAME) $@` $(INSTALL) -d `$(DIRNAME) $@`
$(INSTALL_DATA) $< $@ - $(RE_INSTALL_LOG_DIR) $< > $@


$(TARGETLIB)/$(EBIN): $(TARGETLIB)/$(EBIN):
$(INSTALL) -d $@ $(INSTALL) -d $@
Expand Down
26 changes: 20 additions & 6 deletions conf/gen.settings.sys-Linux → conf/gen.settings
Original file line number Original file line Diff line number Diff line change
@@ -1,17 +1,31 @@
#!/bin/bash #!/bin/bash
# This file is used by "make install" on Linux. # This file is used by "make install" on Linux.


cat << EOF cat <<EOF
# Disco settings # Disco settings
# --
# -- You can modify these directories as you wish
# --
DISCO_HOME = "${TARGETLIB}" EOF

if [ "${DISCO_USER}" != "" ]; then
echo DISCO_USER = "\"${DISCO_USER}\""
echo ""
fi

cat <<EOF
DISCO_HOME = "${DISCO_HOME}"
# Root directory for Disco data. # Root directory for Disco data.
DISCO_ROOT = "${TARGETSRV}" DISCO_ROOT = "${DISCO_ROOT}"
EOF

if [ "${DISCO_PID_DIR}" != "" ]; then
echo '# Root directory for the Disco PID file.'
echo DISCO_PID_DIR = "\"${DISCO_PID_DIR}\""
echo
fi


cat <<EOF
# -- # --
# -- Variables below this line rarely need to be modified # -- Variables below this line rarely need to be modified
# -- # --
Expand Down
35 changes: 0 additions & 35 deletions conf/gen.settings.sys-Darwin

This file was deleted.

39 changes: 0 additions & 39 deletions conf/gen.settings.sys-Debian

This file was deleted.

4 changes: 4 additions & 0 deletions mk/mk.Debian
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,4 @@
DISCO_USER = disco
DISCO_HOME = /usr/lib/disco
DISCO_ROOT = /srv/disco/
DISCO_PID_DIR = /var/run/disco/

0 comments on commit caec97c

Please sign in to comment.