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