Merge tag 'probes-fixes-v6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / scripts / package / mkspec
CommitLineData
1da177e4
LT
1#!/bin/sh
2#
2174d292 3# Output a simple RPM spec file.
169dd780 4# This version assumes a minimum of RPM 4.13
1da177e4
LT
5#
6# The only gothic bit here is redefining install_post to avoid
7# stripping the symbols from files in the kernel which we want
8#
9# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
10#
11
c0414419
MY
12set -eu
13
ffa46bbc
MY
14output=$1
15
16mkdir -p "$(dirname "${output}")"
17
18exec >"${output}"
19
81f59a26 20if grep -q CONFIG_MODULES=y include/config/auto.conf; then
2a291fc3 21echo '%define with_devel %{?_without_devel: 0} %{?!_without_devel: 1}'
0b7f12f5 22else
2a291fc3 23echo '%define with_devel 0'
0b7f12f5
MY
24fi
25
a7c699d0
US
26# debuginfo package generation uses find-debuginfo.sh under the hood,
27# which only works on uncompressed modules that contain debuginfo
28if grep -q CONFIG_DEBUG_INFO=y include/config/auto.conf &&
29 (! grep -q CONFIG_MODULE_COMPRESS=y include/config/auto.conf) &&
30 (! grep -q CONFIG_DEBUG_INFO_SPLIT=y include/config/auto.conf); then
31echo '%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}'
32else
33echo '%define with_debuginfo 0'
34fi
35
49c803cd 36cat<<EOF
a06d9ef8 37%define ARCH ${ARCH}
93ed5605 38%define KERNELRELEASE ${KERNELRELEASE}
ae4c4cee 39%define pkg_release $("${srctree}/scripts/build-version")
8c5d4b64 40EOF
49c803cd
MY
41
42cat "${srctree}/scripts/package/kernel.spec"
301c1090
RA
43
44# collect the user's name and email address for the changelog entry
45if [ "$(command -v git)" ]; then
46 name=$(git config user.name) || true
47 email=$(git config user.email) || true
48fi
49
50if [ ! "${name:+set}" ]; then
51 name=${KBUILD_BUILD_USER:-$(id -nu)}
52fi
53
54if [ ! "${email:+set}" ]; then
55 buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
56 builduser=${KBUILD_BUILD_USER:-$(id -nu)}
57 email="${builduser}@${buildhost}"
58fi
59
60cat << EOF
61
62%changelog
ba6c6640 63* $(LC_ALL=C date +'%a %b %d %Y') ${name} <${email}>
301c1090
RA
64- Custom built Linux kernel.
65EOF