# $Id: Makefile.kmk 12962 2008-10-02 22:10:55Z vboxsync $ ## @file # Makefile for the Linux installer. # # # Copyright (C) 2006-2007 Sun Microsystems, Inc. # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; # you can redistribute it and/or modify it under the terms of the GNU # General Public License (GPL) as published by the Free Software # Foundation, in version 2 as it comes in the "COPYING" file of the # VirtualBox OSE distribution. VirtualBox OSE is distributed in the # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. # # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa # Clara, CA 95054 USA or visit http://www.sun.com if you need # additional information or have any questions. # SUB_DEPTH = ../../../.. include $(KBUILD_PATH)/subheader.kmk ifneq ($(KBUILD_HOST),linux) $(error "The Linux installer can only be built on Linux!") endif # # Globals and targets. # VBOX_PATH_LNX_INST_SRC := $(PATH_SUB_CURRENT) VBOX_LNX_INST_OUT_DIR := $(PATH_TARGET)/Installer/linux VBOX_LNX_INST_STAGE_DIR := $(PATH_TARGET)/Installer/linux/install VBOX_LNX_DBG_PATH := usr/lib/debug/opt/VirtualBox-$(VBOX_VERSION_STRING) VBOX_LNX_PACKAGE_NAME = VirtualBox-$(VBOX_VERSION_STRING)-r$(VBOX_SVN_REV).run # Unset this to speed up things during makefile hacking. VBOX_LNX_INST_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT) BLDDIRS += $(VBOX_LNX_INST_OUT_DIR) $(VBOX_LNX_INST_STAGE_DIR) PACKING += $(PATH_BIN)/VirtualBox.tar.bz2 if !defined(VBOX_NO_LINUX_RUN_INSTALLER) && !defined(VBOX_OSE) PACKING += $(PATH_BIN)/$(VBOX_LNX_PACKAGE_NAME) \ $(PATH_BIN)/VirtualBox-dbg.tar.bz2 endif OTHER_CLEAN += \ $(addprefix $(VBOX_LNX_INST_STAGE_DIR)/,\ install.sh \ deffiles \ routines.sh \ vboxdrv.sh \ vboxnet.sh \ VirtualBox.tar.bz2 \ LICENSE) \ $(wildcard $(VBOX_LNX_INST_OUT_DIR)/VirtualBox-*) \ $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh \ $(VBOX_LNX_INST_OUT_DIR)/vboxnet.sh \ $(VBOX_LNX_INST_OUT_DIR)/install.sh # # Linux installs. # INSTALLS += linux-bin linux-bin_INST = bin/ linux-bin_MODE = a+rx,u+w linux-bin_SOURCES = \ VBoxSysInfo.sh \ VBox.sh=>VBox.sh \ $(PATH_linux-bin)/VBoxAddIF.sh linux-bin_CLEAN = \ $(PATH_linux-bin)/VBoxAddIF.sh $$(PATH_linux-bin)/VBoxAddIF.sh: $(PATH_SUB_CURRENT)/VBoxAddIF.sh $(VBOX_VERSION_STAMP) | $$(dir $$@) $(call MSG_GENERATE,,$@,$<) $(QUIET)$(SED) -e "s;_VERSION_;$(VBOX_VERSION_STRING);g" --output $@ $< INSTALLS += linux-misc linux-misc_INST = bin/ linux-misc_MODE = a+r,u+w linux-misc_SOURCES = \ $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/$(if $(VBOX_OSE),OSE,NonOSE)/VirtualBox_32px.png=>VBox.png \ $(if $(VBOX_OSE),,$(VBOX_BRAND_LICENSE_TXT)=>LICENSE) \ $(if $(VBOX_WITH_QT4GUI),$(PATH_linux-misc)/VirtualBox.desktop,) $$(PATH_linux-misc)/VirtualBox.desktop: $(PATH_SUB_CURRENT)/VirtualBox.desktop $(VBOX_VERSION_STAMP) | $$(dir $$@) $(call MSG_GENERATE,,$@,$<) ifdef VBOX_PATH_PACKAGE_DOCS $(QUIET)$(SED) -e "s+\$$VBOX_DOC_PATH+$(VBOX_PATH_PACKAGE_DOCS)+" --output $@ $< else $(QUIET)$(SED) -e "s+\$$VBOX_DOC_PATH+/opt/VirtualBox-$(VBOX_VERSION_STRING)+" --output $@ $< endif # # The files residing in bin/ that we'll ship. # # Strip these binaries VBOX_LNX_STRIP_BIN = \ VBoxDD.so \ VBoxDD2.so \ $(if $(VBOX_WITH_FFMPEG),VBoxFFmpegFB.so,) \ VBoxManage \ VBoxREM.so \ VBoxRT.so \ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL $(if $(VBOX_WITH_HARDENING),VBoxSDL.so),) \ VBoxSettings.so \ VBoxSharedClipboard.so \ VBoxSharedFolders.so \ $(if $(VBOX_WITH_GUEST_PROPS),VBoxGuestPropSvc.so) \ VBoxSVC \ VBoxDDU.so \ VBoxVMM.so \ VBoxXPCOM.so \ VBoxXPCOMIPCD \ $(if $(VBOX_WITH_PYTHON),VBoxPython.so,) \ VBoxTunctl \ components/VBoxC.so \ components/VBoxSVCM.so \ components/VBoxXPCOMIPCC.so \ $(if $(VBOX_OSE),,VRDPAuth.so) # Do not remove relocation information of these binaries VBOX_LNX_STRIP_OBJ = \ VBoxDD2GC.gc \ VBoxDD2R0.r0 \ VBoxDDGC.gc \ VBoxDDR0.r0 \ VMMGC.gc \ VMMR0.r0 ifeq ($(KBUILD_TARGET_ARCH),amd64) VBOX_LNX_STRIP_OBJ += \ VBoxREM2.rel endif # Do not strip anything of these files VBOX_LNX_NO_STRIP = \ $(if $(VBOX_OSE),,LICENSE) \ components/VBoxXPCOMBase.xpt \ components/VirtualBox_XPCOM.xpt \ VBoxSysInfo.sh \ VBox.sh \ VBox.png \ VBoxAddIF.sh \ src # Qt4 GUI ifdef VBOX_WITH_QT4GUI include $(PATH_ROOT)/src/VBox/Frontends/VirtualBox4/nls/ApprovedLanguages.kmk VBOX_LNX_STRIP_BIN += \ VBoxKeyboard.so \ VirtualBox \ $(if $(VBOX_WITH_HARDENING),VirtualBox.so) \ $(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so) VBOX_LNX_NO_STRIP += \ VirtualBox.desktop \ $(if $(VBOX_OSE),,License-$(VBOX_LICENSE_VER).html) \ $(if $(VBOX_WITH_QT4_SUN),$(notdir $(wildcard $(PATH_BIN)/libVBox*)),) \ $(foreach f,$(VBOX_APPROVED_GUI_LANGUAGES),nls/VirtualBox_$(f).qm nls/qt_$(f).qm) endif # Guest Additions ifdef VBOX_WITH_ADDITIONS_PACKING VBOX_LNX_NO_STRIP += \ additions/VBoxGuestAdditions.iso endif # Documentation ifdef VBOX_WITH_DOCS_PACKING VBOX_LNX_NO_STRIP += \ UserManual.pdf VBOX_LNX_STRIP_BIN += \ $(if $(VBOX_WITH_KCHMVIEWER),kchmviewer,) ifneq ($(wildcard $(PATH_BIN)/VirtualBox.chm),) # our 64-bit tinderboxes are not able to generate VirtualBox.chm so far # but for building .deb/.rpm packages we use precompiled binaries. VBOX_LNX_NO_STRIP += \ VirtualBox.chm endif endif # VRDP ifdef VBOX_WITH_VRDP VBOX_LNX_STRIP_BIN += \ VBoxVRDP.so VBOX_LNX_NO_STRIP += \ rdesktop-vrdp.tar.gz ifdef VBOX_WITH_VRDP_RDESKTOP VBOX_LNX_NO_STRIP += \ rdesktop-vrdp-keymaps VBOX_LNX_STRIP_BIN += \ rdesktop-vrdp endif endif # Headless ifdef VBOX_WITH_HEADLESS VBOX_LNX_STRIP_BIN += \ VBoxHeadless \ $(if $(VBOX_WITH_HARDENING),VBoxHeadless.so) endif # Webservices ifdef VBOX_WITH_WEBSERVICES VBOX_LNX_STRIP_BIN += \ vboxwebsrv \ webtest endif # # All the bin files that goes into the archives. # VBOX_LNX_ARCH_FILES := $(VBOX_LNX_STRIP_BIN) $(VBOX_LNX_STRIP_OBJ) $(VBOX_LNX_NO_STRIP) # Cleanup of the files we copy/symlink from bin. OTHER_CLEAN += $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/,$(VBOX_LNX_ARCH_FILES)) \ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/,$(VBOX_LNX_STRIP_BIN)) # # The generic installer. # $(PATH_BIN)/$(VBOX_LNX_PACKAGE_NAME): \ $(VBOX_LNX_INST_STAGE_DIR)/VirtualBox.tar.bz2 \ $(VBOX_VERSION_STAMP) \ $(VBOX_PATH_LNX_INST_SRC)/routines.sh \ $(VBOX_PATH_LNX_INST_SRC)/deffiles \ $(if $(VBOX_OSE),,$(PATH_ROOT)/doc/License.txt) \ $(VBOX_LNX_INST_OUT_DIR)/vboxnet.sh \ $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh \ $(VBOX_LNX_INST_OUT_DIR)/install.sh $(call MSG_TOOL,makeself,,$@) $(QUIET)$(RM) -f $(wildcard $(PATH_BIN)/VirtualBox-*.run) $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/routines.sh $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/deffiles $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(if $(VBOX_OSE),,$(INSTALL) -m 0644 $(PATH_ROOT)/doc/License.txt $(VBOX_LNX_INST_STAGE_DIR)/LICENSE) $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxnet.sh $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/install.sh $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(RM) -f $@ $(QUIET)$(VBOX_MAKESELF) --follow --nocomp $(VBOX_LNX_INST_STAGE_DIR) $@ \ "VirtualBox for Linux installation" ./install.sh "\$$0 1> /dev/null" # files that needs editing before they can be included in the generic installer. $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxdrv.sh.in | $$(dir $$@) $(QUIET)$(SED_EXT) -e "s|%NOLSB%|yes|g; s|%PACKAGE%|virtualbox|g" --output $@ $< $(VBOX_LNX_INST_OUT_DIR)/vboxnet.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxnet.sh.in | $$(dir $$@) $(QUIET)$(SED_EXT) -e "s|%NOLSB%|yes|g" --output $@ $< $(VBOX_LNX_INST_OUT_DIR)/install.sh: $(VBOX_PATH_LNX_INST_SRC)/install.sh | $$(dir $$@) $(QUIET)$(SED) \ -e "s;_VERSION_;$(VBOX_VERSION_STRING);g" \ -e "s;_BUILD_;$(date-utc );g" \ -e "s;_ARCH_;$(KBUILD_TARGET_ARCH);g" \ -e "s;_HARDENED_;$(VBOX_WITH_HARDENING);g" \ --output $@ \ $< # # .tar.bz2 for converting into .run # $(VBOX_LNX_INST_STAGE_DIR)/VirtualBox.tar.bz2: \ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/, $(VBOX_LNX_ARCH_FILES)) \ $(VBOX_LNX_INST_DEP_ON_MAKEFILE) \ $(VBOX_VERSION_STAMP) $(call MSG_L1,Packing $@) $(QUIET)$(RM) -f -- $@ $(patsubst %.bz2,%,$@) $(QUIET)$(MKDIR) -p $(@D) ifdef VBOX_USE_PBZIP2 $(QUIET)tar --owner 0 --group 0 -cRhf $(patsubst %.bz2,%,$@) -C $(VBOX_LNX_INST_OUT_DIR)/archive $(VBOX_LNX_ARCH_FILES) $(QUIET)pbzip2 $(patsubst %.bz2,%,$@) else $(QUIET)tar --owner 0 --group 0 -cjRhf $@ -C $(VBOX_LNX_INST_OUT_DIR)/archive $(VBOX_LNX_ARCH_FILES) endif $(QUIET)$(CHMOD) 0644 $@ # # .tar.bz2 for distribution with the files under VirtualBox-/. # $(PATH_BIN)/VirtualBox.tar.bz2: \ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/, $(VBOX_LNX_ARCH_FILES)) \ $(VBOX_LNX_INST_DEP_ON_MAKEFILE) \ $(VBOX_VERSION_STAMP) $(call MSG_L1,Packing $@) $(QUIET)$(RM) -f -- $(VBOX_LNX_INST_OUT_DIR)/VirtualBox-$(VBOX_VERSION_STRING) $@ $(patsubst %.bz2,%,$@) $(QUIET)$(LN_SYMLINK) $(VBOX_LNX_INST_OUT_DIR)/archive/ $(VBOX_LNX_INST_OUT_DIR)/VirtualBox-$(VBOX_VERSION_STRING) ifdef VBOX_USE_PBZIP2 $(QUIET)tar --owner 0 --group 0 -cRhf $(patsubst %.bz2,%,$@) -C $(VBOX_LNX_INST_OUT_DIR) \ $(addprefix VirtualBox-$(VBOX_VERSION_STRING)/,$(VBOX_LNX_ARCH_FILES)) $(QUIET)pbzip2 $(patsubst %.bz2,%,$@) else $(QUIET)tar --owner 0 --group 0 -cjRhf $@ -C $(VBOX_LNX_INST_OUT_DIR) \ $(addprefix VirtualBox-$(VBOX_VERSION_STRING)/,$(VBOX_LNX_ARCH_FILES)) endif $(QUIET)$(RM) -f -- $(VBOX_LNX_INST_OUT_DIR)/VirtualBox-$(VBOX_VERSION_STRING) # pattern rule for stripping and copying the VBOX_LNX_STRIP_BIN files to archive/ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/,$(VBOX_LNX_STRIP_BIN)): \ $(VBOX_LNX_INST_OUT_DIR)/archive/% : $(PATH_BIN)/% \ $(if $(VBOX_NO_LINUX_RUN_INSTALLER),,\ $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/%) \ | $$(dir $$@) $(call MSG_INST_FILE,$<,$@) $(QUIET)$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@ $(QUIET)$(if $(VBOX_NO_LINUX_RUN_INSTALLER),,objcopy --add-gnu-debuglink=$(subst $(VBOX_LNX_INST_OUT_DIR)/archive,$(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH),$@) $@) # pattern rule for striping and copying the VBOX_LNX_STRIP_OBJ files to archive/ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/,$(VBOX_LNX_STRIP_OBJ)): \ $(VBOX_LNX_INST_OUT_DIR)/archive/% : $(PATH_BIN)/% | $$(dir $$@) $(call MSG_INST_FILE,$<,$@) ifeq ($(VBOX_DO_STRIP),) $(QUIET)$(INSTALL) -m 0644 $< $@ else # strip to temp file because of umask. $(QUIET)objcopy --strip-unneeded -R .comment $< $@.tmp $(QUIET)$(INSTALL) -m 0644 $@.tmp $@ $(QUIET)$(RM) -f -- $@.tmp endif # pattern rule for linking the VBOX_LNX_NO_STRIP into archive/ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/,$(VBOX_LNX_NO_STRIP)): \ $(VBOX_LNX_INST_OUT_DIR)/archive/% : $(PATH_BIN)/% | $$(dir $$@) $(call MSG_INST_SYM,$<,$@) $(QUIET)$(RM) -f $@ $(QUIET)$(LN_SYMLINK) $< $@ # rules for creating directories in archive (the pattern rules depends on these). ## @todo use BLDDIRS BLDDIRS += $(foreach d,\ archive \ archive/components \ archive/nls \ archive/additions \ install\ ,$(VBOX_LNX_INST_OUT_DIR)/$(d)/) # # .tar.bz2 for with the debug info. # $(PATH_BIN)/VirtualBox-dbg.tar.bz2: \ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/, $(VBOX_LNX_STRIP_BIN)) $(call MSG_L1,Packing $@) $(QUIET)$(RM) -f -- $@ $(patsubst %.bz2,%,$@) ifdef VBOX_USE_PBZIP2 $(QUIET)tar --owner 0 --group 0 -cRhf $(patsubst %.bz2,%,$@) -C $(VBOX_LNX_INST_OUT_DIR)/archive-dbg \ $(addprefix $(VBOX_LNX_DBG_PATH)/,$(VBOX_LNX_STRIP_BIN)) $(QUIET)pbzip2 $(patsubst %.bz2,%,$@) else $(QUIET)tar --owner 0 --group 0 -cjRhf $@ -C $(VBOX_LNX_INST_OUT_DIR)/archive-dbg \ $(addprefix $(VBOX_LNX_DBG_PATH)/,$(VBOX_LNX_STRIP_BIN)) endif # pattern rule for copying the debug info from the VBOX_LNX_STRIP_BIN files into archive-dbg/$(VBOX_LNX_DBG_PATH)/ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/,$(VBOX_LNX_STRIP_BIN)): \ $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/% : $(PATH_BIN)/% | $$(dir $$@) $(call MSG_TOOL,copydbg,$<,$@) $(QUIET)objcopy --only-keep-debug $< $@ # rules for creating directories in archive-dbg (the pattern rules depends on these). ## @todo use BLDDIRS BLDDIRS += $(foreach d,\ $(VBOX_LNX_DBG_PATH) \ $(VBOX_LNX_DBG_PATH)/components \ ,$(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(d)/) include $(KBUILD_PATH)/subfooter.kmk