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
|
#!/bin/bash
# dpkg configuration script for linuxcnc
# 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"
usage () {
P=${0##*/}
cat <<EOF
$P: Set up debian/ files to build for a particular kernel
Usage:
$P sim
Build for a system without a realtime kernel
$P [kernel-version]
Build for the realtime kernel [kernel-version], such as 2.6.12-magma
$P -r
Build for the currently running kernel
$P -a
If the currently running kernel has realtime extensions, use it.
Otherwise use any available realtime kernel it can find.
EOF
}
cd "${0%/*}"
if [ $# -ne 1 -o "$1" == "-h" -o "$1" == "-help" -o "$1" == "--help" ]; then
usage
if [ $# -ne 1 ]; then
exit 1
fi
exit 0
fi
if [ $1 = "-r" ]; then
set -- `uname -r`
elif [ $1 = "-a" ]; then
KERNEL="$(uname -r)"
if [ ! -d "/usr/realtime-$KERNEL" ]; then
KERNEL=$(ls -1d /usr/realtime-* 2> /dev/null | cut -d - -f 2- | head -1)
if [ -z "$KERNEL" ]; then
echo "no realtime kernels found!"
exit 1
fi
fi
set -- $KERNEL
fi
TARGET=$1
MODULE_PATH=usr/realtime-$1/modules/linuxcnc
MODULE_EXT=.ko
KERNEL_DEPENDS=linux-image-$1,rtai-modules-$1
KERNEL_HEADERS=linux-headers-$1
EXTRA_FILES="usr/bin/linuxcnc_module_helper"
KERNEL_VERSION=$1
DRIVERS=drivers.files.in
PYTHON_VERSION=$(python -c 'import sys; print sys.version[:3]')
PYTHON_VERSION_NEXT=$(python -c 'import sys; print sys.version[:2] + str(1+int(sys.version[2]))')
# hope this works on other systems too
DISTRIB_NAME=
if [ "$(which lsb_release)" != "" ]; then
DISTRIB_NAME="$(lsb_release -s -i)-$(lsb_release -s -r)"
elif [ -f /etc/lsb-release ]; then
source /etc/lsb-release
DISTRIB_NAME=$DISTRIB_ID-$DISTRIB_RELEASE
fi
if [ -d extras-$DISTRIB_NAME/linuxcnc.files ]; then
EXTRAS=extras-$DISTRIB_NAME/linuxcnc.files
else
EXTRAS=extras
fi
case $DISTRIB_NAME in
Ubuntu-14.04) # Trusty Tahr
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,texlive-font-utils,module-init-tools
TCLTK_VERSION=8.6
;;
Ubuntu-12.10) # Quantal Quetzal
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,texlive-font-utils,module-init-tools
TCLTK_VERSION=8.5
;;
Ubuntu-12.04) # Precise Pangolin LTS
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,texlive-font-utils,module-init-tools
TCLTK_VERSION=8.5
;;
Ubuntu-11.04) # natty
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,texlive-font-utils,module-init-tools
TCLTK_VERSION=8.5
;;
Ubuntu-10.04)
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,texlive-font-utils,module-init-tools
TCLTK_VERSION=8.5
;;
Ubuntu-9.10)
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,module-init-tools
TCLTK_VERSION=8.5
;;
Ubuntu-8.04)
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-spanish,module-init-tools
TCLTK_VERSION=8.4
;;
Debian-testing|Debian-7.*)
EXTRA_BUILD=dvipng,texlive-extra-utils,texlive-latex-recommended,texlive-fonts-recommended,ghostscript,imagemagick,texlive-lang-french,texlive-lang-german,texlive-lang-spanish,texlive-lang-polish,texlive-font-utils,kmod
TCLTK_VERSION=8.5
;;
Debian-6.0*)
EXTRA_BUILD=dvipng,module-init-tools
TCLTK_VERSION=8.5
;;
Debian-5.0*)
EXTRA_BUILD=dvipng,module-init-tools
TCLTK_VERSION=8.4
;;
*)
echo "unknown distribution: $DISTRIB_NAME"
echo "configuration may be wrong!"
EXTRA_BUILD=dvipng,kmod
TCLTK_VERSION=8.4
;;
esac
DOC_BUILD=
MAIN_PACKAGE_NAME=linuxcnc
OTHER_MAIN_PACKAGE_NAME=linuxcnc-sim
OLD_PACKAGE_NAME=emc2
EXTRA_RECOMMENDS=hostmot2-firmware
case $TARGET in
sim)
MODULE_PATH=usr/lib/linuxcnc/modules
MODULE_EXT=.so
KERNEL_DEPENDS=
KERNEL_HEADERS=libpth-dev
DRIVERS=
EXTRA_FILES="usr/bin/rtapi_app"
DISTRIB_NAME=sim-$DISTRIB_NAME
MAIN_PACKAGE_NAME=linuxcnc-sim
OTHER_MAIN_PACKAGE_NAME=linuxcnc
OLD_PACKAGE_NAME=emc2-sim
# don't bother recommending hostmot2 firmware on sim
EXTRA_RECOMMENDS=
;;
2.6.12-magma)
KERNEL_HEADERS=$KERNEL_HEADERS,gcc-3.4
;;
2.6.15-magma)
KERNEL_HEADERS=$KERNEL_HEADERS,gcc-4.0
;;
2.6.22.6-magma|2.6.24-16-rtai)
KERNEL_HEADERS="$KERNEL_HEADERS"
;;
2.6.24-16-rtai)
KERNEL_HEADERS=$KERNEL_HEADERS,gcc-4.2
;;
2.6.32-122-rtai) ;;
*)
echo "your kernel '$TARGET' is not known. There might be needed dependencies which won't get set automatically."
esac
subst () {
sed -e "s|@MODULE_PATH@|$MODULE_PATH|g" \
-e "s|@MODULE_EXT@|$MODULE_EXT|g" \
-e "s|@KERNEL_VERSION@|$KERNEL_VERSION|g" \
-e "s|@KERNEL_DEPENDS@|$KERNEL_DEPENDS|g" \
-e "s|@KERNEL_HEADERS@|$KERNEL_HEADERS|g" \
-e "s|@EXTRA_BUILD@|$EXTRA_BUILD|g" \
-e "s|@EXTRA_RECOMMENDS@|$EXTRA_RECOMMENDS|g" \
-e "s|@MAIN_PACKAGE_NAME@|$MAIN_PACKAGE_NAME|g" \
-e "s|@OTHER_MAIN_PACKAGE_NAME@|$OTHER_MAIN_PACKAGE_NAME|g" \
-e "s|@OLD_PACKAGE_NAME@|$OLD_PACKAGE_NAME|g" \
-e "s|@EXTRAS@|$EXTRAS|g" \
-e "s|@EXTRA_FILES@|$EXTRA_FILES|g" \
-e "s|@DISTRIB_NAME@|$DISTRIB_NAME|g" \
-e "s|@TARGET@|$TARGET|g" \
-e "s|@PYTHON_VERSION@|$PYTHON_VERSION|g" \
-e "s|@TCLTK_VERSION@|$TCLTK_VERSION|g" \
-e "s|@PYTHON_VERSION_NEXT@|$PYTHON_VERSION_NEXT|g" \
$*
}
subst control.in > control
if [ "$TARGET" == "sim" ]; then
cp linuxcnc-dev.files.in linuxcnc-sim-dev.files
else
cp linuxcnc-dev.files.in linuxcnc-dev.files
echo "$MODULE_PATH/Module.symvers" >> linuxcnc-dev.files
fi
subst rules.in > rules; chmod +x rules
if [ -f $EXTRAS/linuxcnc.files ]; then
subst linuxcnc.files.in $DRIVERS $EXTRAS/linuxcnc.files > $MAIN_PACKAGE_NAME.files
else
subst linuxcnc.files.in $DRIVERS > $MAIN_PACKAGE_NAME.files
fi
DOCS_PACKAGES=$(echo linuxcnc-doc-{en,fr,es})
for P in $DOCS_PACKAGES; do
if [ -f $EXTRAS/$P.files ]; then
cat $P.files.in $EXTRAS/$P.files > $P.files
else
cat $P.files.in > $P.files
fi
done
rm -f ../build-stamp
echo "successfully configured for '$DISTRIB_NAME'-'$TARGET'.."
|