upgpkg: ocaml-integers 0.5.0-1
[arch-packages.git] / linux / repos / core-i686 / PKGBUILD
blob2251c1ff5c83b82a7cf4b28c876056112bf86e8b
1 # $Id$
2 # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
3 # Maintainer: Thomas Baechler <thomas@archlinux.org>
5 pkgbase=linux               # Build stock -ARCH kernel
6 #pkgbase=linux-custom       # Build kernel with a different name
7 _srcname=linux-4.13
8 pkgver=4.13.11
9 pkgrel=1
10 arch=('i686' 'x86_64')
11 url="https://www.kernel.org/"
12 license=('GPL2')
13 makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf')
14 options=('!strip')
15 source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
16         "https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.sign"
17         "https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.xz"
18         "https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.sign"
19         # the main kernel config files
20         'config.i686' 'config.x86_64'
21         # pacman hook for initramfs regeneration
22         '90-linux.hook'
23         # standard config files for mkinitcpio ramdisk
24         'linux.preset')
26 sha256sums=('2db3d6066c3ad93eb25b973a3d2951e022a7e975ee2fa7cbe5bddf84d9a49a2c'
27             'SKIP'
28             'f5fb017ee531dc35e3462ccb2d244d4fdc8ac6df9cd3337aa6df2ffc280b1bd6'
29             'SKIP'
30             '9b1d9fcb55782e6149aca4dc2d3b250dd4cedf1bf4bd8c6f0968acab0e2e0ee4'
31             '9c6c4d27d59638d0569ea09a97138bfcfb219f17cdf1138be141380e6654f302'
32             '834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0'
33             'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65')
34 validpgpkeys=(
35               'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
36               '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
37              )
39 _kernelname=${pkgbase#linux}
41 prepare() {
42   cd ${_srcname}
44   # add upstream patch
45   patch -p1 -i ../patch-${pkgver}
47   # security patches
49   # add latest fixes from stable queue, if needed
50   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
52   cp -Tf ../config.${CARCH} .config
54   if [ "${_kernelname}" != "" ]; then
55     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
56     sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
57   fi
59   # set extraversion to pkgrel
60   sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
62   # don't run depmod on 'make install'. We'll do this ourselves in packaging
63   sed -i '2iexit 0' scripts/depmod.sh
65   # get kernel version
66   make prepare
68   # load configuration
69   # Configure the kernel. Replace the line below with one of your choice.
70   #make menuconfig # CLI menu for configuration
71   #make nconfig # new CLI menu for configuration
72   #make xconfig # X-based configuration
73   #make oldconfig # using old config from previous kernel version
74   # ... or manually edit .config
76   # rewrite configuration
77   yes "" | make config >/dev/null
80 build() {
81   cd ${_srcname}
83   make ${MAKEFLAGS} LOCALVERSION= bzImage modules
86 _package() {
87   pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
88   [ "${pkgbase}" = "linux" ] && groups=('base')
89   depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
90   optdepends=('crda: to set the correct wireless channels of your country')
91   backup=("etc/mkinitcpio.d/${pkgbase}.preset")
92   install=linux.install
94   cd ${_srcname}
96   KARCH=x86
98   # get kernel version
99   _kernver="$(make LOCALVERSION= kernelrelease)"
100   _basekernel=${_kernver%%-*}
101   _basekernel=${_basekernel%.*}
103   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
104   make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
105   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
107   # set correct depmod command for install
108   sed -e "s|%PKGBASE%|${pkgbase}|g;s|%KERNVER%|${_kernver}|g" \
109     "${startdir}/${install}" > "${startdir}/${install}.pkg"
110   true && install=${install}.pkg
112   # install mkinitcpio preset file for kernel
113   sed "s|%PKGBASE%|${pkgbase}|g" ../linux.preset |
114     install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
116   # install pacman hook for initramfs regeneration
117   sed "s|%PKGBASE%|${pkgbase}|g" ../90-linux.hook |
118     install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
120   # remove build and source links
121   rm "${pkgdir}"/lib/modules/${_kernver}/{source,build}
123   # remove the firmware
124   rm -r "${pkgdir}/lib/firmware"
126   # make room for external modules
127   ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
129   # add real version for building modules and running depmod from post_install/upgrade
130   echo "${_kernver}" |
131     install -Dm644 /dev/stdin "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
133   # Now we call depmod...
134   depmod -b "${pkgdir}" -F System.map "${_kernver}"
136   # move module tree /lib -> /usr/lib
137   mv -t "${pkgdir}/usr" "${pkgdir}/lib"
139   # add vmlinux
140   install -Dm644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux"
143 _package-headers() {
144   pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
146   cd ${_srcname}
147   local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
149   install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
150   install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
152   mkdir "${_builddir}/.tmp_versions"
154   cp -t "${_builddir}" -a include scripts
156   install -Dt "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile
157   install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s
159   if [[ ${CARCH} = i686 ]]; then
160     install -t "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile_32.cpu
161   fi
163   cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include
165   install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
166   install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
168   # http://bugs.archlinux.org/task/9912
169   install -Dt "${_builddir}/drivers/media/dvb-core" -m644 drivers/media/dvb-core/*.h
171   # http://bugs.archlinux.org/task/13146
172   install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/lgdt330x.h
173   install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
175   # http://bugs.archlinux.org/task/20402
176   install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
177   install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
178   install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
180   # add xfs and shmem for aufs building
181   mkdir -p "${_builddir}"/{fs/xfs,mm}
183   # copy in Kconfig files
184   find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
186   # add objtool for external module building and enabled VALIDATION_STACK option
187   if [[ -e tools/objtool/objtool ]]; then
188     install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
189   fi
191   # remove unneeded architectures
192   local _arch
193   for _arch in "${_builddir}"/arch/*/; do
194     if [[ ${_arch} != */${KARCH}/ ]]; then
195       rm -r "${_arch}"
196     fi
197   done
199   # remove files already in linux-docs package
200   rm -r "${_builddir}/Documentation"
202   # Fix permissions
203   chmod -R u=rwX,go=rX "${_builddir}"
205   # strip scripts directory
206   local _binary _strip
207   while read -rd '' _binary; do
208     case "$(file -bi "${_binary}")" in
209       *application/x-sharedlib*)  _strip="${STRIP_SHARED}"   ;; # Libraries (.so)
210       *application/x-archive*)    _strip="${STRIP_STATIC}"   ;; # Libraries (.a)
211       *application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries
212       *) continue ;;
213     esac
214     /usr/bin/strip ${_strip} "${_binary}"
215   done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
218 _package-docs() {
219   pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel"
221   cd ${_srcname}
222   local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
224   mkdir -p "${_builddir}"
225   cp -t "${_builddir}" -a Documentation
227   # Fix permissions
228   chmod -R u=rwX,go=rX "${_builddir}"
231 pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs")
232 for _p in ${pkgname[@]}; do
233   eval "package_${_p}() {
234     $(declare -f "_package${_p#${pkgbase}}")
235     _package${_p#${pkgbase}}
236   }"
237 done
239 # vim:set ts=8 sts=2 sw=2 et: