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