# $Id: Makefile.kmk 8155 2008-04-18 15:16:47Z 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. # DEPTH = ../../../.. include $(PATH_KBUILD)/header.kmk ifneq ($(BUILD_PLATFORM),linux) $(error "The Linux installer can only be built on Linux!") # yeah, right. endif VBOX_NO_LINUX_RUN_INSTALLER ?= $(VBOX_OSE) PROGRAMS = VBoxTunctl PACKING = $(if $(VBOX_NO_LINUX_RUN_INSTALLER),,\ $(PATH_BIN)/VirtualBox.run $(PATH_BIN)/VirtualBox-dbg.tar.bz2) PACKING += $(PATH_BIN)/VirtualBox.tar.bz2 OTHER_CLEAN = $(addprefix $(PATH_TARGET)/install/,\ install.sh deffiles routines.sh \ VBoxAddIF.sh vboxdrv.sh vboxnet.sh \ VirtualBox.tar.bz2 LICENSE) \ $(wildcard $(PATH_TARGET)/VirtualBox-*) \ $(PATH_TARGET)/vboxdrv.sh $(PATH_TARGET)/vboxnet.sh INSTALLS = linux-bin linux-doc VBoxTunctl_TEMPLATE = VBOXR3EXE VBoxTunctl_SOURCES = tunctl.c # # Linux installs. # linux-bin_INST = bin/ linux-bin_MODE = a+rx,u+w linux-bin_SOURCES = \ VBoxSysInfo.sh \ VBox.sh=>VBox.sh linux-doc_INST = bin/ linux-doc_MODE = a+r,u+w linux-doc_SOURCES = \ $(if $(VBOX_OSE),,$(PATH_ROOT)/doc/License.txt=>LICENSE) \ VBox.png=>VBox.png # Strip these binaries LINUXSTRIPBIN = \ VBoxDD.so \ VBoxDD2.so \ $(if $(VBOX_WITH_FFMPEG),VBoxFFmpegFB.so,) \ VBoxManage \ VBoxREM.so \ VBoxRT.so \ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \ VBoxSettings.so \ VBoxSVC \ VBoxDDU.so \ VBoxVMM.so \ VBoxXPCOM.so \ VBoxXPCOMIPCD \ $(if $(VBOX_WITH_QTGUI),VBoxKeyboard.so,) \ $(if $(VBOX_WITH_QTGUI),VirtualBox,) \ VBoxTunctl \ components/VBoxC.so \ components/VBoxSVCM.so \ components/VBoxXPCOMIPCC.so # Do not remove relocation information of these binaries LINUXSTRIPOBJ = \ VBoxDD2GC.gc \ VBoxDD2R0.r0 \ VBoxDDGC.gc \ VBoxDDR0.r0 \ VMMGC.gc \ VMMR0.r0 ifeq ($(BUILD_TARGET_ARCH),amd64) LINUXSTRIPOBJ += \ VBoxREM2.rel endif # Do not strip anything of these files LINUXNOSTRIP = \ $(if $(VBOX_OSE),,LICENSE) \ $(if $(VBOX_WITH_QTGUI),\ $(if $(VBOX_OSE),,License-$(VBOX_LICENSE_VER).html)) \ components/VBoxXPCOMBase.xpt \ components/VirtualBox_XPCOM.xpt \ VBoxSysInfo.sh \ VBox.sh \ VBox.png \ VBoxAddIF.sh \ $(if $(VBOX_WITH_QTGUI),VirtualBox.desktop,) \ $(if $(VBOX_WITH_QTGUI),$(foreach f,\ $(shell $(CAT_EXT) \ $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.txt),\ nls/VirtualBox_$(f).qm nls/qt_$(f).qm),) \ src \ sdk # Guest Additions LINUXNOSTRIP += \ $(if $(VBOX_OSE),,additions/VBoxGuestAdditions.iso) # Shared Folders LINUXSTRIPBIN += \ VBoxSharedFolders.so \ $(if $(VBOX_OSE),,VRDPAuth.so) # Shared Clipboard LINUXSTRIPBIN += \ VBoxSharedClipboard.so \ $(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so,) ifdef VBOX_WITH_DOCS LINUXNOSTRIP += \ UserManual.pdf LINUXSTRIPBIN += \ $(if $(VBOX_WITH_QTGUI),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. LINUXNOSTRIP += \ VirtualBox.chm endif ifneq ($(wildcard $(PATH_BIN)/VirtualBoxAPI.chm),) # same applies to VirtualBoxAPI.chm LINUXNOSTRIP += \ VirtualBoxAPI.chm endif endif ifdef VBOX_WITH_VRDP LINUXSTRIPBIN += \ VBoxVRDP.so LINUXNOSTRIP += \ rdesktop-vrdp.tar.gz ifndef VBOX_HEADLESS LINUXNOSTRIP += \ rdesktop-vrdp-keymaps LINUXSTRIPBIN += \ rdesktop-vrdp endif endif ifdef VBOX_WITH_HEADLESS LINUXSTRIPBIN += \ VBoxHeadless endif ifdef VBOX_WITH_WEBSERVICES LINUXSTRIPBIN += \ vboxwebsrv \ webtest endif LINUXARCHFILES := $(LINUXSTRIPBIN) $(LINUXSTRIPOBJ) $(LINUXNOSTRIP) DBGPATH := usr/lib/debug/opt/VirtualBox-$(VBOX_VERSION_STRING) OTHER_CLEAN += $(addprefix $(PATH_TARGET)/archive/,$(LINUXARCHFILES)) \ $(addprefix $(PATH_TARGET)/archive-dbg/$(DBGPATH)/,$(LINUXSTRIPBIN)) include $(PATH_KBUILD)/footer.kmk $(PATH_BIN)/VirtualBox.run: \ $(PATH_TARGET)/install/VirtualBox.tar.bz2 \ install.sh \ $(VBOX_VERSION_STAMP) \ routines.sh \ deffiles \ $(PATH_TARGET)/vboxnet.sh \ $(PATH_TARGET)/vboxdrv.sh \ $(if $(VBOX_OSE),,$(PATH_ROOT)/doc/License.txt) $(call MSG_TOOL,makeself,,$@) $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" \ -e "s;_BUILD_;$(shell date);g" \ -e "s;_ARCH_;${BUILD_TARGET_ARCH};g" \ < install.sh > $(PATH_TARGET)/install/install.sh $(QUIET)chmod 0744 $(PATH_TARGET)/install/install.sh $(QUIET)$(INSTALL) -m 0755 routines.sh $(PATH_TARGET)/install $(QUIET)$(INSTALL) -m 0755 deffiles $(PATH_TARGET)/install $(QUIET)$(if $(VBOX_OSE),,$(INSTALL) -m 0644 $(PATH_ROOT)/doc/License.txt $(PATH_TARGET)/install/LICENSE) $(QUIET)$(INSTALL) -m 0755 $(PATH_TARGET)/vboxnet.sh $(PATH_TARGET)/install $(QUIET)$(INSTALL) -m 0755 $(PATH_TARGET)/vboxdrv.sh $(PATH_TARGET)/install $(QUIET)$(RM) -f $@ $(QUIET)$(VBOX_MAKESELF) --follow --nocomp $(PATH_TARGET)/install $@ \ "VirtualBox for Linux installation" ./install.sh "\$$0 1> /dev/null" $(PATH_BIN)/VirtualBox-dbg.tar.bz2: \ $(addprefix $(PATH_TARGET)/archive-dbg/$(DBGPATH)/, $(LINUXSTRIPBIN)) $(call MSG_L1,Packing $@) $(QUIET)tar --owner 0 --group 0 -cjRhf $@ -C $(PATH_TARGET)/archive-dbg \ $(addprefix $(DBGPATH)/,$(LINUXSTRIPBIN)) $(PATH_TARGET)/vboxdrv.sh: vboxdrv.sh.in $(QUIET)$(SED_EXT) -e "s|%NOLSB%|yes|g" $< > $@ $(PATH_TARGET)/vboxnet.sh: vboxnet.sh.in $(QUIET)$(SED_EXT) -e "s|%NOLSB%|yes|g" $< > $@ # .tar.bz2 for converting into .run $(PATH_TARGET)/install/VirtualBox.tar.bz2: \ $(addprefix $(PATH_TARGET)/archive/, $(LINUXARCHFILES)) \ Makefile.kmk \ $(VBOX_VERSION_STAMP) \ $(PATH_TARGET)/VirtualBox-$(VBOX_VERSION_STRING) $(call MSG_L1,Packing $@) $(QUIET)$(MKDIR) -p $(@D) $(QUIET)tar --owner 0 --group 0 -cjRhf $@ -C $(PATH_TARGET)/VirtualBox-$(VBOX_VERSION_STRING) $(LINUXARCHFILES) $(QUIET)chmod 0644 $@ # .tar.bz2 for distribution $(PATH_BIN)/VirtualBox.tar.bz2: \ $(addprefix $(PATH_TARGET)/archive/, $(LINUXARCHFILES)) \ Makefile.kmk \ $(VBOX_VERSION_STAMP) \ $(PATH_TARGET)/VirtualBox-$(VBOX_VERSION_STRING) $(call MSG_L1,Packing $@) $(QUIET)$(MKDIR) -p $(PATH_TARGET) $(QUIET)tar --owner 0 --group 0 -cjRhf $@ -C $(PATH_TARGET) \ $(addprefix VirtualBox-$(VBOX_VERSION_STRING)/,$(LINUXARCHFILES)) $(PATH_TARGET)/VirtualBox-$(VBOX_VERSION_STRING): $(PATH_TARGET)/archive $(call MSG_INST_SYM,$<,$@) $(QUIET)$(MKDIR) -p $(@D) $(QUIET)rm -rf $@ $(QUIET)$(LN_SYMLINK) $< $@ $(PATH_BIN)/VBoxAddIF.sh: VBoxAddIF.sh $(VBOX_VERSION_STAMP) $(call MSG_GENERATE,,$@,$<) $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" $< > $@ $(QUIET)chmod 0755 $@ $(PATH_BIN)/VirtualBox.desktop: VirtualBox.desktop $(VBOX_VERSION_STAMP) $(call MSG_GENERATE,,$@,$<) ifdef VBOX_PATH_PACKAGE_DOCS $(QUIET)$(SED) -e "s+\$$VBOX_DOC_PATH+$(VBOX_PATH_PACKAGE_DOCS)+" $< > $@ else $(QUIET)$(SED) -e "s+\$$VBOX_DOC_PATH+/opt/VirtualBox-$(VBOX_VERSION_STRING)+" $< > $@ endif # Note: The -m feature of kmk_builtin_install does not work together with fakeroot! # Note: $(INSTALL) -s is currently not reliable when used in parallel builds. Fixed in 0.1.1. $(foreach f,$(LINUXSTRIPBIN),$(PATH_TARGET)/archive/$(f)): \ $(PATH_TARGET)/archive/% : $(PATH_BIN)/% \ $(if $(VBOX_NO_LINUX_RUN_INSTALLER),,\ $(PATH_TARGET)/archive-dbg/$(DBGPATH)/%) \ | $(call DIRDEP,$(PATH_TARGET)/archive) $(call MSG_INST_FILE,$<,$@) $(QUIET)install -D -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@ $(QUIET)$(if $(VBOX_NO_LINUX_RUN_INSTALLER),,objcopy --add-gnu-debuglink=$(subst $(PATH_TARGET)/archive,$(PATH_TARGET)/archive-dbg/$(DBGPATH),$@) $@) $(foreach f,$(LINUXSTRIPOBJ),$(PATH_TARGET)/archive/$(f)): \ $(PATH_TARGET)/archive/% : $(PATH_BIN)/% | $(call DIRDEP,$(PATH_TARGET)/archive) $(call MSG_INST_FILE,$<,$@) $(QUIET)$(if $(VBOX_DO_STRIP),objcopy --strip-unneeded -R .comment $< $@,cp $< $@) $(foreach f,$(LINUXNOSTRIP),$(PATH_TARGET)/archive/$(f)): \ $(PATH_TARGET)/archive/% : $(PATH_BIN)/% | $(call DIRDEP,$(PATH_TARGET)/archive) $(call MSG_INST_SYM,$<,$@) $(QUIET)$(RM) -f $@ $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(LN_SYMLINK) $< $@ $(foreach d,archive archive-dbg/$(DBGPATH) archive-dbg/$(DBGPATH)/components install,$(PATH_TARGET)/$(d)/): $(QUIET)$(MKDIR) -p $@ $(foreach f,$(LINUXSTRIPBIN),$(PATH_TARGET)/archive-dbg/$(DBGPATH)/$(f)): \ $(PATH_TARGET)/archive-dbg/$(DBGPATH)/% : $(PATH_BIN)/% \ | $(call DIRDEP,$(PATH_TARGET)/archive-dbg/$(DBGPATH)/components) $(call MSG_TOOL,copydbg,$<,$@) $(QUIET)objcopy --only-keep-debug $< $@