File nsgminer.spec of Package nsgminer

#
# spec file for package nsgminer
#

Name:           nsgminer
Summary:        A NeoScrypt miner
%define common_name nsgminer
Version:        0
Release:        0
License:        GPL-3.0+
Group:          Productivity/Networking/Other
Url:            http://%{common_name}.org/
Source0:        %{common_name}-%{version}.tar.gz
Patch0:         %{common_name}-autoreconf.patch
Patch1:         %{common_name}-redefinition-of-typedefs.patch
BuildRequires:  autoconf >= 2.59
BuildRequires:  automake >= 1.11
BuildRequires:  libcurl-devel
BuildRequires:  libgcrypt-devel
##if 0%{?suse_version} && 0%{?suse_version} > 1320
#BuildRequires:  libi2c0-devel
##else
#BuildRequires:  i2c-tools
##endif
##if 0%{?suse_version} < 1330
#BuildRequires:  gcc5 >= 5.1
#BuildRequires:  gcc5-c++ >= 5.1
##else
#BuildRequires:  gcc-c++ >= 5.1
##endif
##if 0%{?is_opensuse}
#BuildRequires:  hwloc-devel
#BuildRequires:  libmicrohttpd-devel
##endif
BuildRequires:  libtool
BuildRequires:  libudev-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  ncurses-devel
BuildRequires:  openssl-devel
BuildRequires:  pkg-config
##if 0%{?suse_version} && 0%{?suse_version} >= 1315
##BuildRequires:  systemd-devel
##endif
BuildRequires:  yasm
##BuildRequires:  zlib-devel

##if 0%{?suse_version} && 0%{?suse_version} >= 1315
##define configure_libsystemd --enable-libsystemd
##else
##define configure_libsystemd --disable-libsystemd
##endif

%description
NSGminer is a multithreaded multipool GPU, CPU and FPGA miner with the
AMD and NVIDIA GPU support including temperature monitoring, fan speed
monitoring, clock speed and voltage reporting, (over/under)clocking
for NeoScrypt powered coins.

%package -n %{name}-daemon
Summary:        Daemon for %{name}
Group:          Productivity/Networking/Other
Requires:       %{name} = %{version}
%{?systemd_requires}
Recommends:     logrotate

%description -n %{name}-daemon
This package contains a systemd daemon for %{name}.

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/Man
BuildArch:      noarch

%description doc
This package contains the documentation for %{name}.

%prep
echo "*** sle_version: "0%{?sle_version}
echo "*** suse_version: "0%{?suse_version}
%setup -q -n %{common_name}-%{version}
%patch0 -p1
%patch1 -p1

##{__sed} 's#^__SETTINGS__$#cgminer_bin=%{_bindir}/%{common_name}\ncgminer_conf=%{_sysconfdir}/%{common_name}.conf\ncgminer_log=%{_localstatedir}/log/%{common_name}/%{common_name}.log\ncgminer_run=%{_localstatedir}/run/%{common_name}.pid#g' %{S:1} > start_%{common_name}
##{__sed} 's#^__SETTINGS__$#ExecStart=%{_sbindir}/start_%{common_name} start\nExecStop=%{_sbindir}/start_%{common_name} stop#g' %{S:2} > %{common_name}.service

%build
%if 0%{?suse_version} < 1210
# autoconf
export AUTOCONF=/usr/bin/autoconf-2.69
export AUTOM4TE=/usr/bin/autom4te-2.69
export AUTORECONF=/usr/bin/autoreconf-2.69
# automake
export AUTOMAKE=/usr/bin/automake-1.15
export ACLOCAL=/usr/bin/aclocal-1.15
%endif
NOSUBMODULES=yes \
NOCONFIGURE=yes \
./autogen.sh
%configure --enable-silent-rules \
           --enable-cpumining \
           --enable-neoscrypt \
           --enable-scrypt \
           --enable-sha256d \
           --enable-bitforce \
           --enable-icarus \
           --enable-modminer \
           --enable-x6500 \
           --enable-ztex
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
find %{buildroot}
##{__mkdir_p} %{buildroot}%{_sbindir}
##{__mkdir_p} %{buildroot}%{_localstatedir}/log/%{common_name}
##{__mkdir_p} %{buildroot}%{_sysconfdir}/logrotate.d
##{__mkdir_p} %{buildroot}%{_usr}/lib/udev/rules.d
##{__mkdir_p} %{buildroot}%{_unitdir}
##{__mkdir_p} %{buildroot}%{_defaultdocdir}/%{name}/bitstreams
##{__install} -m 0644 -p -t %{buildroot}%{_usr}/lib/udev/rules.d 01-%{common_name}.rules
##{__install} -m 0644 -p -t %{buildroot}%{_defaultdocdir}/%{name} NEWS *README
##{__install} -m 0644 -p -t %{buildroot}%{_defaultdocdir}/%{name}/bitstreams bitstreams/COPYING_fpgaminer bitstreams/README
##{__rm} -fr %{buildroot}%{_bindir}/bitstreams
##{__install} -m 0755 -p -t %{buildroot}%{_sbindir} start_%{common_name}
##{__install} -m 0644 -p -t %{buildroot}%{_unitdir} %{common_name}.service
##{__cp} -a example.conf %{common_name}.conf
##{__install} -m 0644 -p -t %{buildroot}%{_sysconfdir} %{common_name}.conf
##{__ln_s} %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{common_name}

# generate logrotate configuration
#echo "%{_localstatedir}/log/%{common_name}/%{common_name}.log {" > %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    compress" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    dateext" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    daily" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    rotate 90" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    notifempty" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    missingok" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    copytruncate" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "    create 644" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}
#echo "}" >> %{buildroot}%{_sysconfdir}/logrotate.d/%{common_name}

##pre
#getent group %{plugdev_gname} > /dev/null || groupadd -g %{plugdev_gid} %{plugdev_gname}

##pre -n %{name}-daemon
##service_add_pre %{common_name}.service

##post -n %{name}-daemon
##service_add_post %{common_name}.service

##preun -n %{name}-daemon
##service_del_preun %{common_name}.service

##postun -n %{name}-daemon
##service_del_postun %{common_name}.service

%files
%defattr(-,root,root,-)
%attr(755,root,root) %{_bindir}/*
%{_usr}/lib/udev/rules.d/

%files -n %{name}-daemon
%defattr(-,root,root,-)
%attr(755,root,root) %{_sbindir}/start_%{common_name}
%{_sbindir}/rc%{common_name}
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/%{common_name}.conf
%attr(750,root,root) %dir %{_localstatedir}/log/%{common_name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{common_name}
%{_unitdir}/

%files doc
%defattr(-,root,root,-)
%{_defaultdocdir}/%{name}/

%changelog