VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/rpm/rules@ 72921

Last change on this file since 72921 was 72921, checked in by vboxsync, 7 years ago

rpm/rules: remove various outdated conditions.
bugref:9200: Infrastructure/Linux: need an openSUSE 15 chroot
This patch removes the following tests from our RPM build rules:

  • Refuse to build if certain /usr/lib/rpm/*.ksyms files are found.

No longer needed as we no longer provide kernel modules in our packages, so
we will no longer accidentally pull in dependencies on all installed kernels.

  • Refuse to build unless the SUSE permissions changes on VirtualBox binaries

have been removes.
Never needed. The changes are made at installation time, not at build time,
so changing them on the build system as we have been doing is not helpful.

  • Refuse to build on Mandriva systems without a particular fix applied.

We no longer support building on Mandriva at all. If we ever do support it
then please let us build on clean systems and not require this sort of
change.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 10.3 KB
Line 
1#!/usr/bin/make -f
2# $Id: rules 72921 2018-07-05 15:17:46Z vboxsync $
3## @file
4# VirtualBox rules.
5#
6
7#
8# Copyright (C) 2006-2017 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19# possible overrides:
20# OSE=1 force VBOX_OSE
21# NOPARALLEL=1 compile with -j1
22# LINUX=<dir> compile vboxdrv against Linux found in <dir>
23# VERBOSE=1 verbose build
24# DEBUG=1 debug build
25# NOSUBVER=1 disable generation of the sub-version field (which is
26# either the subversion rev [if available] or the build date)
27# NODOCS=1 don't build docs, use precompiled UserManual.pdf and
28# VirtualBox.chm from $(vboxroot)/prebuild
29# NOMODS=1 don't build any module
30# NOQT=1 don't build the Qt GUI
31# NOSDL=1 don't build VBoxSDL
32# EFI=1 include the EFI binary from prebuild
33# VERSUFFIX=<suffix> set a particular package version suffix (e.g. _customer)
34# HEADLESS=1 build the headless version
35# VNC=1 build VNC code
36# NOWEBSVC=1 don't build the webservice API, default for OSE
37# STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
38# PKGDIR=<path> where to store the final package(s)
39# svn_revision=xxx do not depend on subversion being available, but use this
40# hard-coded revision number instead
41#
42# NODOCS will also be set if UserManual*.pdf and VirtualBox*.chm are placed in
43# $(vboxroot)/prebuild. STAGEDISO will be set if VBoxGuestAdditions.iso is
44# placed there. Wine will not be required to be available if both NODOCS and
45# STAGEDISO are set.
46
47ifeq ($(wildcard rpm/rules),)
48$(error call rpm/rules from src/VBox/Installer/linux)
49endif
50
51verpkg := VirtualBox-5.2
52current := $(shell pwd)
53vboxroot := $(shell while ! test -r configure && ! test "$PWD" = "/"; do cd ..; done; pwd)
54pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd $(vboxroot)/..; pwd))
55builddir := $(vboxroot)/rpm/builddir
56rpmlib := $(shell if [ `uname -m` = "x86_64" ]; then echo "lib64"; else echo "lib"; fi)
57chrarch := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "x86"; fi)
58verfile := $(builddir)/version-generated.mk
59ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
60-include $(vboxroot)/SVN_REVISION
61svnrev :=$(if $(svn_revision),$(svn_revision),)
62
63NOMODS ?= $(ose)
64NOQT ?= $(HEADLESS)
65NOWEBSVC ?= $(ose)
66NODOCS ?= $(if $(wildcard $(vboxroot)/prebuild/UserManual*.pdf),$(if $(wildcard $(vboxroot)/prebuild/VirtualBox*.chm),1,),)
67STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
68NOWINE := $(if $(NODOCS),$(if $(STAGEDISO),1,),)$(ose)
69
70ifneq ($(MAKECMDGOALS),clean)
71 rpmrel := $(subst ol,el,$(subst rhel,el,$(subst centos,el,$(shell cat /etc/distname))))
72 ifeq ($(rpmrel),)
73 # look for fedora
74 rpmrel := $(shell cat /etc/fedora-release 2> /dev/null | sed -e 's/^Fedora *release *\([1-9][0-9]*\) .*/fedora\1/')
75 endif
76 ifeq ($(rpmrel),)
77 # look for OL
78 rpmrel := $(shell cat /etc/enterprise-release 2> /dev/null | sed -ne 's/^Enterprise Linux[a-zA-Z ]*\([1-9][0-9]*\).*/el\1/p')
79 endif
80 ifeq ($(rpmrel),)
81 # look for CentOS
82 rpmrel := $(shell cat /etc/redhat-release 2> /dev/null | sed -ne 's/^CentOS[a-zA-Z ]*\([1-9][0-9]*\).*/el\1/p')
83 endif
84 ifeq ($(rpmrel),)
85 # look for Red Hat
86 rpmrel := $(shell cat /etc/redhat-release 2> /dev/null | sed -ne 's/^Red Hat[a-zA-Z ]*\([1-9][0-9]*\).*/el\1/p')
87 endif
88 ifeq ($(rpmrel),)
89 # look for openSUSE
90 rpmrel := $(shell cat /etc/SUSE-brand 2> /dev/null | sed -ne 's/^VERSION *= *\([0-9]*\)\.\([0-9]*\)/openSUSE\1\2/p')
91 endif
92 ifeq ($(rpmrel),)
93 $(error failed to detect the release type. Add /etc/distname or hack the detection.)
94 endif
95
96 rpmdist := $(strip $(shell grep $(rpmrel) $(current)/distributions_rpm | cut -d'=' -f2))
97 ifeq ($(rpmdist),)
98 $(error Cannot detect package distribution (rpmrel=$(rpmrel)))
99 endif
100
101 ifeq ($(filter-out el5 el6 el7 fedora18 fedora19 fedora20 fedora21 fedora22 fedora24 fedora25 fedora26,$(rpmrel)),)
102 rpmspec := rpm_redhat
103 endif
104 ifeq ($(filter-out openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114 openSUSE123 openSUSE131 openSUSE132 openSUSE150,$(rpmrel)),)
105 rpmspec := rpm_suse
106 endif
107 ifeq ($(rpmspec),)
108 $(error failed to detect the .spec file (rpmrel=$(rpmrel)))
109 endif
110
111 # contrary to debian we need the verfile earlier to get the correct rpmname into the bld_flags
112 include $(verfile)
113$(verfile): rpm/configure-stamp
114 . rpm/env.sh && kmk -C $(vboxroot) $(verfile) $(bld_flags)
115
116endif
117
118ver := $(VBOX_VERSION_STRING)
119rpmver :=$(ver)$(if $(NOSUBVER),,$(if $(svn_revision),_$(svn_revision),)$(VERSUFFIX)$(if $(HEADLESS),_headless,)$(if $(DEBUG),_dbg,))
120archdir := $(current)/rpm/VirtualBox-$(ver)
121rpmname := $(verpkg)-$(rpmver)_$(rpmrel)
122
123# never ship any modules
124instmod :=
125
126ifneq ($(STAGEDISO),)
127 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
128 $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
129 endif
130endif
131
132ifeq ($(wildcard /usr/share/doc/packages/bash),)
133 doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\""
134else
135 # Novell (OpenSUSE, SLES)
136 doc_dir := VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/packages/$(verpkg)\""
137endif
138
139# EL5 ships Python 2.4 while our Python support requires Python 2.6 or later
140cfg_flags := $(if $(NOQT),--disable-qt,) \
141 $(if $(NOSDL),--disable-vboxsdl,) \
142 $(if $(filter el5 el6,$(rpmrel)),--build-libvpx,) \
143 $(if $(filter el5,$(rpmrel)),--build-libcurl,) \
144 $(if $(filter el5,$(rpmrel)),--disable-sdl-ttf,) \
145 $(if $(filter el5,$(rpmrel)),--disable-pulse,) \
146 $(if $(filter el5,$(rpmrel)),--disable-python,) \
147 $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
148 $(if $(HEADLESS),--build-headless,) \
149 $(if $(DEBUG),--build-debug,) \
150 $(if $(NOWINE),,--setup-wine) \
151 $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
152 $(if $(VNC),--enable-vnc,) \
153 --disable-extpack
154
155bld_flags := AUTOCFG=$(current)/rpm/AutoConfig.kmk \
156 LOCALCFG=$(current)/rpm/LocalConfig.kmk \
157 PATH_OUT=$(builddir) \
158 VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
159 VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
160 $(if $(filter el5 el6,$(rpmrel)),,VBOX_WITH_VMSVGA3D=1) \
161 VBOX_DO_STRIP= \
162 $(if $(filter el5,$(rpmrel)),VBOX_BLD_PYTHON=$(strip \
163 $(firstword $(wildcard /usr/local/bin/python2.7) \
164 $(wildcard /usr/bin/python2.6) $(wildcard /usr/bin/python))),) \
165 $(doc_dir) \
166 $(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
167 VBOX_PACKAGE_DIST=$(rpmdist) \
168 $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
169 $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
170 $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
171 $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
172 $(if $(filter el5,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
173
174rpm/configure-stamp:
175 cd $(vboxroot) && ./configure --odir=$(current)/rpm $(cfg_flags)
176 touch rpm/configure-stamp
177
178rpm/build-stamp: rpm/configure-stamp
179 . rpm/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
180 $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
181 $(if $(NODOCS),cp $(vboxroot)/prebuild/VirtualBox*.chm $(builddir)/bin,)
182 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
183 $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
184 mkdir -p $(builddir)/bin/additions
185 $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
186 . rpm/env.sh && kmk -C $(vboxroot) $(bld_flags) \
187 VBOX_NO_LINUX_RUN_INSTALLER=1 \
188 VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
189 VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
190 VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
191 VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
192 packing
193 touch rpm/build-stamp
194
195clean:
196 rm -rf $(archdir)
197 rm -rf $(builddir) rpm/VirtualBox-*
198 rm -f rpm/VirtualBox.tar
199 rm -f rpm/VirtualBox.tar.bz2
200 rm -f rpm/VirtualBox.spec
201 rm -f rpm/build-stamp rpm/configure-stamp rpm/configure.log
202 rm -f rpm/AutoConfig.kmk rpm/env.sh
203
204ifeq ($(VBOX_VERSION_MAJOR),)
205binary: rpm/build-stamp $(verfile)
206 $(MAKE) -f rpm/rules binary
207else
208binary: rpm/build-stamp
209 rm -rf rpm/VirtualBox-*
210 tar -xf $(builddir)/bin/VirtualBox.tar -C rpm
211 sed \
212 -e 's|%VER%|$(ver)|g' \
213 -e 's|%NAME%|$(verpkg)|g' \
214 -e 's|%BUILDVER%|$(rpmver)|g' \
215 -e 's|%BUILDREL%|$(rpmrel)|g' \
216 -e 's|%BUILDROOT%|$(current)/rpm/buildroot|g' \
217 -e 's|%LIB%|$(rpmlib)|g' \
218 -e 's|%OSE%|$(if $(ose),is_ose,not_ose)|g' \
219 -e 's|%SPEC%|$(rpmspec)|g' \
220 -e 's|%PYTHON%|$(if $(filter el5,$(rpmrel)),,with_python)|g' \
221 -e 's|%MACROSPYTHON%|$(if $(wildcard /usr/lib/rpm/macros.python),%include /usr/lib/rpm/macros.python,)|g' \
222 -e 's|%INSTMOD%|$(instmod)|g' \
223 -e 's|%LIBASOUND%|$(if $(filter lib64,$(rpmlib)),libasound.so.2()(64bit),libasound.so.2)|g' \
224 -e 's|%INITSCRIPTS%|$(if $(filter fedora,$(rpmspec)),initscripts,)|g' \
225 -e 's|%WEBSVC%|$(if $(NOWEBSVC),false,true)|g' \
226 -e 's|%NETTOOLS%|$(if $(filter fedora18 fedora19 fedora20 fedora21 el5 openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114,$(rpmrel)),net-tools,iproute)|g' \
227 rpm/VirtualBox.tmpl.spec > $(archdir)/VirtualBox.spec
228 mv rpm/VirtualBox-$(ver) rpm/$(rpmname)
229 cp ../../../../tools/linux.$(chrarch)/bin/chrpath rpm/$(rpmname) || true
230 tar -cf rpm/VirtualBox.tar -C rpm $(rpmname)
231 rm -f rpmbuild/RPMS/*/VirtualBox*rpm
232 rm -f rpmbuild/SPECS/*
233 mkdir -p rpmbuild/BUILD rpmbuild/RPMS/i386 rpmbuild/RPMS/x86_64 rpmbuild/SOURCES rpmbuild/SPECS rpmbuild/SRPMS
234 (cd rpm; rpmbuild --define '_topdir $(current)/rpmbuild' -tb --clean VirtualBox.tar)
235 mv rpmbuild/RPMS/*/$(verpkg)-debug* $(pkgdir) || true
236 file=`find rpmbuild/RPMS -name $(verpkg)*rpm -print`; \
237 mv $$file $(pkgdir)
238# Note! if rpmbuild fails: sudo chmod a+rw /usr/src/redhat/* /usr/src/redhat/RPMS/*
239# Note! if find/mv fails: sudo ln -s redhat/ /usr/src/packages
240endif
241
242.PHONY: binary clean
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette