mirror of
https://github.com/weewx/weewx.git
synced 2026-04-18 00:26:57 -04:00
123 lines
3.5 KiB
Makefile
Executable File
123 lines
3.5 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_BINDIR=$(DST)/usr/share/weewx
|
|
DST_CFGDIR=$(DST)/etc/weewx
|
|
DST_USERDIR=$(DST)/etc/weewx/bin/user
|
|
|
|
# these are the entry points
|
|
ENTRIES=weewxd weectl
|
|
|
|
%:
|
|
dh $@ --with python3
|
|
|
|
override_dh_auto_clean:
|
|
dh_auto_clean
|
|
rm -rf build dist
|
|
rm -f *.egg-info
|
|
|
|
# this rule grabs all of the bits from the source tree and puts them into
|
|
# a staging area that has the directory structure of a debian system. it
|
|
# explicitly does *not* do things the 'python way' using pip.
|
|
install:
|
|
dh_testdir
|
|
dh_testroot
|
|
dh_prep
|
|
dh_installdirs
|
|
dh_installchangelogs
|
|
|
|
# create the directory structure
|
|
mkdir -p $(DST_BINDIR)
|
|
mkdir -p $(DST_CFGDIR)
|
|
mkdir -p $(DST_USERDIR)
|
|
mkdir -p $(DST)/usr/bin
|
|
mkdir -p $(DST)/etc/default
|
|
mkdir -p $(DST)/etc/logrotate.d
|
|
mkdir -p $(DST)/etc/rsyslog.d
|
|
mkdir -p $(DST)/lib/systemd/system
|
|
mkdir -p $(DST)/lib/udev/rules.d
|
|
mkdir -p $(DST)/var/lib/weewx
|
|
mkdir -p $(DST)/var/log/weewx
|
|
mkdir -p $(DST)/var/www/html/weewx
|
|
mkdir -p $(DST)/usr/share/doc/weewx
|
|
|
|
# copyright, license, and upstream changelog
|
|
cp docs_src/copyright.md $(DST)/usr/share/doc/weewx/copyright
|
|
cp LICENSE.txt $(DST)/usr/share/doc/weewx/license
|
|
cp docs_src/changes.md $(DST)/usr/share/doc/weewx/changelog
|
|
dh_compress usr/share/doc/weewx/changelog
|
|
|
|
# copy the weewx code
|
|
cp -r $(SRC)/src/* $(DST_BINDIR)
|
|
|
|
# create the user extensions directory
|
|
cp $(SRC)/src/weewx_data/bin/user/__init__.py $(DST_USERDIR)
|
|
cp $(SRC)/src/weewx_data/bin/user/extensions.py $(DST_USERDIR)
|
|
|
|
# copy selected ancillary files to the config dir
|
|
cp -r $(SRC)/src/weewx_data/examples $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/skins $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/import $(DST_CFGDIR)
|
|
cp -r $(SRC)/src/weewx_data/util/logwatch $(DST_CFGDIR)
|
|
|
|
# create the default configuration
|
|
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
|
|
|
|
# make a virgin copy of the configuration file
|
|
cp $(DST_CFGDIR)/weewx.conf $(DST_CFGDIR)/weewx.conf.dist
|
|
|
|
# create the system init configuration
|
|
# FIXME: if no systemd, then install sysV script
|
|
cp $(SRC)/pkg/etc/systemd/system/weewx.service $(DST)/lib/systemd/system
|
|
cp $(SRC)/pkg/etc/systemd/system/weewx@.service $(DST)/lib/systemd/system
|
|
|
|
# create the entry points
|
|
for f in $(ENTRIES); do \
|
|
cp $(SRC)/bin/$$f $(DST)/usr/bin; \
|
|
done
|
|
|
|
# the defaults file indicates which python and weewx to use
|
|
cat $(SRC)/pkg/etc/default/weewx | sed \
|
|
-e 's%WEEWX_PYTHON=.*%WEEWX_PYTHON=$(PYTHON)%' \
|
|
> $(DST)/etc/default/weewx
|
|
|
|
# log handling
|
|
cp $(SRC)/pkg/etc/logrotate.d/weewx $(DST)/etc/logrotate.d
|
|
cp $(SRC)/pkg/etc/rsyslog.d/weewx.conf $(DST)/etc/rsyslog.d
|
|
|
|
# put the udev rules in place
|
|
cp $(SRC)/pkg/etc/udev/rules.d/weewx.rules $(DST)/lib/udev/rules.d/60-weewx.rules
|
|
|
|
# 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_fixperms
|
|
dh_installdeb
|
|
dh_gencontrol
|
|
dh_lintian
|
|
dh_md5sums
|
|
dh_builddeb -- -Zgzip
|
|
|
|
binary-arch:
|
|
|
|
binary: binary-indep binary-arch
|
|
|
|
.PHONY: build clean binary-indep binary-arch binary install configure
|