The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 %define module  @PACKAGE@
    2 
    3 %if !%{defined ksrc}
    4 %if 0%{?rhel}%{?fedora}%{?openEuler}
    5 %define ksrc    ${kernel_version##*___}
    6 %else
    7 %define ksrc    "$( \
    8         if [ -e "/usr/src/linux-${kernel_version%%___*}" ]; then \
    9             echo "/usr/src/linux-${kernel_version%%___*}"; \
   10         elif [ -e "/lib/modules/${kernel_version%%___*}/source" ]; then \
   11             echo "/lib/modules/${kernel_version%%___*}/source"; \
   12         else \
   13             echo "/lib/modules/${kernel_version%%___*}/build"; \
   14         fi)"
   15 %endif
   16 %endif
   17 
   18 %if !%{defined kobj}
   19 %if 0%{?rhel}%{?fedora}%{?openEuler}
   20 %define kobj    ${kernel_version##*___}
   21 %else
   22 %define kobj    "$( \
   23         if [ -e "/usr/src/linux-${kernel_version%%___*}" ]; then \
   24             echo "/usr/src/linux-${kernel_version%%___*}"; \
   25         else \
   26             echo "/lib/modules/${kernel_version%%___*}/build"; \
   27         fi)"
   28 %endif
   29 %endif
   30 
   31 #define repo    rpmfusion
   32 #define repo    chaos
   33 
   34 # (un)define the next line to either build for the newest or all current kernels
   35 %define buildforkernels newest
   36 #define buildforkernels current
   37 #define buildforkernels akmod
   38 
   39 %bcond_with     debug
   40 %bcond_with     debuginfo
   41 
   42 
   43 Name:           %{module}-kmod
   44 
   45 Version:        @VERSION@
   46 Release:        @RELEASE@%{?dist}
   47 Summary:        Kernel module(s)
   48 
   49 Group:          System Environment/Kernel
   50 License:        @ZFS_META_LICENSE@
   51 URL:            https://github.com/openzfs/zfs
   52 Source0:        %{module}-%{version}.tar.gz
   53 Source10:       kmodtool
   54 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id} -u -n)
   55 %if 0%{?rhel}%{?fedora}%{?openEuler}
   56 BuildRequires:  gcc, make
   57 BuildRequires:  elfutils-libelf-devel
   58 %endif
   59 
   60 %if (0%{?fedora}%{?suse_version}%{?openEuler}) || (0%{?rhel} && 0%{?rhel} < 9)
   61 # We don't directly use it, but if this isn't installed, rpmbuild as root can
   62 # crash+corrupt rpmdb
   63 # See issue #12071
   64 BuildRequires:  ncompress
   65 %endif
   66 
   67 # The developments headers will conflict with the dkms packages.
   68 Conflicts:      %{module}-dkms
   69 
   70 %if %{defined repo}
   71 
   72 # Building for a repository use the proper build-sysbuild package
   73 # to determine which kernel-devel packages should be installed.
   74 BuildRequires:  %{_bindir}/kmodtool
   75 %{!?kernels:BuildRequires: buildsys-build-%{repo}-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu}}
   76 
   77 %else
   78 
   79 # Building local packages attempt to to use the installed kernel.
   80 %{?rhel:BuildRequires: kernel-devel}
   81 %{?fedora:BuildRequires: kernel-devel}
   82 %{?openEuler:BuildRequires: kernel-devel}
   83 %{?suse_version:BuildRequires: kernel-source}
   84 
   85 %if !%{defined kernels} && !%{defined build_src_rpm}
   86     %if 0%{?rhel}%{?fedora}%{?suse_version}%{?openEuler}
   87         %define kernels %(ls -1 /usr/src/kernels)
   88     %else
   89         %define kernels %(ls -1 /lib/modules)
   90     %endif
   91 %endif
   92 %endif
   93 
   94 # LDFLAGS are not sanitized by arch/*/Makefile for these architectures.
   95 %ifarch ppc ppc64 ppc64le aarch64
   96 %global __global_ldflags %{nil}
   97 %endif
   98 
   99 # Kmodtool does its magic here.  A patched version of kmodtool is shipped
  100 # with the source rpm until kmod development packages are supported upstream.
  101 # https://bugzilla.rpmfusion.org/show_bug.cgi?id=2714
  102 %{expand:%(bash %{SOURCE10} --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} %{?kernelbuildroot:--buildroot "%{?kernelbuildroot}"} 2>/dev/null) }
  103 
  104 
  105 %description
  106 This package contains the ZFS kernel modules.
  107 
  108 %prep
  109 # Error out if there was something wrong with kmodtool.
  110 %{?kmodtool_check}
  111 
  112 # Print kmodtool output for debugging purposes:
  113 bash %{SOURCE10}  --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} %{?kernelbuildroot:--buildroot "%{?kernelbuildroot}"} 2>/dev/null
  114 
  115 %if %{with debug}
  116     %define debug --enable-debug
  117 %else
  118     %define debug --disable-debug
  119 %endif
  120 
  121 %if %{with debuginfo}
  122     %define debuginfo --enable-debuginfo
  123 %else
  124     %define debuginfo --disable-debuginfo
  125 %endif
  126 
  127 # Leverage VPATH from configure to avoid making multiple copies.
  128 %define _configure ../%{module}-%{version}/configure
  129 
  130 %setup -q -c -T -a 0
  131 
  132 for kernel_version in %{?kernel_versions}; do
  133     %{__mkdir} _kmod_build_${kernel_version%%___*}
  134 done
  135 
  136 %build
  137 for kernel_version in %{?kernel_versions}; do
  138     cd _kmod_build_${kernel_version%%___*}
  139     %configure \
  140         --with-config=kernel \
  141         --with-linux=%{ksrc} \
  142         --with-linux-obj=%{kobj} \
  143         %{debug} \
  144         %{debuginfo} \
  145         %{?kernel_cc} \
  146         %{?kernel_ld} \
  147         %{?kernel_llvm}
  148     make %{?_smp_mflags}
  149     cd ..
  150 done
  151 
  152 
  153 %install
  154 rm -rf ${RPM_BUILD_ROOT}
  155 
  156 # Relies on the kernel 'modules_install' make target.
  157 for kernel_version in %{?kernel_versions}; do
  158     cd _kmod_build_${kernel_version%%___*}
  159     make install \
  160         DESTDIR=${RPM_BUILD_ROOT} \
  161         %{?prefix:INSTALL_MOD_PATH=%{?prefix}} \
  162         INSTALL_MOD_DIR=%{kmodinstdir_postfix}
  163     cd ..
  164 done
  165 # find-debuginfo.sh only considers executables
  166 chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*
  167 %{?akmod_install}
  168 
  169 
  170 %clean
  171 rm -rf $RPM_BUILD_ROOT

Cache object: d627a4cee95f6555fea23f75d7b2427e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.