kbuild: rpm-pkg: split out the body of spec file
[platform/kernel/linux-starfive.git] / scripts / package / mkspec
1 #!/bin/sh
2 #
3 #       Output a simple RPM spec file.
4 #       This version assumes a minimum of RPM 4.13
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
12 # how we were called determines which rpms we build and how we build them
13 if [ -z "$1" ]; then
14         mkdir -p rpmbuild/SOURCES
15         cp linux.tar.gz rpmbuild/SOURCES
16         cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config
17         "${srctree}/scripts/package/gen-diff-patch" rpmbuild/SOURCES/diff.patch
18 fi
19
20 if grep -q CONFIG_MODULES=y include/config/auto.conf; then
21 echo '%define with_devel %{?_without_devel: 0} %{?!_without_devel: 1}'
22 else
23 echo '%define with_devel 0'
24 fi
25
26 cat<<EOF
27 %define ARCH ${ARCH}
28 %define KERNELRELEASE ${KERNELRELEASE}
29 %define pkg_release $("${srctree}/init/build-version")
30 EOF
31
32 cat "${srctree}/scripts/package/kernel.spec"