rules revision e361162aaa3f264085c651f9ea83f70d0ff3e431
080575042aba2197b425ebfd52061dea061a9aa1xy# Copyright (C) 2006-2012 Oracle Corporation
080575042aba2197b425ebfd52061dea061a9aa1xy# This file is part of VirtualBox Open Source Edition (OSE), as
080575042aba2197b425ebfd52061dea061a9aa1xy# available from http://www.virtualbox.org. This file is free software;
080575042aba2197b425ebfd52061dea061a9aa1xy# you can redistribute it and/or modify it under the terms of the GNU
080575042aba2197b425ebfd52061dea061a9aa1xy# General Public License as published by the Free Software Foundation,
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
080575042aba2197b425ebfd52061dea061a9aa1xy# distribution. VirtualBox OSE is distributed in the hope that it will
080575042aba2197b425ebfd52061dea061a9aa1xy# be useful, but WITHOUT ANY WARRANTY of any kind.
080575042aba2197b425ebfd52061dea061a9aa1xy# possible overrides:
080575042aba2197b425ebfd52061dea061a9aa1xy# OSE=1 force VBOX_OSE
080575042aba2197b425ebfd52061dea061a9aa1xy# NOPARALLEL=1 compile with -j1
080575042aba2197b425ebfd52061dea061a9aa1xy# LINUX=<dir> compile vboxdrv against Linux found in <dir>
080575042aba2197b425ebfd52061dea061a9aa1xy# VERBOSE=1 verbose build
080575042aba2197b425ebfd52061dea061a9aa1xy# DEBUG=1 debug build
080575042aba2197b425ebfd52061dea061a9aa1xy# NOSUBVER=1 disable generation of the sub-version field (which is
080575042aba2197b425ebfd52061dea061a9aa1xy# either the subversion rev [if available] or the build date)
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
080575042aba2197b425ebfd52061dea061a9aa1xy# NOMODS=1 don't build any module
080575042aba2197b425ebfd52061dea061a9aa1xy# NOQT=1 don't build the Qt GUI
5c68564d80b7e4acff16ce069e5e3d412d73ce69Bryan Cantrill# EFI=1 include the EFI binary from prebuild
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
5c68564d80b7e4acff16ce069e5e3d412d73ce69Bryan Cantrill# HEADLESS=1 build the headless version
5c68564d80b7e4acff16ce069e5e3d412d73ce69Bryan Cantrill# VNC=1 build VNC code
080575042aba2197b425ebfd52061dea061a9aa1xy# NOWEBSVC=1 don't build the webservice API, default for OSE
080575042aba2197b425ebfd52061dea061a9aa1xy# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
080575042aba2197b425ebfd52061dea061a9aa1xy# PKGDIR=<path> where to store the final package(s)
080575042aba2197b425ebfd52061dea061a9aa1xy# BLEEDING_EDGE=xyz
080575042aba2197b425ebfd52061dea061a9aa1xy# don't allow to check for kernel syms, otherwise we depend on specific kernel versions!
080575042aba2197b425ebfd52061dea061a9aa1xy$(error /usr/lib/rpm/find-requires.ksyms must not be installed)
080575042aba2197b425ebfd52061dea061a9aa1xy# same for openSUSE
080575042aba2197b425ebfd52061dea061a9aa1xy$(error /usr/lib/rpm/find-supplements.ksyms must not be installed)
080575042aba2197b425ebfd52061dea061a9aa1xyifeq ($(shell if grep -q '^/usr/lib/virtualbox' /etc/permissions* 2>/dev/null; then echo yes; fi),yes)
25f2d433de915875c8393f0b0dc14aa155997ad0xy# make sure openSUSE permissions fixes don't interfere with us
25f2d433de915875c8393f0b0dc14aa155997ad0xyifeq ($(shell if grep -q '^%disttag' /usr/lib/rpm/macros.d/mandriva 2>/dev/null; then echo yes; fi),yes)
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China$(error Fix /usr/lib/rpm/macros.d/mandriva)
25f2d433de915875c8393f0b0dc14aa155997ad0xypkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
080575042aba2197b425ebfd52061dea061a9aa1xyrpmlib := $(shell if [ `uname -m` = "x86_64" ]; then echo "lib64"; else echo "lib"; fi)
25f2d433de915875c8393f0b0dc14aa155997ad0xyarch := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "i386"; fi)
25f2d433de915875c8393f0b0dc14aa155997ad0xyose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
080575042aba2197b425ebfd52061dea061a9aa1xy # look for fedora
080575042aba2197b425ebfd52061dea061a9aa1xy rpmrel := $(shell cat /etc/fedora-release | sed -e 's/^Fedora *release *\([1-9][0-9]*\) .*/fedora\1/')
25f2d433de915875c8393f0b0dc14aa155997ad0xy $(error failed to detect the release type. Add /etc/distname or hack the detection.)
080575042aba2197b425ebfd52061dea061a9aa1xy rpmdist := $(strip $(shell grep $(rpmrel) $(current)/distributions_rpm | cut -d'=' -f2))
25f2d433de915875c8393f0b0dc14aa155997ad0xy $(error Cannot detect package distribution (rpmrel=$(rpmrel)))
080575042aba2197b425ebfd52061dea061a9aa1xy ifeq ($(filter-out rhel4 rhel5 rhel6 ol4 ol5 ol6 centos4 centos5 centos6 fedora9 fedora11 fedora12 fedora13 fedora14 fedora15 fedora16 turbolinux11,$(rpmrel)),)
080575042aba2197b425ebfd52061dea061a9aa1xy ifeq ($(filter-out openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114 sles10.1 sles11.0,$(rpmrel)),)
080575042aba2197b425ebfd52061dea061a9aa1xy ifeq ($(filter-out mdv2009.1 mdv2010.0 mdv2011.0,$(rpmrel)),)
080575042aba2197b425ebfd52061dea061a9aa1xy $(error failed to detect the .spec file (rpmrel=$(rpmrel)))
080575042aba2197b425ebfd52061dea061a9aa1xyrpmver :=$(ver)$(if $(NOSUBVER),,$(if $(svn_revision),_$(svn_revision),)$(VERSUFFIX)$(if $(HEADLESS),_headless,)$(if $(DEBUG),_dbg,))$(if $(BLEEDING_EDGE),_$(BLEEDING_EDGE),)
080575042aba2197b425ebfd52061dea061a9aa1xy# Fedora13/14 is bleeding edge, the other jails have outdated kernel headers
080575042aba2197b425ebfd52061dea061a9aa1xyinstmod := $(if $(filter rhel4 rhel5 rhel6 ol4 ol5 ol6 centos4 centos5 centos6 sles10.1 sles11.0 fedora13 fedora14 fedora15 fedora16,$(rpmrel)),,install_rpm)
080575042aba2197b425ebfd52061dea061a9aa1xy $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
080575042aba2197b425ebfd52061dea061a9aa1xy # Mandriva 2007.1, Redhat
080575042aba2197b425ebfd52061dea061a9aa1xy doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(rpmname)\""
080575042aba2197b425ebfd52061dea061a9aa1xy # Mandriva 2008.0
080575042aba2197b425ebfd52061dea061a9aa1xy doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China # Novell (OpenSUSE, SLES)
9b6541b318d01d0d83bfb98699a7f09e35f37951gl doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/packages/$(verpkg)\""
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter rhel4 sles10.1,$(rpmrel)),--build-libxml2,) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5 sles10.1,$(rpmrel)),--build-libcurl,) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter rhel5 centos5 sles10.1,$(rpmrel)),--disable-sdl-ttf,) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter sles10.1 turbolinux11,$(rpmrel)),--disable-pulse,) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5,$(rpmrel)),--enable-pulse,) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5 sles10.1 turbolinux11,$(rpmrel)),--with-qt4-dir=/home/vbox/Qt-4.7.4-stdc++6-$(arch)) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
25f2d433de915875c8393f0b0dc14aa155997ad0xy $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(filter rhel4 rhel5 ol4 ol5 centos4 centos5 fedora9 fedora10 sles10.1 turbolinux11,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
080575042aba2197b425ebfd52061dea061a9aa1xy cd $(vboxroot) && ./configure --odir=$(current)/rpm $(cfg_flags)
080575042aba2197b425ebfd52061dea061a9aa1xy . rpm/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
080575042aba2197b425ebfd52061dea061a9aa1xy $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
43a176879122f7764767ab85eb539f89d65cdd67Miles Xu, Sun Microsystems $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
43a176879122f7764767ab85eb539f89d65cdd67Miles Xu, Sun Microsystems $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
1b5c080f977843b2475f9119eb6f652a4230f9ddchangqing li - Sun Microsystems - Beijing China $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
c7770590c6dc06be2588a5c21427e2d823baa989mx $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
43a176879122f7764767ab85eb539f89d65cdd67Miles Xu, Sun Microsystems VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
25f2d433de915875c8393f0b0dc14aa155997ad0xy VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
080575042aba2197b425ebfd52061dea061a9aa1xy VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
c7770590c6dc06be2588a5c21427e2d823baa989mx VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China rm -f rpm/VirtualBox.spec
4d7379630d53d9992780329b674af8c85935e858xiangtao you - Sun Microsystems - Beijing China rm -f rpm/build-stamp rpm/configure-stamp rpm/configure.log
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%VER%|$(ver)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%NAME%|$(verpkg)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%BUILDVER%|$(rpmver)|g' \
25f2d433de915875c8393f0b0dc14aa155997ad0xy -e 's|%BUILDREL%|$(rpmrel)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%BUILDROOT%|$(current)/rpm/buildroot|g' \
25f2d433de915875c8393f0b0dc14aa155997ad0xy -e 's|%LIB%|$(rpmlib)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%SPEC%|$(rpmspec)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%MACROSPYTHON%|$(if $(wildcard /usr/lib/rpm/macros.python),%include /usr/lib/rpm/macros.python,)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%INSTMOD%|$(instmod)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%LIBASOUND%|$(if $(filter lib64,$(rpmlib)),libasound.so.2()(64bit),libasound.so.2)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%INITSCRIPTS%|$(if $(filter fedora,$(rpmspec)),initscripts,)|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e '/#include installer-common.sh/ {' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e "r $(vboxroot)/src/VBox/Installer/linux/installer-common.sh" \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%NOLSB%|yes|g' \
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng -e 's|%DEBIAN%||g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%PACKAGE%|virtualbox|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
47b7744cbea59975a6b583125b7ed1ff2ac45313yy -e 's|%NOLSB%|yes|g' \
47b7744cbea59975a6b583125b7ed1ff2ac45313yy -e 's|%DEBIAN%||g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%PACKAGE%|virtualbox|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy vboxballoonctrl-service.sh.in > $(archdir)/vboxballoonctrl-service.init
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%NOLSB%|yes|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%DEBIAN%||g' \
080575042aba2197b425ebfd52061dea061a9aa1xy -e 's|%PACKAGE%|virtualbox|g' \
080575042aba2197b425ebfd52061dea061a9aa1xy mv /usr/src/packages/RPMS/*/$(verpkg)-debug* $(pkgdir) || true
1b5c080f977843b2475f9119eb6f652a4230f9ddchangqing li - Sun Microsystems - Beijing China file=`find /usr/src/packages/RPMS -name $(verpkg)*rpm -print`; \
080575042aba2197b425ebfd52061dea061a9aa1xy# Note! if rpmbuild fails: sudo chmod a+rw /usr/src/redhat/* /usr/src/redhat/RPMS/*