File winexe.spec of Package winexe

#
# RPM SPEC file for the winexe
#
# 08/07/2020, Spiro Trikaliotis <obs-winexe@spiro.trikaliotis.net>
#

Summary: Remote Windows-command executor
%define name winexe
Name: %{name}
%define version 1.1.0.git.13734490652
Version: 1.1.0.git.1396210237.b926301
Release: 1
License: GPL-3.0
Group: Development/Languages/C and C++
Source: %{name}-%{version}.tar.gz
Vendor: Andrzej Hajda
#Packager: Spiro Trikaliotis <obs-winexe@spiro.trikaliotis.net>
URL: https://sourceforge.net/projects/winexe
BuildRequires: python
BuildRequires: python-devel
BuildRequires: python-xml
BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: mingw32-cross-gcc
BuildRequires: mingw32-cross-binutils
BuildRequires: pam-devel
BuildRequires: perl-Parse-Yapp
BuildRequires: libacl-devel
BuildRequires: libarchive-devel
BuildRequires: libgpgme-devel
BuildRequires: libjansson-devel
BuildRequires: libgnutls-devel
BuildRequires: libtalloc-devel
BuildRequires: libtevent-devel
BuildRequires: popt-devel
BuildRequires: lmdb-devel
BuildRequires: openldap2-devel
BuildRequires: rpcgen
BuildRequires: samba
BuildRequires: samba-client
BuildRequires: samba-libs
BuildRequires: libdcerpc-devel
BuildRoot: %{_topdir}/%{name}-%{version}
Patch0: add-compile-debug.patch
Patch1: work-around-dropped-headers.patch
Patch2: Switch-to-Python-3.patch
Patch3: update-waf-python3.patch
Patch4: fix-spelling-error.patch

%description
Winexe remotely executes commands on Windows NT/2000/XP/2003 systems from
GNU/Linux (and possibly also from other Unices capable of building the Samba 4
software package).

Original home:
https://sourceforge.net/p/winexe/winexe-waf/ci/master/tree/

This version is based on Kali's version:
https://gitlab.com/kalilinux/packages/winexe

%files
%defattr(644,root,root,755)

%doc LICENSE

%attr(755,root,root) /usr/bin/*




###############################################################################
#                                   Build                                     #
###############################################################################



%prep
%setup -q

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

# unpack samba sources

pwd

tar -x --xz -f /home/abuild/rpmbuild/SOURCES/src-samba/samba_*.orig.tar.xz
ln -sf samba-* samba

cd samba
tar -x --xz -f /home/abuild/rpmbuild/SOURCES/src-samba/samba_*.debian.tar.xz

for PATCHFILE in `cat debian/patches/series`; do
	if [ "$PATCHFILE" != "VERSION.patch" ]; then
		patch -p1 < debian/patches/$PATCHFILE
	fi
done

%build
pwd 

SAMBA_LIBDIR=$(pkg-config --variable libdir samba-util)/samba
SAMBA_INCDIR=$(pkg-config --variable includedir samba-util)
#SAMBA_DIR=$(pwd)/samba
CURDIR=$(pwd)

cd samba && ./buildtools/bin/waf -j 1 configure
./buildtools/bin/waf build
cd ../source && ./waf -j 1 configure --prefix=/usr --samba-dir=../samba --samba-lib-dirs=$SAMBA_LIBDIR --samba-inc-dirs="$SAMBA_INCDIR:$CURDIR/samba/source4:$CURDIR/samba:$CURDIR/samba/bin/default/source4:$CURDIR/samba/bin/default:$CURDIR/samba/lib/replace:$CURDIR/samba/lib:$CURDIR/samba/bin/default/include"
./waf build --verbose

%install
rm -rf $RPM_BUILD_ROOT

cd source && ./waf install --destdir $RPM_BUILD_ROOT/
# bin2c is only useful at build time, and should not be installed
# because it conflicts with nvidia-cuda-toolkit's one
rm -f $RPM_BUILD_ROOT/winexe/usr/bin/bin2c

%clean
rm -rf $RPM_BUILD_ROOT



%changelog
* Thu Aug 12 2020 Spiro Trikaliotis <obs-winexe@spiro.trikaliotis.net>
- Initial version
openSUSE Build Service is sponsored by