mirror of
https://github.com/weewx/weewx.git
synced 2026-04-19 00:56:54 -04:00
wee_resources becomes weewx_data, and is put in version control. The build documentation, as well as the 'user' subdirectory, are now in it. This allows weewxd to be run directly from the git repository for two reasons: 1) the documentation does not have to be built first. 2) because the source code is now under 'src', while the 'user' subdirectory is in weewx_data, weewxd does not accidentally pick up the repository's version of the 'user' subdirectory.
108 lines
3.1 KiB
Makefile
Executable File
108 lines
3.1 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
# -*- makefile -*-
|
|
# debian makefile for weewx
|
|
# Copyright 2013-2023 Matthew Wall
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
#export DH_VERBOSE=1
|
|
|
|
PKG=weewx
|
|
PYTHON=python3
|
|
SRC=$(CURDIR)
|
|
DST=$(CURDIR)/debian/$(PKG)
|
|
DST_EXECDIR=$(DST)/usr/bin
|
|
DST_BINDIR =$(DST)/usr/share/weewx
|
|
DST_DOCDIR =$(DST)/usr/share/doc/weewx
|
|
DST_SYSTEMDDIR=$(DST)/etc/systemd/system
|
|
DST_CFGDIR =$(DST)/etc/weewx
|
|
|
|
# these are the entry points
|
|
ENTRIES=weewxd weectl wee_import wee_reports
|
|
|
|
%:
|
|
dh $@ --with python3
|
|
|
|
override_dh_auto_clean:
|
|
dh_auto_clean
|
|
rm -rf build dist
|
|
rm -f *.egg-info
|
|
|
|
# this install rule duplicates what the weewx setup.py would do
|
|
install:
|
|
dh_testdir
|
|
dh_testroot
|
|
dh_prep
|
|
dh_installdirs
|
|
|
|
# create the directory structure
|
|
mkdir -p $(DST_EXECDIR)
|
|
mkdir -p $(DST_SYSTEMDDIR)
|
|
mkdir -p $(DST_BINDIR)
|
|
mkdir -p $(DST_DOCDIR)
|
|
mkdir -p $(DST_CFGDIR)
|
|
mkdir -p $(DST)/etc/default
|
|
|
|
# copy files from the source tree
|
|
cp -r $(SRC)/src/* $(DST_BINDIR)
|
|
cp -r $(SRC)/src/weewx_data/bin/* $(DST_BINDIR)
|
|
cp -r $(SRC)/src/weewx_data/docs/* $(DST_DOCDIR)
|
|
cp -r $(SRC)/src/weewx_data/examples $(DST_DOCDIR)
|
|
cp -r $(SRC)/src/weewx_data/skins $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/apache $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/import $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/logrotate.d $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/logwatch $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/rsyslog.d $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/scripts $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/udev $(DST_CFGDIR)
|
|
|
|
# Patch weewx.conf with the various ROOT symbols
|
|
cat $(SRC)/src/weewx_data/weewx.conf | sed \
|
|
-e 's%^WEEWX_ROOT =.*%WEEWX_ROOT = /etc/weewx%' \
|
|
-e 's%SKIN_ROOT =.*%SKIN_ROOT = skins%' \
|
|
-e 's%HTML_ROOT = public_html%HTML_ROOT = /var/www/html/weewx%' \
|
|
-e 's%SQLITE_ROOT = .*%SQLITE_ROOT = /var/lib/weewx%' \
|
|
> $(DST_CFGDIR)/weewx.conf
|
|
|
|
# Patch the weewx.service file to read /etd/default/weewx, then
|
|
# use its symbols to invoke weewxd
|
|
cat $(SRC)/src/weewx_data/util/systemd/weewx.service | sed \
|
|
-e '/^\[Service\]/a EnvironmentFile=/etc/default/weewx' \
|
|
-e 's%^ExecStart=.*%ExecStart=/usr/bin/env $${WEEWX_BIN} $${WEEWX_CFG}%' \
|
|
> $(DST_SYSTEMDDIR)/weewx.service
|
|
|
|
# make a virgin copy of the configuration file
|
|
cp $(DST_CFGDIR)/weewx.conf $(DST_CFGDIR)/weewx.conf.dist
|
|
|
|
# create the entry points
|
|
for f in $(ENTRIES); do \
|
|
cp $(SRC)/src/weewx_data/util/scripts/$$f $(DST)/usr/bin; \
|
|
done
|
|
|
|
# configure application layout
|
|
cat $(SRC)/src/weewx_data/util/default/weewx | sed \
|
|
-e 's%WEEWX_PYTHON=.*%WEEWX_PYTHON=$(PYTHON)%' \
|
|
-e 's%WEEWX_BINDIR=.*%WEEWX_BINDIR=/usr/share/weewx%' \
|
|
-e 's%WEEWX_BIN=.*%WEEWX_BIN=/usr/bin/weewxd%' \
|
|
-e 's%WEEWX_CFG=.*%WEEWX_CFG=/etc/weewx/weewx.conf%' \
|
|
> $(DST)/etc/default/weewx
|
|
|
|
# additional debian control files that dpkg-buildpackage seems to ignore
|
|
mkdir -p $(DST)/DEBIAN
|
|
cp $(SRC)/debian/config $(DST)/DEBIAN
|
|
cp $(SRC)/debian/templates $(DST)/DEBIAN
|
|
|
|
binary-indep: install
|
|
dh_installchangelogs
|
|
dh_fixperms
|
|
dh_installdeb
|
|
dh_gencontrol
|
|
dh_md5sums
|
|
dh_builddeb -- -Zgzip
|
|
|
|
binary-arch:
|
|
|
|
binary: binary-indep binary-arch
|
|
|
|
.PHONY: build clean binary-indep binary-arch binary install configure
|