Dominique, thanks a lot for your tips.

See my comments below.

> The wiki gives quite some overview of what to package and where to put it.
> Most of the things are done correct by now using make install (I remember a
> time this did not do anything useful).
> http://open-vm-tools.wiki.sourceforge.net/Packaging
Yes, I know this URL, unfortunately, I did not find any usefull tips regarding 
includes and devel parts.
It looks like some .c files are shared between modules and tools, that some .h 
files are in tools build structure, but also used by some mudules

For now I have an open-vm-tools that works for the userlan tools and system.
what I'm stuck with is the foillowing:
- Put modules in a dkms package that build modules at boot if the kernel has 
been updated
- Create a working open-vm-tools-devel package that permit developpements of 
new tools (tuypicaly would contain includes and .so files)

> Maybe you can have a look what I all did in the RPM for openSUSE? Might
Thanks a lot for your help, I had a 1st look at your RPM spec file which looks 
very interresting (see mine attached).
Unfortunately I don't quite understand the module part. As a distribution 
owner I understand that you create a binary package for the modules right?
I assume that %suse_kernel_module_package -n vmware-guest -p %{SOURCE98} xen 
um does all the magic ;-)
Although, I'm unable to follow this way as I'm not a Mandriva developper and 
thus I'm unable to follow thightly all new kernel releases. If a user updates 
its kernel, then I'll loose ability to connect it its vm and I'll have to 
rebuild modules by hand.
Thus I'm forced to go for the dkms way until Mandriva includes open-vm-tools 
in its main release tree.

Maybe one day all thoses modules will go into the standard linux kernel.... 
who knows?

Olivier.
-- 
        Olivier LAHAYE
        CEA Saclay
        DRT-LIST-DETECS-SSTM
%define builddate 2009.05.22
%define buildver 167859
%define debug_package %{nil}

Name:      open-vm-tools
Version:   %{builddate}.%{buildver}
Release:   %mkrel 1
Summary:   VMware Guest OS Tools
Group:     Applications/System
License:   LGPLv2
URL:       http://open-vm-tools.sourceforge.net/
Source0:   http://downloads.sourceforge.net/%{name}/%{name}-%{builddate}-%{buildver}.tar.gz
Source1:   %{name}-vmtoolsd.init
Source2:   %{name}-sysconfig.mouse
Source3:   vmware-toolbox.desktop
Source4:   %{name}-modprobe.vmnics
Source5:   %{name}-%{builddate}-%{buildver}.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

ExclusiveArch: i386 i586 x86_64

BuildRequires: gtk2-devel
buildRequires: libnotify-devel
BuildRequires: libxtst-devel
BuildRequires: libxscrnsaver-devel
BuildRequires: gtkmm2.4-devel
BuildRequires: gtk+-devel
BuildRequires: libdnet-devel
BuildRequires: procps
BuildRequires: libdnet-devel
BuildRequires: libicu-devel
BuildRequires: desktop-file-utils
BuildRequires: libpam-devel

#Requires:  open-vm-tools-kmod >= %{version}
#Obsoletes: open-vm-tools-kmod < %{version}
Requires:   dkms-open-vm-tools >= %{version}
Provides:  open-vm-tools-kmod-common = %{version}


%description
Open-vm-tools are the open source implementation of VMware Tools. They
are a set of guest operating system virtualization components that
enhance performance and user experience of VMWare virtual
machines. This package contains the user-space programs and libraries
of open-vm-tools.

%package        devel
Summary:        Development package for %{name}
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description    devel
Open-vm-tools are the open source implementation of VMware Tools. They
are a set of guest operating system virtualization components that
enhance performance and user experience of VMWare virtual
machines. This package contains the header files and symlinks to 
libraries.

%package -n     dkms-%{name}
Summary:        Kernel modules for open-vm-tools
Group:          System/Kernel and hardware
License:        LGPLv2
Requires(post): 	dkms
Requires(preun):        dkms

%description -n dkms-%{name}
Kernel modules for open-vm-tools

%prep
%setup -q -n open-vm-tools-%{builddate}-%{buildver}
# Patch doc generation
patch -p1 < %SOURCE5
# Fix some permissions and formats
chmod -x NEWS README ChangeLog AUTHORS COPYING
sed -i 's/\r//' README


%build
%configure \
        --disable-static \
        --disable-dependency-tracking \
        --without-kernel-modules \
        --without-root-privileges \
        --with-gtkmm

# Disable use of rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';'

