File moxa.spec of Package moxa

#
# spec file for package moxa
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           moxa
BuildRequires:  kernel-source
BuildRequires:  kernel-syms
BuildRequires:  module-init-tools
BuildRequires:  udev
Summary:        Kernel modules for MOXA UPort devices
License:        GPL-2.0-only
Group:          System/Kernel
Version:        4.0
Release:        0
Source0:        https://www.moxa.com/getmedia/8990418a-d87c-46ef-9909-d4475fae255b/moxa-uport-1000-series-linux-kernel-4.0-for-uport-11x0-series-driver-v%{version}.tgz
Source1:        99-moxa_uport.rules
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
URL:            http://www.moxa.com/support/sarch_result.aspx?type=soft&prod_id=381&type_id=9

%suse_kernel_module_package kdump um

%description
This package contains the kernel modules to support MOXA UPort servers.

%package KMP
Summary:        Kernel modules for MOXA UPort devices
Group:          System/Kernel

%description KMP
This package contains the kernel modules to support MOXA UPort servers.

%pakcage -n moxa
BuildArch:      noarch

%prep
%setup -n source
mkdir obj

%build
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -r driver obj/$flavor
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
	M=$PWD/obj/$flavor
done

%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
	 M=$PWD/obj/$flavor
done
mkdir -p %{buildroot}/etc/udev/rules.d
cp %{SOURCE1} %{buildroot}/etc/udev/rules.d/99-moxa_uport.rules.template

%files
%defattr(-,root,root)
%doc readme.txt version.txt
/etc/udev/rules.d/*

%changelog
openSUSE Build Service is sponsored by