rules revision d85f5fb26ce3bbbcb8029e48b62f9d550c0317bf
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# Copyright (C) 2006-2011 Oracle Corporation
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# This file is part of VirtualBox Open Source Edition (OSE), as
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# available from http://www.virtualbox.org. This file is free software;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# you can redistribute it and/or modify it under the terms of the GNU
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# General Public License as published by the Free Software Foundation,
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# distribution. VirtualBox OSE is distributed in the hope that it will
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# be useful, but WITHOUT ANY WARRANTY of any kind.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# don't allow to check for kernel syms, otherwise we depend on specific kernel versions!
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee$(error /usr/lib/rpm/find-requires.ksyms must not be installed)
e77b06d21580f630e0a7c437495ab283d3672828tomeeifneq ($(wildcard /usr/lib/rpm/find-supplements.ksyms),)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# same for openSUSE
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee$(error /usr/lib/rpm/find-supplements.ksyms must not be installed)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeeifeq ($(shell if grep -q '^/usr/lib/virtualbox' /etc/permissions* 2>/dev/null; then echo yes; fi),yes)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# make sure openSUSE permissions fixes don't interfere with us
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeepkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeerpmlib := $(shell if [ `uname -m` = "x86_64" ]; then echo "lib64"; else echo "lib"; fi)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeearch := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "i386"; fi)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee # look for fedora
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee rpmrel := $(shell cat /etc/fedora-release | sed -e 's/^Fedora *release *\([1-9][0-9]*\) .*/fedora\1/')
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(error failed to detect the release type. Add /etc/distname or hack the detection.)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee rpmdist := $(strip $(shell grep $(rpmrel) $(current)/distributions_rpm | cut -d'=' -f2))
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(error Cannot detect package distribution (rpmrel=$(rpmrel)))
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee ifeq ($(filter-out rhel4 rhel5 rhel6 ol4 ol5 ol6 centos4 centos5 centos6 fedora9 fedora11 fedora12 fedora13 fedora14 fedora15 turbolinux11,$(rpmrel)),)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee ifeq ($(filter-out openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114 sles10.1 sles11.0,$(rpmrel)),)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(error failed to detect the .spec file (rpmrel=$(rpmrel)))
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee . rpm/env.sh && kmk -C $(vboxroot) $(bld_flags) $(verfile)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeerpmver :=$(ver)$(if $(NOSUBVER),,$(if $(svn_revision),_$(svn_revision),)$(VERSUFFIX)$(if $(DEBUG),_dbg,))$(if $(BLEEDING_EDGE),_$(BLEEDING_EDGE),)
e77b06d21580f630e0a7c437495ab283d3672828tomee# Fedora13/14 is bleeding edge, the other jails have outdated kernel headers
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeeinstmod := $(if $(filter rhel4 rhel5 rhel6 ol4 ol5 ol6 centos4 centos5 centos6 sles10.1 sles11.0 fedora13 fedora14 fedora15,$(rpmrel)),,install_rpm)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeeifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee$(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee # Mandriva 2007.1, Redhat
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(rpmname)\""
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee # Mandriva 2008.0
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee # Novell (OpenSUSE, SLES)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/packages/$(verpkg)\""
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomeecfg_flags := $(if $(filter rhel4 sles10.1,$(rpmrel)),--build-libxml2,) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter rhel4 sles10.1,$(rpmrel)),--build-libxslt,) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5 sles10.1,$(rpmrel)),--build-libcurl,) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter rhel5 centos5 sles10.1,$(rpmrel)),--disable-sdl-ttf,) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter sles10.1 turbolinux11,$(rpmrel)),--disable-pulse,) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5,$(rpmrel)),--enable-pulse,) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5 sles10.1 turbolinux11,$(rpmrel)),--with-qt4-dir=/home/vbox/Qt-4.4.3-stdc++6-$(arch)) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5 fedora9 fedora10 sles10.1 turbolinux11,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee cd $(vboxroot) && ./configure --odir=$(current)/rpm $(cfg_flags)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee . rpm/env.sh && kmk -C $(vboxroot) $(if $(NOPARALLEL),-j1,) $(bld_flags) all
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(NODOCS),,. rpm/env.sh && kmk -C $(vboxroot)/src/VBox/Main $(bld_flags) docs)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
e77b06d21580f630e0a7c437495ab283d3672828tomee rm -f rpm/build-stamp rpm/configure-stamp rpm/configure.log
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%VER%|$(ver)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%NAME%|$(verpkg)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%BUILDVER%|$(rpmver)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%BUILDREL%|$(rpmrel)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%BUILDROOT%|$(current)/rpm/buildroot|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%LIB%|$(rpmlib)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%SPEC%|$(rpmspec)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%MACROSPYTHON%|$(if $(wildcard /usr/lib/rpm/macros.python),%include /usr/lib/rpm/macros.python,)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%INSTMOD%|$(instmod)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%LIBASOUND%|$(if $(filter lib64,$(rpmlib)),libasound.so.2()(64bit),libasound.so.2)|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e '/#include installer-utils.sh/ {' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e "r $(vboxroot)/src/VBox/Installer/linux/installer-utils.sh" \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%NOLSB%|yes|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%DEBIAN%||g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%PACKAGE%|virtualbox|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%NOLSB%|yes|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%DEBIAN%||g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%PACKAGE%|virtualbox|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee vboxballoonctrl-service.sh.in > $(archdir)/vboxballoonctrl-service.init
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee -e 's|%NOLSB%|yes|g' \
cc01aeca826f4314d82007f16533b18d8e674824tomee -e 's|%DEBIAN%||g' \
cc01aeca826f4314d82007f16533b18d8e674824tomee -e 's|%PACKAGE%|virtualbox|g' \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee vboxweb-service.sh.in > $(archdir)/vboxweb-service.init
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee mv /usr/src/packages/RPMS/*/$(verpkg)-debug* $(pkgdir) || true
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee file=`find /usr/src/packages/RPMS -name $(verpkg)*rpm -print`; \
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee# Note! if rpmbuild fails: sudo chmod a+rw /usr/src/redhat/* /usr/src/redhat/RPMS/*