# Create dkms tree and fill it
mkdir -p $RPM_BUILD_ROOT%{_usrsrc}/%{name}-%{version}-%{release}
cp -r modules/linux/* $RPM_BUILD_ROOT%{_usrsrc}/%{name}-%{version}-%{release}/

# Install vmware-guestd init script
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/vmtoolsd

# GPM vmmouse support
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/mouse

# Move mount.vmhgfs to correct location in /sbin
mkdir -p $RPM_BUILD_ROOT/sbin
mv $RPM_BUILD_ROOT%{_sbindir}/mount.* $RPM_BUILD_ROOT/sbin

# Install VMCI sockets header file
mkdir -p $RPM_BUILD_ROOT%{_includedir}
install -m 0644 modules/linux/vsock/linux/vmci_sockets.h $RPM_BUILD_ROOT%{_includedir}
cp -pr lib/include/* $RPM_BUILD_ROOT%{_includedir}
chmod -R ugo+rX $RPM_BUILD_ROOT%{_includedir}
install -m 0644 lib/hgfs/cpNameInt.h $RPM_BUILD_ROOT%{_usrsrc}/%{name}-%{version}-%{release}/shared/

# Move vmware-user desktop into autostart directory
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xdg/autostart
mv $RPM_BUILD_ROOT%{_datadir}/applications/vmware-user.desktop $RPM_BUILD_ROOT%{_sysconfdir}/xdg/autostart/

# Install desktop file and icon for toolbox
mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -m 0644 toolbox/bigIcon.xpm $RPM_BUILD_ROOT%{_datadir}/pixmaps/vmware-toolbox.xpm
desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE3}

# Setup module-init-tools file for vmxnet
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
install -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/vmnics

%clean
rm -rf $RPM_BUILD_ROOT


%post
# Setup guestd on initial install
/sbin/ldconfig
[ $1 -lt 2 ] && /sbin/chkconfig vmware-guestd on ||:
update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :


%postun
update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :
/sbin/ldconfig


%preun
# Remove on uninstall
if [ "$1" = 0 ]
then
  /sbin/service vmware-guestd stop > /dev/null 2>&1 || :
  /sbin/chkconfig --del vmware-guestd ||:
fi

%post -n dkms-%{name}
set -x
/usr/sbin/dkms --rpm_safe_upgrade add -m %{name} -v %{version}-%{release}
/usr/sbin/dkms --rpm_safe_upgrade build -m %{name} -v %{version}-%{release}
/usr/sbin/dkms --rpm_safe_upgrade install -m %{name} -v %{version}-%{release}
:

%preun -n dkms-%{name}
set -x
/usr/sbin/dkms --rpm_safe_upgrade remove -m %{name} -v %{version}-%{release} --all
:

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_bindir}/vmtoolsd
%{_bindir}/vmware-checkvm
%{_bindir}/vmware-hgfsclient
%{_bindir}/vmware-rpctool
%{_bindir}/vmware-toolbox
%{_bindir}/vmware-toolbox-cmd
%{_bindir}/vmware-user
%{_bindir}/vmware-xferlogs
%attr(4755,root,root) %{_bindir}/vmware-user-suid-wrapper
%attr(4755,root,root) /sbin/mount.vmhgfs
%{_libdir}/*.so.*
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/*.xpm
%{_sysconfdir}/xdg/autostart/*.desktop
%{_sysconfdir}/init.d/*
%{_sysconfdir}/vmware-tools
%config(noreplace) %{_sysconfdir}/pam.d/*
%config(noreplace) %{_sysconfdir}/sysconfig/mouse
%config(noreplace) %{_sysconfdir}/modprobe.d/*
%{_libdir}/open-vm-tools

%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_datadir}/%{name}/*

%files -n dkms-%{name}
%defattr(-,root,root)
%{_usrsrc}/%{name}-%{version}-%{release}


%changelog
* Mon May 25 2009 Olivier Lahaye <olivier.laha...@free.fr> - 2009.05.22-167859-1mdv2009.1
- Update to upstream build 167859

* Fri May 15 2009 Olivier Lahaye <olivier.laha...@free.fr> - 2009.04.23-162451-1mdv2009.1
- Port to Mandriva 2009.1 from fedora
- Update to upstream build 162451
- integrated dkms package build

* Sat Jan 10 2009 Denis Leroy <de...@poolshark.org> - 0.0.0.137496-1
- Update to upstream build 137496

* Thu Dec 18 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.130226-1
- Update to upstream 130226
- Desktop patch upstreamed

* Mon Nov 10 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.123053-9
- Some more cleanups

* Fri Oct 31 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.123053-8
- Added toolbox icon

* Tue Oct 28 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.123053-7
- Only export vmci_sockets.h file

* Mon Oct 27 2008 Orcan Ogetbil <orcan [AT] yahoo [DOT] com> 0.0.0.123053-6
- Bugfix: Doesn't build for x86_64.
- Added a devel package containing the header and .so files.
- The shell scripts in %%{_sysconfdir}/vmware-tools/ are now marked non-%%config.
- Minor SPEC file improvements.

* Mon Oct 27 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.123053-5
- Fixed desktop-file-utils reqs

* Sun Oct 26 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.123053-4
- Move drag'n'drop directory management to init script
- Added icon to toolbox desktop entry
- Some rpmlint cleanups

* Tue Oct 21 2008 Denis Leroy <de...@poolshark.org> - 0.0.0.123053-2
- Changed versioning
- Added patches and extra config files as sources

* Wed Oct 15 2008 Denis Leroy <de...@poolshark.org> - 0-1.2008.10.10
- First draft, based on dkms-based spec
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
open-vm-tools-devel mailing list
open-vm-tools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-vm-tools-devel

Reply via email to