Skip to content

Commit 451dff3

Browse files
committed
builddeb: split libc headers deployment out into a function
Deploy user-space headers (linux-libc-dev package) in a separate function for readability. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 3126c17 commit 451dff3

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

scripts/package/builddeb

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,25 @@ deploy_kernel_headers () {
8484
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
8585
}
8686

87+
deploy_libc_headers () {
88+
pdir=$1
89+
90+
rm -rf $pdir
91+
92+
$MAKE -f $srctree/Makefile headers
93+
$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr
94+
95+
# move asm headers to /usr/include/<libc-machine>/asm to match the structure
96+
# used by Debian-based distros (to support multi-arch)
97+
host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
98+
mkdir $pdir/usr/include/$host_arch
99+
mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
100+
}
101+
87102
version=$KERNELRELEASE
88103
tmpdir=debian/linux-image
89-
libc_headers_dir=debian/linux-libc-dev
90104
dbg_dir=debian/linux-image-dbg
91105
packagename=linux-image-$version
92-
libc_headers_packagename=linux-libc-dev
93106
dbg_packagename=$packagename-dbg
94107

95108
if [ "$ARCH" = "um" ] ; then
@@ -113,7 +126,7 @@ esac
113126
BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
114127

115128
# Setup the directory structure
116-
rm -rf "$tmpdir" "$libc_headers_dir" "$dbg_dir" debian/files
129+
rm -rf "$tmpdir" "$dbg_dir" debian/files
117130
mkdir -m 755 -p "$tmpdir/DEBIAN"
118131
mkdir -p "$tmpdir/lib" "$tmpdir/boot"
119132

@@ -163,16 +176,6 @@ if is_enabled CONFIG_MODULES; then
163176
fi
164177
fi
165178

166-
if [ "$ARCH" != "um" ]; then
167-
$MAKE -f $srctree/Makefile headers
168-
$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
169-
# move asm headers to /usr/include/<libc-machine>/asm to match the structure
170-
# used by Debian-based distros (to support multi-arch)
171-
host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
172-
mkdir $libc_headers_dir/usr/include/$host_arch
173-
mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
174-
fi
175-
176179
# Install the maintainer scripts
177180
# Note: hook scripts under /etc/kernel are also executed by official Debian
178181
# kernel packages, as well as kernel packages built using make-kpkg.
@@ -202,7 +205,8 @@ if [ "$ARCH" != "um" ]; then
202205
deploy_kernel_headers debian/linux-headers
203206
create_package linux-headers-$version debian/linux-headers
204207

205-
create_package "$libc_headers_packagename" "$libc_headers_dir"
208+
deploy_libc_headers debian/linux-libc-dev
209+
create_package linux-libc-dev debian/linux-libc-dev
206210
fi
207211

208212
create_package "$packagename" "$tmpdir"

0 commit comments

Comments
 (0)