forked from LinuxCNC/linuxcnc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·286 lines (251 loc) · 10.1 KB
/
configure
File metadata and controls
executable file
·286 lines (251 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/bash
# dpkg configuration script for linuxcnc
# Copyright (C) 2006 Jeff Epler
# 2025-2026 Steffen Moeller
#
# 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"
set -e
if [[ -z "$OSTYPE" ]]; then
echo "E: The 'OSTYPE' environment variable is not set."
echo " Failure to confirm Linux as the operating system cannot be determined."
exit 1
else
echo "D: Found operating system '$OSTYPE'."
if [[ ! "$OSTYPE" == "linux-gnu"* ]]; then
echo "W: LinuxCNC is not (yet) prepared for the operating system '$OSTYPE'."
if [[ "$OSTYPE" == "freebsd"* ]]; then
echo " For FreeBSD there have been reports for LinuxCNC to compile and be executable."
else
if [[ "$OSTYPE" == "darwin"* ]]; then
echo
echo " LinuxCNC is yet unlikely to be successfully built on MacOS because of missing dependencies."
if command -v brew &> /dev/null; then
echo " With brew, we are aware of packages"
echo " autoconf automake libusb libmodbus libtircp pkgconf"
echo " but missing is, e.g., a package for libgpiod."
fi
fi
fi
echo " Instead of this Debian+derivative-tailored configuration please invoke the compilation directly."
exit 1
fi
fi
usage () {
P=${0##*/}
cat 1>&2 <<EOF
$P: Set up debian/ files to build for a particular kernel
Usage:
$P [no-docs]
Extra options:
no-docs|nodocs|nodoc|no-doc
Skip building documentation.
Debian packaging will not know about documentation to exist at all.
If configured regularly but with the intent not to build the docs,
run "DEB_BUILD_OPTIONS=nodocs dpkg-buildpackage".
sim|uspace|noauto
Accepted for compatibility, but now ignored.
-h|--help|help
Show this help.
EOF
}
cd "${0%/*}"
if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then
usage
exit 0
fi
EXTRA_BUILD=
PYTHON_VERSION_NEXT=$(python3 -c 'import sys; print (sys.version[:2] + str(1+int(sys.version[2])))')
LIBREADLINE_DEV="libeditreadline-dev"
ENABLE_BUILD_DOCUMENTATION=--enable-build-documentation=pdf
# Specialize these based on DISTRIB_NAME as needed
# These do not run-time depend on a specific package because
# the whole point is to allow a range of kernels to work, and we don't know
# of any common thing that all such kernels would provide.
while test $# -ne 0; do
case "$1" in
sim|uspace|noauto) echo "I: Argument $1 is accepted for compatibility, but ignored";;
help|-h|--help) usage; exit 0 ;;
no-docs|nodocs|nodoc|no-doc) unset ENABLE_BUILD_DOCUMENTATION ;;
*) echo 1>&2 "Unknown option: $1"
echo 1>&2
usage
exit 99 ;;
esac
shift
done
DISTRIB_NAME=
if [ "$(command -v lsb_release)" != "" ] || [ "$(which lsb_release)" != "" ]; then
ID="$(lsb_release --short --id)"
RELEASE="$(lsb_release --short --release)"
# Workaround for broken lsb_release, <URL: https://bugs.debian.org/1008735 >
case "$RELEASE" in
n/a)
RELEASE=unstable
;;
esac
DISTRIB_NAME="$ID-$RELEASE"
elif [ -f /etc/lsb-release ]; then
source /etc/lsb-release
DISTRIB_NAME=$DISTRIB_ID-$DISTRIB_RELEASE
fi
if [ -n "$ENABLE_BUILD_DOCUMENTATION" ]; then
DOC_DEPENDS="dblatex (>= 0.2.12),\n dvipng,\n fonts-dejavu,\n graphviz,\n groff,\n inkscape,\n python3-lxml,\n source-highlight,\n texlive-extra-utils,\n texlive-font-utils,\n texlive-fonts-recommended,\n texlive-lang-cyrillic,\n texlive-lang-european,\n texlive-lang-french,\n texlive-lang-german,\n texlive-lang-polish,\n texlive-lang-spanish,\n texlive-latex-recommended,\n w3c-linkchecker,\n xsltproc"
case $DISTRIB_NAME in
Debian-9)
;; # No xetex in Debian 9 Stretch
*)
# Not quite sure which packages is needed for xetex, but
# texlive-xetex seem like a safe choice. Need xetex to be
# able to build Chinese PDF.
DOC_DEPENDS="$DOC_DEPENDS,\n texlive-xetex"
;;
esac
else
DOC_DEPENDS=''
fi
MODUTILS_DEPENDS=kmod
PYTHON_PACKAGING_DEPENDS=dh-python
PYTHON_GST=python3-gst-1.0,gstreamer1.0-plugins-base
TCLTK_VERSION=8.6
PYTHON_IMAGING=python3-pil
PYTHON_IMAGING_TK=python3-pil.imagetk
QTVCP_DEPENDS="python3-pyqt6,\n python3-pyqt6.qsci,\n python3-pyqt6.qtsvg,\n python3-opencv,\n python3-dbus,\n python3-espeak,\n python3-dbus.mainloop.pyqt6,\n python3-pyqt6.qtwebengine,\n espeak-ng,\n pyqt6-dev-tools,\n gstreamer1.0-tools,\n espeak,\n sound-theme-freedesktop,\n python3-pyqt6.qtpdf"
YAPPS_RUNTIME="python3-yapps"
DEBHELPER="debhelper (>= 12)"
COMPAT="12"
case $DISTRIB_NAME in
Ubuntu-25.*|Ubuntu-24.*|Ubuntu-21.*|Debian-11|Debian-11.*|Debian-12|Debian-12.*|Debian-13|Debian-13.*|Debian-testing|Debian-unstable)
LIBREADLINE_DEV=libeditreadline-dev
COMPAT=""
DEBHELPER="debhelper-compat (= 13)"
;;
Ubuntu-20.*)
;;
Debian-10|Debian-10.*|Raspbian-10|Raspbian-10.*)
;;
*)
echo "W: Unknown distribution: '$DISTRIB_NAME'."
echo " Detected dependencies may be incomplete or wrong."
echo " Please consider fixing it and submitting a pull request."
;;
esac
TARGET=uspace
EXTRA_RECOMMENDS=hostmot2-firmware-all
MODULE_PATH=usr/lib/linuxcnc/modules
MODULE_EXT=.so
KERNEL_DEPENDS=libudev-dev,iptables
KERNEL_DEPENDS_BUILD=libudev-dev
KERNEL_HEADERS=
KERNEL_VERSION=uspace
MODUTILS_DEPENDS=
if false; then
MAIN_PACKAGE_NAME=linuxcnc
OTHER_MAIN_PACKAGE_NAME=linuxcnc-uspace
else
DISTRIB_NAME=uspace-$DISTRIB_NAME
MAIN_PACKAGE_NAME=linuxcnc-uspace
OTHER_MAIN_PACKAGE_NAME=linuxcnc
fi
EXTRA_RECOMMENDS="$EXTRA_RECOMMENDS, linux-image-rt-amd64 [linux-amd64], linux-image-rt-686-pae [linux-i386]"
CONFIGURE_REALTIME_ARG=--with-realtime=uspace
subst () {
sed \
-e "s#@COMPAT@#$COMPAT#g" \
-e "s#@DEBHELPER@#$DEBHELPER#g" \
-e "s#@DISTRIB_NAME@#$DISTRIB_NAME#g" \
-e "s#@DOC_DEPENDS@#$DOC_DEPENDS#g" \
-e "s#@EXTRA_BUILD@#$EXTRA_BUILD#g" \
-e "s#@EXTRA_RECOMMENDS@#$EXTRA_RECOMMENDS#g" \
-e "s#@KERNEL_DEPENDS@#$KERNEL_DEPENDS#g" \
-e "s#@KERNEL_DEPENDS_BUILD@#$KERNEL_DEPENDS_BUILD#g" \
-e "s#@KERNEL_HEADERS@#$KERNEL_HEADERS#g" \
-e "s#@KERNEL_VERSION@#$KERNEL_VERSION#g" \
-e "s#@LIBREADLINE_DEV@#$LIBREADLINE_DEV#g" \
-e "s#@MAIN_PACKAGE_NAME@#$MAIN_PACKAGE_NAME#g" \
-e "s#@MODULE_EXT@#$MODULE_EXT#g" \
-e "s#@MODULE_PATH@#$MODULE_PATH#g" \
-e "s#@MODUTILS_DEPENDS@#$MODUTILS_DEPENDS#g" \
-e "s#@OTHER_MAIN_PACKAGE_NAME@#$OTHER_MAIN_PACKAGE_NAME#g" \
-e "s#@PYTHON_GST@#$PYTHON_GST#g" \
-e "s#@PYTHON_IMAGING@#$PYTHON_IMAGING#g" \
-e "s#@PYTHON_IMAGING_TK@#$PYTHON_IMAGING_TK#g" \
-e "s#@PYTHON_PACKAGING_DEPENDS@#$PYTHON_PACKAGING_DEPENDS#g" \
-e "s#@PYTHON_VERSION_NEXT@#$PYTHON_VERSION_NEXT#g" \
-e "s#@QTVCP_DEPENDS@#$QTVCP_DEPENDS#g" \
-e "s#@RTAI_ARCHITECTURE@#$RTAI_ARCHITECTURE#g" \
-e "s#@TARGET@#$TARGET#g" \
-e "s#@CONFIGURE_REALTIME_ARG@#$CONFIGURE_REALTIME_ARG#g" \
-e "s#@TCLTK_VERSION@#$TCLTK_VERSION#g" \
-e "s#@XENOMAI_ARCHITECTURE@#$XENOMAI_ARCHITECTURE#g" \
-e "s|@YAPPS_RUNTIME@|$YAPPS_RUNTIME|g" \
-e "s#@ENABLE_BUILD_DOCUMENTATION@#$ENABLE_BUILD_DOCUMENTATION#g" \
-e '/^\s*,\s*$/d' \
"$@"
}
if [[ -z "${COMPAT}" ]]; then
rm -f compat
else
subst compat.in > compat
fi
subst control.top.in > control
echo >> control
subst control.main-pkg.in >> control
subst linuxcnc.install.in > ${MAIN_PACKAGE_NAME}.install
subst linuxcnc.lintian-overrides.in > ${MAIN_PACKAGE_NAME}.lintian-overrides
subst linuxcnc.manpages.in > ${MAIN_PACKAGE_NAME}.manpages
subst rules.in > rules
chmod +x rules
if [ -n "$ENABLE_BUILD_DOCUMENTATION" ]; then
subst control.docs.in >> control
fi
rm -f ../build-stamp
echo "I: Successfully configured for '$DISTRIB_NAME'."
echo "I: You can now start the build of LinuxCNC Debian packages."
echo " To build and test everything: fakeroot debian/rules binary"
echo " To build the executables and man pages only: fakeroot debian/rules binary-arch"
echo " To avoid tests: DEB_BUILD_OPTIONS=nocheck debian/rules binary"
if [ -n "$ENABLE_BUILD_DOCUMENTATION" ]; then
echo " To avoid documentation: DEB_BUILD_OPTIONS=nodocs fakeroot debian/rules binary"
else
echo " Building of documentation is disabled."
fi
echo " The DEB_BUILD_OPTIONS environment variable also works with dpkg-buildpackage."
if command -v dpkg-checkbuilddeps > /dev/null; then
a=""
if [ -n "$ENABLE_BUILD_DOCUMENTATION" ]; then
a=$(cd .. && dpkg-checkbuilddeps 2>&1 || true)
if [ -n "$a" ]; then
echo "W: To successfully build all of LinuxCNC, install the following build dependencies are mising:"
else
echo "I: All build dependencies available for complete builds including the documentation."
fi
else
a=$(cd .. && dpkg-checkbuilddeps -B 2>&1 || true)
if [ -n "$a" ]; then
echo "W: To successfully build the architecture-dependent parts of LinuxCNC, the following build dependencies are mising:"
else
echo "I: No dependencies missing while not building the documentation."
fi
fi
if [ -n "$a" ]; then
# The common part once missing packages have been identified
echo -n " "; echo "$a" | cut -f4 -d:
echo " The missing packages are auto-installed by"
echo " sudo apt build-dep ."
fi
else
echo "W: Tool to check build-dependenices not found"
echo " You may want to install it as follows:"
echo " sudo apt install dpkg-dev"
echo " and directly execute it like this:"
echo " dpkg-checkbuilddeps"
echo " or just execute"
echo " sudo apt build-dep ."
fi
# vim: ts=4