VirtualBox

Changeset 90354 in vbox for trunk/src


Ignore:
Timestamp:
Jul 27, 2021 11:57:54 AM (4 years ago)
Author:
vboxsync
Message:

configure, debian/rules, rpm/rules: Many bug fixes. Clean up the debian building to use purely the out directory (which needs relocating its files to the out directory, too, because the debhelper utilities can't deal with a separate temp directory structure). This un-breaks the debian package building which was caused by the incomplete previous change.

Location:
trunk/src/VBox/Installer/linux
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/debian

    • Property svn:ignore deleted
  • trunk/src/VBox/Installer/linux/debian/compat

    r32008 r90354  
    1 5
     19
  • trunk/src/VBox/Installer/linux/debian/rules

    r90118 r90354  
    2323
    2424#export DH_VERBOSE=1
    25 export DH_COMPAT=5
    2625
    2726# possible overrides:
     
    3332#  NOSUBVER=1       disable generation of the sub-version field (which is
    3433#                   either the subversion rev [if available] or the build date)
    35 #  NODOCS=1         don't build docs, use precompiled UserManual.pdf and
    36 #                   maybe VirtualBox.qch and VirtualBox.qhc from $(vboxroot)/prebuild
     34#  NODOCS=1         don't build docs, use precompiled UserManual*.pdf and
     35#                   maybe UserManual*.qch and UserManual*.qhc from $(vboxroot)/prebuild
    3736#  NOMODS=1         don't build any module
    3837#  NOQT=1           don't build the Qt GUI
     
    4241#  HEADLESS=1       build the headless version
    4342#  VNC=1            build VNC code
    44 #  NOWEBSVC=1       don't build the webservice API, default for OSE
     43#  NOWEBSVC=1       don't build the webservice API
    4544#  STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
    46 #  STAGEDQHELP=<path> use VirtualBox*.qch and VirtualBox*.qhc from this directory
    4745#  PKGDIR=<path>    where to store the final package(s)
    48 #
    49 # NODOCS will be set if UserManual*.pdf is placed in $(vboxroot)/prebuild.
     46#  svn_revision=xxx do not depend on subversion being available, but use this
     47#                   hard-coded revision number instead
     48#
     49# NODOCS will be set if UserManual*.pdf, UserManual*.qch and UserManual*.qhc are
     50# placed in $(vboxroot)/prebuild.
    5051# STAGEDISO will be set if VBoxGuestAdditions.iso is placed there.
    51 # STAGEDQHELP will be set if VirtualBox*.qch and VirtualBox*.qhc is placed there.
    52 # VirtualBox*.qch and VirtualBox*.qhc are used if they are provided, but never
    53 # attempted to be built.
    54 #
    55 # Wine will not be required if either NODOCS or STAGEDISO are set.
     52#
     53# Wine will not be required if STAGEDISO is set.
    5654
    5755package  := virtualbox
    5856verpkg   := virtualbox-6.1
    59 current  := $(shell pwd)
    60 vboxroot := $(shell while ! test -r configure && ! test "$PWD" = "/"; do cd ..; done; pwd)
     57vboxroot := $(shell while ! test -r configure && ! test "$$PWD" = "/"; do cd ..; done; pwd)
     58debroot  := $(vboxroot)/src/VBox/Installer/linux
     59instlin  := $(vboxroot)/src/VBox/Installer/linux
    6160pkgdir   := $(if $(PKGDIR),$(PKGDIR),$(shell cd $(vboxroot)/..; pwd))
    62 bldbase  := $(if $(PATH_OUT_BASE),$(PATH_OUT_BASE),$(vboxroot))/out/debian
     61outdir   := $(if $(PATH_OUT_BASE),$(PATH_OUT_BASE),$(vboxroot))/out
     62bldbase  := $(outdir)/debian
    6363builddir := $(bldbase)/builddir
    6464moddir   := $(bldbase)/modules
    65 prefix   := $(current)/debian/$(verpkg)
     65prefix   := $(bldbase)/$(verpkg)
    6666arch     := $(shell dpkg --print-architecture)
    6767verfile  := $(builddir)/version-generated.mk
     
    6969chrarch  := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "x86"; fi)
    7070-include $(vboxroot)/SVN_REVISION
    71 svnrev   :=$(if $(svn_revision),$(svn_revision),)
     71svnrev   := $(if $(svn_revision),$(svn_revision),)
    7272
    7373NOMODS   ?= $(ose)
    7474NOQT     ?= $(HEADLESS)
    7575NOSDL    ?= $(HEADLESS)
    76 NOWEBSVC ?= $(ose)
    77 NODOCS   ?= $(if $(wildcard $(vboxroot)/prebuild/UserManual*.pdf),1,)
     76NOWEBSVC ?=
     77EFI      ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxEFI32.fd $(vboxroot)/prebuild/VBoxEFI64.fd),1,)
     78NODOCS   ?= $(if $(wildcard $(addprefix $(vboxroot)/prebuild/,UserManual*.pdf UserManual*.qch UserManual.qhc)),1,)
    7879STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
    79 STAGEDQHELP ?= $(if $(and $(wildcard $(vboxroot)/prebuild/VirtualBox*.qch),$(wildcard $(vboxroot)/prebuild/VirtualBox*.qhc)),$(vboxroot)/prebuild,)
    80 NOWINE   := $(if $(NODOCS),1,$(if $(STAGEDISO),1,$(ose)))
    81 PYTHON   := $(firstword $(shell which python) $(shell which python3))
    82 
    83 ifneq ($(wildcard $(verfile)),)
    84 include $(verfile)
    85 ver      := $(VBOX_VERSION_STRING)
    86 svnver   := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
    87                 svn info > /dev/null 2>&1; then \
    88                 svn info|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
    89                 date +"-%Y%m%d"; fi)))
    90 debver   :=$(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _RC,~rc,$(subst _OSE,~ose,$(ver)))))$(svnver)$(VERSUFFIX)$(if $(HEADLESS),~headless,)$(if $(DEBUG),~dbg,)
    91 archdir  := $(prefix)/opt/VirtualBox-$(ver)
    92 endif
     80NOWINE   := $(if $(STAGEDISO),1,$(ose))
     81PYTHON   := $(firstword $(shell which python3) $(shell which python))
     82
     83DEBPKGFILES := changelog compat control dirs postinst postrm preinst prerm rules templates
    9384
    9485ifneq ($(STAGEDISO),)
     
    9889endif
    9990
    100 debrel  := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
     91# Replicate debian package buildfiles to $(bldbase)
     92ifneq ($(shell pwd),$(outdir))
     93cmd := $(filter-out all Makefile,$(MAKECMDGOALS))
     94all:
     95        mkdir -p $(bldbase)
     96        ln -sf $(addprefix $(debroot)/debian/,$(DEBPKGFILES)) $(bldbase)
     97        +$(MAKE) -C $(outdir) -f debian/rules $(cmd)
     98
     99Makefile:
     100
     101$(cmd): all
     102
     103.PHONY: all $(MAKECMDGOALS)
     104
     105else
     106 ifneq ($(wildcard $(verfile)),)
     107include $(verfile)
     108ver      := $(VBOX_VERSION_STRING)
     109svnver   := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
     110                svn info $(vboxroot) > /dev/null 2>&1; then \
     111                svn info $(vboxroot)|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
     112                date +"-%Y%m%d"; fi)))
     113debver   := $(subst _ALPHA,~alpha,$(subst _BETA,~beta,$(subst _RC,~rc,$(subst _OSE,~ose,$(ver)))))$(svnver)$(VERSUFFIX)$(if $(HEADLESS),~headless,)$(if $(DEBUG),~dbg,)
     114archdir  := $(prefix)/opt/VirtualBox-$(ver)
     115 endif
     116
    101117
    102118ifneq ($(MAKECMDGOALS),clean)
    103  debdist  := $(strip $(shell grep $(debrel) $(current)/distributions_deb | cut -d'=' -f2))
     119 debrel  := $(if $(shell which lsb_release),_$(shell lsb_release -si)_$(shell lsb_release -sc),unknown)
     120 debdist  := $(strip $(shell grep $(debrel) $(debroot)/distributions_deb | cut -d'=' -f2))
    104121 ifeq ($(debdist),)
    105122  debdist := $(if $(shell which lsb_release),_$(shell lsb_release -si | tr a-z A-Z)_$(shell lsb_release -sr | sed -e 's/\./_/g' -e 's/\([^_]*\)\(_[^_]*\).*/\1\2/'),unknown)
     
    109126
    110127cfg_flags := $(if $(NOQT),--disable-qt,) \
    111              $(if $(NOSDL),--disable-vboxsdl,) \
    112              $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
    113              $(if $(HEADLESS),--build-headless,) \
    114              $(if $(DEBUG),--build-debug,) \
    115              $(if $(NOWINE),,--setup-wine) \
    116              $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
    117              $(if $(VNC),--enable-vnc,) \
    118              $(if $(PATH_OUT_BASE),--out-base-dir=$(PATH_OUT_BASE),) \
    119              --disable-extpack
    120 
    121 bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
    122              LOCALCFG=$(current)/debian/LocalConfig.kmk \
    123              PATH_OUT=$(builddir) \
    124              VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
    125              VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
    126              VBOX_WITH_VMSVGA3D=1 \
    127              VBOX_DO_STRIP= \
    128              VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
    129              $(if $(STAGEDQHELP),VBOX_WITH_DOCS_QHELP=1,) \
    130              VBOX_PACKAGE_DIST=$(debdist) \
    131              $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
    132              $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
    133              $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
    134              $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
    135 
    136 configure: debian/configure-stamp
    137 debian/configure-stamp:
     128    $(if $(NOSDL),--disable-vboxsdl,) \
     129    $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
     130    $(if $(HEADLESS),--build-headless,) \
     131    $(if $(DEBUG),--build-debug,) \
     132    $(if $(NOWINE),,--setup-wine) \
     133    $(if $(VNC),--enable-vnc,) \
     134    $(if $(PATH_OUT_BASE),--out-base-dir=$(PATH_OUT_BASE),) \
     135    --disable-extpack
     136
     137bld_flags := AUTOCFG=$(bldbase)/AutoConfig.kmk \
     138    LOCALCFG=$(debroot)/debian/LocalConfig.kmk \
     139    PATH_OUT=$(builddir) \
     140    VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
     141    VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
     142    VBOX_WITH_VMSVGA3D=1 \
     143    VBOX_DO_STRIP= \
     144    VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
     145    VBOX_PACKAGE_DIST=$(debdist) \
     146    $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
     147    $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
     148    $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
     149    $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
     150
     151configure: $(bldbase)/configure-stamp
     152$(bldbase)/configure-stamp:
    138153        dh_testdir
     154        mkdir -p $(bldbase)
    139155        cd $(vboxroot) && ./configure --odir=$(bldbase) $(cfg_flags)
    140         touch debian/configure-stamp
    141 
    142 build: debian/configure-stamp debian/build-stamp
    143 debian/build-stamp $(verfile):
     156        touch $@
     157
     158build: $(bldbase)/configure-stamp $(bldbase)/build-stamp
     159$(bldbase)/build-stamp $(verfile): $(bldbase)/configure-stamp
    144160        dh_testdir
    145         . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
    146         $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
    147         $(if $(STAGEDQHELP),cp $(STAGEDQHELP)/VirtualBox*.qch $(STAGEDQHELP)/VirtualBox*.qhc $(builddir)/bin,)
     161        . $(bldbase)/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
     162        # Files from prebuild go to (builddir)/bin to be used during the
     163        # packing stage, overriding what the build did/would produce.
     164        $(if $(NODOCS),cp $(addprefix $(vboxroot)/prebuild/,UserManual*.pdf UserManual*.qch UserManual.qhc) $(builddir)/bin,)
    148165        $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
    149166        $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
    150167        mkdir -p $(builddir)/bin/additions
    151168        $(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
    152         . debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
     169        . $(bldbase)/env.sh && kmk -C $(vboxroot) $(bld_flags) \
    153170            VBOX_NO_LINUX_RUN_INSTALLER=1 \
    154171            VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
     
    157174            VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
    158175            packing
    159         touch debian/build-stamp
     176        touch $(bldbase)/build-stamp
    160177
    161178# Build modules for every kernel we find in /lib/modules/*
    162 modules: debian/build-stamp debian/modules-stamp
    163 debian/modules-stamp: debian/build-stamp
     179$(bldbase)/modules-stamp: $(bldbase)/build-stamp
    164180        rm -rf $(moddir)
    165181        mkdir $(moddir)
     
    180196            fi; \
    181197        done
    182         touch debian/modules-stamp
     198        touch $@
    183199
    184200clean:
    185201        dh_testdir
    186202        dh_testroot
    187         rm -f debian/changelog
    188         rm -f debian/AutoConfig.kmk debian/configure.log debian/env.sh
    189         rm -f debian/modules-stamp debian/build-stamp debian/configure-stamp
    190         rm -f debian/virtualbox-*.substvars debian/virtualbox*.debhelper
    191         rm -f debian/$(verpkg).mime
    192         rm -rf $(builddir) $(moddir)
    193         rm -rf debian/wine.*
    194203        dh_clean
    195 
    196 ifeq ($(VBOX_VERSION_MAJOR),)
    197 binary binary-arch binary-indep: build $(verfile)
    198         $(MAKE) -f debian/rules binary
    199 else
     204        rm -rf $(archdir)
     205        rm -rf $(builddir)
     206        rm -rf $(moddir)
     207        rm -rf $(bldbase)/wine.*
     208        rm -rf $(bldbase)/VirtualBox-*
     209        rm -f $(bldbase)/VirtualBox.tar $(bldbase)/VirtualBox.tar.bz2
     210        rm -f $(bldbase)/virtualbox-*.substvars $(bldbase)/virtualbox*.debhelper
     211        rm -f $(bldbase)/$(verpkg).mime $(bldbase)/$(verpkg).sharedmimeinfo
     212        rm -f $(bldbase)/modules-stamp $(bldbase)/build-stamp $(bldbase)/configure-stamp
     213        rm -f $(bldbase)/AutoConfig.kmk $(bldbase)/configure.log $(bldbase)/env.sh
     214        rm -f $(addprefix $(bldbase)/,$(DEBPKGFILES))
     215        if [ -d $(bldbase) ]; then rmdir $(bldbase); fi
     216
     217 ifeq ($(VBOX_VERSION_MAJOR),)
     218binary: build $(verfile)
     219        +$(MAKE) -f debian/rules binary
     220
     221 else
    200222# Build architecture-dependent files here.
    201 binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
     223binary: build $(if $(NOMODS),,$(bldbase)/modules-stamp)
    202224        dh_testdir
    203225        dh_testroot
    204         dh_clean -k
     226        dh_prep
    205227        dh_installdirs
    206228        tar -xC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar
     
    231253        done)
    232254        $(if $(NOQT),,rmdir $(archdir)/icons)
    233         $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
     255        $(if $(NOQT),,mv $(archdir)/virtualbox.xml $(bldbase)/$(verpkg).sharedmimeinfo)
    234256        install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
    235257        sed \
    236258            -e 's|%VERPKG%|$(verpkg)|g' \
    237             debian/lintian-override.in > \
     259            $(vboxroot)/debian/lintian-override.in > \
    238260           $(prefix)/usr/share/lintian/overrides/$(verpkg)
    239261        mv $(archdir)/VBox.png \
     
    241263        mv $(archdir)/src  $(prefix)/usr/share/$(package)
    242264        rm $(archdir)/VBox.sh
    243         install -D -g 0 -o 0 -m 644 $(vboxroot)/src/VBox/Installer/linux/VBox.sh $(prefix)/usr/bin/VBox
     265        install -D -g 0 -o 0 -m 644 $(instlin)/VBox.sh $(prefix)/usr/bin/VBox
    244266        mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
    245267        if [ -r $(archdir)/VBoxDTrace ]; then \
     
    261283            fi \
    262284            done)
    263 ifeq ($(ose),)
    264         dh_installdocs \
    265             $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.qch VirtualBox*.qhc \
    266             LICENSE)
    267         rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.qch VirtualBox*.qhc \
    268             LICENSE)
    269         for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
    270             mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
     285        dh_installdocs $(addprefix $(archdir)/,UserManual*.pdf LICENSE)
     286        mv $(addprefix $(archdir)/,$(if $(HEADLESS),,rdesktop-vrdp.tar.gz) additions/VBoxGuestAdditions.iso) $(prefix)/usr/share/$(package)
    271287        $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
    272288        $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
    273 else
    274         dh_installdocs \
    275             $(archdir)/UserManual*.pdf
    276         rm $(addprefix $(archdir)/,UserManual*.pdf)
    277         for i in additions/VBoxGuestAdditions.iso; do \
    278             mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
    279 endif
    280289        mv $(archdir) $(prefix)/usr/lib/$(package)
    281290        if [ -f $(prefix)/usr/lib/$(package)/libQt5CoreVBox.so.5 ]; then \
     
    306315            $(if $(NOSDL),,usr/bin/VBox         usr/bin/VBoxSDL) \
    307316            $(if $(NOSDL),,usr/bin/VBox         usr/bin/vboxsdl) \
    308             $(if $(ose),,usr/bin/VBox           usr/bin/VBoxVRDP) \
    309317            usr/bin/VBox                        usr/bin/VBoxHeadless \
    310318            usr/bin/VBox                        usr/bin/vboxheadless \
     
    320328            usr/share/virtualbox/src/vboxhost   usr/src/vboxhost-$(ver)
    321329        $(if $(NOMODS),,dh_installmodules)
     330        rm -f $(bldbase)/changelog
    322331        sed -e 's|%VER%|$(debver)|g' \
    323332            -e 's|%DATE%|$(shell date -R)|g' \
    324333            -e 's|%DEBREL%|$(subst _,~,$(debrel))|g' \
    325334            -e 's|%VERPKG%|$(verpkg)|g' \
    326             debian/changelog.in > debian/changelog
     335            $(debroot)/debian/changelog.in > $(bldbase)/changelog
    327336        dh_installdebconf
    328337        dh_installchangelogs
     
    330339        dh_installmime
    331340        dh_link
    332 ifeq ($(DEBUG),)
     341  ifeq ($(DEBUG),)
    333342        dh_strip --keep-debug \
    334343            $(addprefix --exclude=lib,$(addsuffix VBox.so.5,\
    335               Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport Qt5OpenGL Qt5DBus Qt5XcbQpa Qt5X11Extras)) \
    336             --exclude=libqxcb.so --exclude=libqsqlite.so --exclude=libqxcb-glx-integration.so
    337 endif
    338         mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib/$(package)
    339         mv $(prefix)/usr/lib/$(package)/*.debug $(current)/debian/$(verpkg)-dbg/usr/lib/$(package)
    340 ifeq ($(DEBUG),)
    341         mv $(prefix)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
    342 endif
    343         $(firstword $(shell which dh_python2) $(shell which dh_python3))
    344         dh_compress -X.pdf -X LICENSE -X.py
     344              Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport Qt5OpenGL Qt5DBus Qt5XcbQpa Qt5X11Extras))
     345  endif
     346        mkdir -p $(bldbase)/$(verpkg)-dbg/usr/lib/$(package)
     347        mv $(prefix)/usr/lib/$(package)/*.debug $(bldbase)/$(verpkg)-dbg/usr/lib/$(package)
     348  ifeq ($(DEBUG),)
     349        mv $(prefix)/usr/lib/debug $(bldbase)/$(verpkg)-dbg/usr/lib
     350  endif
     351        $(firstword $(shell which dh_python3) $(shell which dh_python2))
     352        dh_compress -X.pdf -X.qch -X.qhc -X LICENSE -X.py
    345353        dh_fixperms
    346354        dh_makeshlibs
     
    355363        dh_md5sums
    356364        dh_builddeb --destdir $(pkgdir) -- -Zxz
     365 endif
     366
     367.PHONY: binary configure build clean
    357368endif
    358 
    359 .PHONY: binary modules binary-arch binary-indep clean checkroot
  • trunk/src/VBox/Installer/linux/rpm/rules

    r90118 r90354  
    2525#  NOSUBVER=1       disable generation of the sub-version field (which is
    2626#                   either the subversion rev [if available] or the build date)
    27 #  NODOCS=1         don't build docs, use precompiled UserManual.pdf and
    28 #                   maybe VirtualBox.qch and VirtualBox.qhc from $(vboxroot)/prebuild
     27#  NODOCS=1         don't build docs, use precompiled UserManual*.pdf and
     28#                   maybe UserManual*.qch and UserManual*.qhc from $(vboxroot)/prebuild
    2929#  NOMODS=1         don't build any module
    3030#  NOQT=1           don't build the Qt GUI
     
    3434#  HEADLESS=1       build the headless version
    3535#  VNC=1            build VNC code
    36 #  NOWEBSVC=1       don't build the webservice API, default for OSE
     36#  NOWEBSVC=1       don't build the webservice API
    3737#  STAGEDISO=<path> don't build the VBoxAdditions, use the precompiled .iso
    38 #  STAGEDQHELP=<path> use VirtualBox*.qch and VirtualBox*.qhc from this directory
    3938#  PKGDIR=<path>    where to store the final package(s)
    4039#  svn_revision=xxx do not depend on subversion being available, but use this
    4140#                   hard-coded revision number instead
    4241#
    43 # NODOCS will be set if UserManual*.pdf is placed in $(vboxroot)/prebuild.
     42# NODOCS will be set if UserManual*.pdf, UserManual*.qch and UserManual*.qhc are
     43# placed in $(vboxroot)/prebuild.
    4444# STAGEDISO will be set if VBoxGuestAdditions.iso is placed there.
    45 # STAGEDQHELP will be set if VirtualBox*.qch and VirtualBox*.qhc is placed there.
    46 # VirtualBox*.qch and VirtualBox*.qhc are used if they are provided, but never
    47 # attempted to be built.
    48 #
    49 # Wine will not be required if either NODOCS or STAGEDISO are set.
    50 
    51 ifeq ($(wildcard rpm/rules),)
    52 $(error call rpm/rules from src/VBox/Installer/linux)
    53 endif
     45#
     46# Wine will not be required if STAGEDISO is set.
    5447
    5548verpkg   := VirtualBox-6.1
    56 current  := $(shell pwd)
    57 vboxroot := $(shell while ! test -r configure && ! test "$PWD" = "/"; do cd ..; done; pwd)
     49vboxroot := $(shell while ! test -r configure && ! test "$$PWD" = "/"; do cd ..; done; pwd)
     50instlin  := $(vboxroot)/src/VBox/Installer/linux
    5851pkgdir   := $(if $(PKGDIR),$(PKGDIR),$(shell cd $(vboxroot)/..; pwd))
    59 bldbase  := $(if $(PATH_OUT_BASE),$(PATH_OUT_BASE),$(vboxroot))/out/rpm
     52outdir   := $(if $(PATH_OUT_BASE),$(PATH_OUT_BASE),$(vboxroot))/out
     53bldbase  := $(outdir)/rpm
    6054builddir := $(bldbase)/builddir
    6155stagedir := $(bldbase)/rpmbuild
    6256rpmlib   := $(shell if [ `uname -m` = "x86_64" ]; then echo "lib64"; else echo "lib"; fi)
    63 chrarch  := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "x86"; fi)
    6457verfile  := $(builddir)/version-generated.mk
    6558ose      := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
     59chrarch  := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "x86"; fi)
    6660-include $(vboxroot)/SVN_REVISION
    67 svnrev   :=$(if $(svn_revision),$(svn_revision),)
     61svnrev   := $(if $(svn_revision),$(svn_revision),)
    6862
    6963NOMODS   ?= $(ose)
    7064NOQT     ?= $(HEADLESS)
    71 NOWEBSVC ?= $(ose)
    72 NODOCS   ?= $(if $(wildcard $(vboxroot)/prebuild/UserManual*.pdf),1,)
     65NOSDL    ?= $(HEADLESS)
     66NOWEBSVC ?=
     67EFI      ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxEFI32.fd $(vboxroot)/prebuild/VBoxEFI64.fd),1,)
     68NODOCS   ?= $(if $(wildcard $(addprefix $(vboxroot)/prebuild/,UserManual*.pdf UserManual*.qch UserManual.qhc)),1,)
    7369STAGEDISO ?= $(if $(wildcard $(vboxroot)/prebuild/VBoxGuestAdditions.iso),$(vboxroot)/prebuild,)
    74 STAGEDQHELP ?= $(if $(and $(wildcard $(vboxroot)/prebuild/VirtualBox*.qch),$(wildcard $(vboxroot)/prebuild/VirtualBox*.qhc)),$(vboxroot)/prebuild,)
    75 NOWINE   := $(if $(NODOCS),1,$(if $(STAGEDISO),1,$(ose)))
     70NOWINE   := $(if $(STAGEDISO),1,$(ose))
     71
     72ifneq ($(STAGEDISO),)
     73 ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
     74  $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
     75 endif
     76endif
     77
     78ifeq ($(wildcard rpm/rules),)
     79$(error call rpm/rules from src/VBox/Installer/linux)
     80endif
    7681
    7782ifneq ($(MAKECMDGOALS),clean)
     
    106111 endif
    107112
    108  rpmdist := $(strip $(shell grep $(rpmrel) $(current)/distributions_rpm | cut -d'=' -f2))
     113 rpmdist := $(strip $(shell grep $(rpmrel) $(instlin)/distributions_rpm | cut -d'=' -f2))
    109114 ifeq ($(rpmdist),)
    110115  $(error Cannot detect package distribution (rpmrel=$(rpmrel)))
     
    120125  $(error failed to detect the .spec file (rpmrel=$(rpmrel)))
    121126 endif
    122 
    123  # contrary to debian we need the verfile earlier to get the correct rpmname into the bld_flags
    124  include $(verfile)
    125 $(verfile): $(bldbase)/configure-stamp
    126         . $(bldbase)/env.sh && kmk -C $(vboxroot) $(verfile) $(bld_flags)
    127 
    128 endif
    129 
     127endif
     128
     129ifneq ($(wildcard $(verfile)),)
     130include $(verfile)
    130131ver      := $(VBOX_VERSION_STRING)
    131 rpmver   :=$(ver)$(if $(NOSUBVER),,$(if $(svn_revision),_$(svn_revision),)$(VERSUFFIX)$(if $(HEADLESS),_headless,)$(if $(DEBUG),_dbg,))
     132svnver   := $(if $(NOSUBVER),,$(if $(svn_revision),-$(svn_revision),$(shell if \
     133                svn info $(vboxroot) > /dev/null 2>&1; then \
     134                svn info $(vboxroot)|sed -e "s/^Revision: \(.*\)/-\1/;t;d"; else \
     135                date +"-%Y%m%d"; fi)))
     136rpmver   := $(ver)$(subst -,_,$(svnver))$(VERSUFFIX)$(if $(HEADLESS),_headless,)$(if $(DEBUG),_dbg,)
    132137archdir  := $(bldbase)/VirtualBox-$(ver)
    133138rpmname  := $(verpkg)-$(rpmver)_$(rpmrel)
     139endif
    134140
    135141# never ship any modules
    136142instmod  :=
    137 
    138 ifneq ($(STAGEDISO),)
    139  ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
    140   $(error STAGEDISO='$(STAGEDISO)/VBoxGuestAdditions.iso' not found)
    141  endif
    142 endif
    143143
    144144ifeq ($(wildcard /usr/share/doc/packages/bash),)
     
    157157# EL5 ships Python 2.4 while our Python support requires Python 2.6 or later
    158158cfg_flags := $(if $(NOQT),--disable-qt,) \
    159              $(if $(NOSDL),--disable-vboxsdl,) \
    160              $(if $(filter el5 el6,$(rpmrel)),--build-libvpx,) \
    161              $(if $(filter el5 el6,$(rpmrel)),--build-libopus,) \
    162              $(if $(filter el5 el6,$(rpmrel)),--build-libssl,) \
    163              $(if $(filter el5,$(rpmrel)),--build-libcurl,) \
    164              $(if $(filter el5,$(rpmrel)),--disable-sdl-ttf,) \
    165              $(if $(filter el5,$(rpmrel)),--disable-pulse,) \
    166              $(if $(filter el5,$(rpmrel)),--disable-python,) \
    167              $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
    168              $(if $(HEADLESS),--build-headless,) \
    169              $(if $(DEBUG),--build-debug,) \
    170              $(if $(NOWINE),,--setup-wine) \
    171              $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
    172              $(if $(VNC),--enable-vnc,) \
    173              $(if $(PATH_OUT_BASE),--out-base-dir=$(PATH_OUT_BASE),) \
    174              --disable-extpack
     159    $(if $(NOSDL),--disable-vboxsdl,) \
     160    $(if $(filter el5 el6,$(rpmrel)),--build-libvpx,) \
     161    $(if $(filter el5 el6,$(rpmrel)),--build-libopus,) \
     162    $(if $(filter el5 el6,$(rpmrel)),--build-libssl,) \
     163    $(if $(filter el5,$(rpmrel)),--build-libcurl,) \
     164    $(if $(filter el5,$(rpmrel)),--disable-sdl-ttf,) \
     165    $(if $(filter el5,$(rpmrel)),--disable-pulse,) \
     166    $(if $(filter el5,$(rpmrel)),--disable-python,) \
     167    $(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
     168    $(if $(HEADLESS),--build-headless,) \
     169    $(if $(DEBUG),--build-debug,) \
     170    $(if $(NOWINE),,--setup-wine) \
     171    $(if $(VNC),--enable-vnc,) \
     172    $(if $(PATH_OUT_BASE),--out-base-dir=$(PATH_OUT_BASE),) \
     173    --disable-extpack
    175174
    176175bld_flags := AUTOCFG=$(bldbase)/AutoConfig.kmk \
    177              LOCALCFG=$(current)/rpm/LocalConfig.kmk \
    178              PATH_OUT=$(builddir) \
    179              VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
    180              VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
    181              $(if $(filter el5 el6,$(rpmrel)),,VBOX_WITH_VMSVGA3D=1) \
    182              VBOX_DO_STRIP= \
    183              $(if $(filter el5,$(rpmrel)),VBOX_BLD_PYTHON=$(strip \
    184                 $(firstword $(wildcard /usr/local/bin/python2.7) $(wildcard /usr/bin/python2.7) \
    185                 $(wildcard /usr/bin/python2.6) $(wildcard /usr/bin/python2) $(wildcard /usr/bin/python))),) \
    186              $(doc_dir) \
    187              $(if $(STAGEDQHELP),VBOX_WITH_DOCS_QHELP=1,) \
    188              VBOX_PACKAGE_DIST=$(rpmdist) \
    189              $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
    190              $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
    191              $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
    192              $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
    193              $(if $(filter el5,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
    194 
     176    LOCALCFG=$(instlin)/rpm/LocalConfig.kmk \
     177    PATH_OUT=$(builddir) \
     178    VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
     179    VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
     180    $(if $(filter el5 el6,$(rpmrel)),,VBOX_WITH_VMSVGA3D=1) \
     181    VBOX_DO_STRIP= \
     182    $(if $(filter el5,$(rpmrel)),VBOX_BLD_PYTHON=$(firstword $(wildcard \
     183      /usr/local/bin/python2.7 /usr/bin/python2.7 /usr/bin/python2.6 /usr/bin/python2 /usr/bin/python)),) \
     184    $(if $(filter el5,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1) \
     185    $(doc_dir) \
     186    VBOX_PACKAGE_DIST=$(rpmdist) \
     187    $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
     188    $(if $(NODOCS),VBOX_WITH_DOCS= ,) \
     189    $(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
     190    $(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,)
     191
     192configure: $(bldbase)/configure-stamp
    195193$(bldbase)/configure-stamp:
    196194        mkdir -p $(bldbase)
     
    198196        touch $@
    199197
    200 $(bldbase)/build-stamp: $(bldbase)/configure-stamp
     198build: $(bldbase)/configure-stamp $(bldbase)/build-stamp
     199$(bldbase)/build-stamp $(verfile): $(bldbase)/configure-stamp
    201200        . $(bldbase)/env.sh && kmk -C $(vboxroot) $(bld_flags) $(if $(NOPARALLEL),-j1,) all
    202         $(if $(NODOCS),cp $(vboxroot)/prebuild/UserManual*.pdf $(builddir)/bin,)
    203         $(if $(STAGEDQHELP),cp $(STAGEDQHELP)/VirtualBox*.qch $(STAGEDQHELP)/VirtualBox*.qhc $(builddir)/bin,)
     201        # Files from prebuild go to (builddir)/bin to be used during the
     202        # packing stage, overriding what the build did/would produce.
     203        $(if $(NODOCS),cp $(addprefix $(vboxroot)/prebuild/,UserManual*.pdf UserManual*.qch UserManual.qhc) $(builddir)/bin,)
    204204        $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI32.fd $(builddir)/bin,)
    205205        $(if $(EFI),cp $(vboxroot)/prebuild/VBoxEFI64.fd $(builddir)/bin,)
     
    213213            VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
    214214            packing
    215         touch $@
     215        touch $(bldbase)/build-stamp
    216216
    217217clean:
     
    219219        rm -rf $(stagedir)
    220220        rm -rf $(builddir)
     221        rm -rf $(bldbase)/wine.*
    221222        rm -rf $(bldbase)/VirtualBox-*
    222223        rm -f $(bldbase)/VirtualBox.tar $(bldbase)/VirtualBox.tar.bz2
     224        rm -f $(bldbase)/build-stamp $(bldbase)/configure-stamp
     225        rm -f $(bldbase)/AutoConfig.kmk $(bldbase)/configure.log $(bldbase)/env.sh
    223226        rm -f $(bldbase)/VirtualBox.spec
    224         rm -f $(bldbase)/build-stamp $(bldbase)/configure-stamp $(bldbase)/configure.log
    225         rm -f $(bldbase)/AutoConfig.kmk $(bldbase)/env.sh
    226227        if [ -d $(bldbase) ]; then rmdir $(bldbase); fi
    227228
    228229ifeq ($(VBOX_VERSION_MAJOR),)
    229 binary: $(bldbase)/build-stamp $(verfile)
    230         $(MAKE) -f rpm/rules binary
     230binary: build $(verfile)
     231        +$(MAKE) -f rpm/rules binary
     232
    231233else
    232 binary: $(bldbase)/build-stamp
     234binary: build
    233235        rm -rf $(bldbase)/VirtualBox-*
    234236        tar -xf $(builddir)/bin/VirtualBox.tar -C $(bldbase)
     
    248250            -e 's|%INITSCRIPTS%|$(if $(filter fedora,$(rpmspec)),initscripts,)|g' \
    249251            -e 's|%NETTOOLS%|$(if $(filter fedora18 fedora19 fedora20 fedora21 el5 openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114,$(rpmrel)),net-tools,iproute)|g' \
    250             $(current)/rpm/VirtualBox.tmpl.spec > $(archdir)/VirtualBox.spec
     252            $(instlin)/rpm/VirtualBox.tmpl.spec > $(archdir)/VirtualBox.spec
    251253        mv $(bldbase)/VirtualBox-$(ver) $(bldbase)/$(rpmname)
    252254        cp ../../../../tools/linux.$(chrarch)/bin/chrpath $(bldbase)/$(rpmname) || true
     
    263265endif
    264266
    265 .PHONY: binary clean
     267.PHONY: binary configure build clean
Note: See TracChangeset for help on using the changeset viewer.

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