Files
linuxcncAllWasm/debian/rules.in
2026-08-20 06:17:39 +08:00

157 lines
6.1 KiB
Makefile

#!/usr/bin/make -f
# Copyright (C) 2006 Jeff Epler
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# When used to produce a debian package, this file is a script "used to
# control compilation and installation of the executable"
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
# Support more robust code and makes code modifications more difficult
# Compare https://wiki.debian.org/Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Trigger other tools to use the timestamp from debian/changelog
# Compare https://reproducible-builds.org/docs/source-date-epoch/
export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
# Set time & date to the most recent release, for repeatable builds.
TIMESTAMP:=$(shell dpkg-parsechangelog -S timestamp)
export DATE:=$(shell LANG=C date --date='@$(TIMESTAMP)' '+%d\ %b\ %Y')
export TIME:=$(shell LANG=C date --date='@$(TIMESTAMP)' '+%T')
kernel_version = @KERNEL_VERSION@
configure_realtime_arg = @CONFIGURE_REALTIME_ARG@
ifeq (,$(filter nodocs,$(DEB_BUILD_OPTIONS)))
enable_build_documentation = @ENABLE_BUILD_DOCUMENTATION@ \
--enable-build-documentation-translation
endif
SRCDIR = $(CURDIR)/src
DESTDIR=$(CURDIR)/debian/tmp
DEV_PACKAGE_NAME=@MAIN_PACKAGE_NAME@-dev
export PYTHON=/usr/bin/python3
%:
dh $@ -D$(SRCDIR)
override_dh_auto_configure:
cd src && ./autogen.sh
cd src && ./configure \
--prefix=/usr --sysconfdir=/etc \
--mandir=/usr/share/man \
$(configure_realtime_arg) \
$(enable_build_documentation) \
--disable-check-runtime-deps
override_dh_auto_build-arch:
dh_auto_build -- -O build-software
override_dh_auto_build-indep:
ifeq (,$(filter nodocs,$(DEB_BUILD_OPTIONS)))
ifneq "$(enable_build_documentation)" ""
dh_auto_build -- -O manpages
dh_auto_build -- -O translateddocs
dh_auto_build -- -O docs
endif
endif
override_dh_auto_clean:
if [ -r src/Makefile.inc -a -r src/config.status ]; then \
dh_auto_clean; \
py3clean .; \
fi
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
dh_auto_test
endif
override_dh_auto_install-arch:
# Install all architecture-dependent libraries and executables
# in DESTDIR (the staging dir for the main package).
DESTDIR=$(DESTDIR) $(MAKE) -C src install-software
py3clean .
desktop-file-validate $(shell find debian/extras/ share/applications/ -name *.desktop);
# some clean-up
rm -f $(DESTDIR)/usr/share/doc/@MAIN_PACKAGE_NAME@/examples/sample-configs/*/*position*.txt
override_dh_installdocs-arch:
# Sample configs are runtime data read by the launcher, not documentation,
# so they must be installed unconditionally (i.e. regardless of
# DEB_BUILD_OPTIONS=nodocs). They go in `usr/share/doc/linuxcnc` (not
# `.../doc/@MAIN_PACKAGE_NAME@`) because that's where the `linuxcnc` launcher
# script looks for them, and that's inconvenient to change.
dh_installdocs --doc-main-package=@MAIN_PACKAGE_NAME@ --package=@MAIN_PACKAGE_NAME@
mkdir -p debian/@MAIN_PACKAGE_NAME@/usr/share/doc/linuxcnc
mv debian/@MAIN_PACKAGE_NAME@/usr/share/doc/@MAIN_PACKAGE_NAME@/examples debian/@MAIN_PACKAGE_NAME@/usr/share/doc/linuxcnc
dh_installdocs --doc-main-package=@MAIN_PACKAGE_NAME@ --package=@MAIN_PACKAGE_NAME@-dev
override_dh_auto_install-indep:
ifeq (,$(filter nodocs,$(DEB_BUILD_OPTIONS)))
DESTDIR=$(DESTDIR) $(MAKE) -C src install-docs install-doc
# Remove the docs we just built that we don't have debs for yet...
rm -f $(DESTDIR)/usr/share/doc/linuxcnc/*_nb.pdf
endif
override_dh_installdocs-indep:
ifeq (,$(filter nodocs,$(DEB_BUILD_OPTIONS)))
# The G-code quick reference html docs are built as `docs/html/${LANG}/gcode.html`.
# We install them into `/usr/share/doc/@MAIN_PACKAGE_NAME@/` in each # linuxcnc-doc-${LANG} package,
# then rename them there (except for the English one) to include the language in the filename,
# so they do not collide when we install all the doc debs.
#
# Rename the "main" doc directories from
# `usr/share/doc/@MAIN_PACKAGE_NAME@` to `usr/share/doc/linuxcnc`,
# because that's where the `.desktop` files look for the docs.
dh_installdocs --doc-main-package=linuxcnc-uspace --package=linuxcnc-doc-de
mv debian/linuxcnc-doc-de/usr/share/doc/linuxcnc-uspace/gcode.html debian/linuxcnc-doc-de/usr/share/doc/linuxcnc-uspace/gcode_de.html
mv debian/linuxcnc-doc-de/usr/share/doc/linuxcnc-uspace debian/linuxcnc-doc-de/usr/share/doc/linuxcnc
dh_installdocs --doc-main-package=@MAIN_PACKAGE_NAME@ --package=linuxcnc-doc-en
mv debian/linuxcnc-doc-en/usr/share/doc/@MAIN_PACKAGE_NAME@ debian/linuxcnc-doc-en/usr/share/doc/linuxcnc
# Remove PDF files for translated locales that have no Debian package.
# The authoritative locale list lives in docs/po4a.cfg's [po4a_langs]
# line; only en and de get their own -doc package, every other locale
# in that list has its PDFs dropped from the tmp staging area.
for l in $$(sed -e's/#.*//' docs/po4a.cfg | grep '^\[po4a_langs\]' | cut -d" " -f2-); do \
if [ "$$l" != "de" ]; then \
$(RM) -f debian/tmp/usr/share/doc/linuxcnc/LinuxCNC_*_$$l.pdf; \
fi; \
done
$(RM) -f debian/tmp/usr/share/doc/linuxcnc/*_es.adoc
else
# Avoiding error message because of examples
$(RM) -fr debian/tmp/usr/share/doc/
endif
override_dh_compress:
dh_compress -X.pdf -X.txt -X.hal -X.ini -X.clp -X.var -X.nml -X.tbl -X.xml -Xsample-configs
override_dh_fixperms:
dh_fixperms -X/linuxcnc_module_helper -X/rtapi_app
# In case that only the indep packages are built
if [ -x "$(DESTDIR)/usr/share/tcltk/linuxcnc/linuxcnc.tcl" ]; then \
chmod -x $(DESTDIR)/usr/share/tcltk/linuxcnc/linuxcnc.tcl; \
fi
# override_dh_python3: # not executed, so we attach it to fixperms
DEB_HOST_ARCH=`dpkg-architecture -qDEB_HOST_ARCH` dh_python3
override_dh_shlibdeps:
cat debian/@MAIN_PACKAGE_NAME@/DEBIAN/shlibs debian/shlibs.pre > debian/shlibs.local
dh_shlibdeps -u--warnings=0 -l debian/@MAIN_PACKAGE_NAME@/usr/lib