summaryrefslogtreecommitdiff
path: root/src/VBox/Installer/freebsd/Makefile.kmk
blob: 2e27a9e02165e41d83891aafbef469c3f43f78f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# $Id: Makefile.kmk $
## @file
# Makefile for the FreeBSD installer.
#

#
# Copyright (C) 2006-2007 Oracle Corporation
#
# 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.
#

SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk

ifneq ($(KBUILD_HOST),freebsd)
 $(error "The FreeBSD installer can only be built on FreeBSD!")
endif

#
# Globals and targets.
#
VBOX_PATH_FBSD_INST_SRC      := $(PATH_SUB_CURRENT)
VBOX_FBSD_INST_OUT_DIR       := $(PATH_TARGET)/Installer/freebsd
VBOX_FBSD_INST_STAGE_DIR     := $(PATH_TARGET)/Installer/freebsd/install
VBOX_FBSD_DBG_PATH           := usr/lib/debug/opt/VirtualBox
VBOX_FBSD_PACKAGE_NAME        = VirtualBox-$(VBOX_VERSION_STRING)-r$(VBOX_SVN_REV).tbz
VBOX_FBSD_INST_LIB_DIR       := $(VBOX_FBSD_INST_STAGE_DIR)/lib
VBOX_FBSD_INST_BIN_DIR       := $(VBOX_FBSD_INST_STAGE_DIR)/bin
VBOX_FBSD_INST_LIBVBOX_DIR   := $(VBOX_FBSD_INST_LIB_DIR)/virtualbox
VBOX_FBSD_INST_SHARE_DIR     := $(VBOX_FBSD_INST_STAGE_DIR)/share
VBOX_FBSD_INST_SHAREAPP_DIR  := $(VBOX_FBSD_INST_SHARE_DIR)/applications
VBOX_FBSD_INST_SHAREICON_DIR := $(VBOX_FBSD_INST_SHARE_DIR)/pixmaps
VBOX_FBSD_INST_SHAREVBOX_DIR := $(VBOX_FBSD_INST_SHARE_DIR)/virtualbox

# Unset this to speed up things during makefile hacking.
VBOX_FBSD_INST_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT)

BLDDIRS  += $(VBOX_FBSD_INST_OUT_DIR) $(VBOX_FBSD_INST_STAGE_DIR)
PACKING  += $(PATH_BIN)/$(VBOX_FBSD_PACKAGE_NAME)

OTHER_CLEAN   += \
	$(addprefix $(VBOX_FBSD_INST_STAGE_DIR)/,\
		pkg_plist \
		LICENSE) \
	$(wildcard $(VBOX_FBSD_INST_OUT_DIR)/VirtualBox-*)

#
# FreeBSD installs.
#
INSTALLS += freebsd-misc
freebsd-misc_INST = bin/
freebsd-misc_MODE = a+r,u+w
freebsd-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_QTGUI),$(PATH_freebsd-misc)/virtualbox.desktop,)
freebsd-misc_CLEAN = $(PATH_freebsd-misc)/virtualbox.desktop

$$(PATH_freebsd-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+" --output $@ $<
endif



#
# The files residing in bin/ that we'll ship.
#

# Strip these binaries
VBOX_FBSD_STRIP_BIN = \
	VBoxDD.so \
	VBoxDD2.so \
	VBoxREM.so \
	VBoxDDU.so \
	VBoxVMM.so \
	$(if $(eq $(KBUILD_TARGET_ARCH),x86),VBoxREM32.so,) \
	$(if $(eq $(KBUILD_TARGET_ARCH),x86),VBoxREM64.so,) \
	VBoxRT.so \
	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL $(if $(VBOX_WITH_HARDENING),VBoxSDL.so),) \
	$(if $(VBOX_WITH_SHARED_CLIPBOARD), VBoxSharedClipboard.so,) \
	$(if $(VBOX_WITH_SHARED_FOLDERS), VBoxSharedFolders.so,) \
	$(if $(VBOX_WITH_GUEST_PROPS),VBoxGuestPropSvc.so,) \
	$(if $(VBOX_WITH_GUEST_CONTROL),VBoxGuestControlSvc.so,) \
	$(if $(VBOX_WITH_MAIN), \
		VBoxManage \
		VBoxNetDHCP $(if $(VBOX_WITH_HARDENING),VBoxNetDHCP.so,) \
		VBoxNetAdpCtl \
		VBoxSVC \
		VBoxXPCOM.so \
		VBoxXPCOMC.so \
		VBoxXPCOMIPCD \
		components/VBoxXPCOMIPCC.so \
		components/VBoxSVCM.so \
		components/VBoxC.so,) \
	$(if $(VBOX_WITH_CROGL),\
		VBoxOGLhostcrutil.so \
		VBoxOGLhosterrorspu.so \
		VBoxOGLrenderspu.so \
		VBoxTestOGL \
		VBoxSharedCrOpenGL.so,) \
	$(if $(VBOX_WITH_PYTHON),VBoxPython.so,)

# Do not remove relocation information of these binaries
VBOX_FBSD_STRIP_OBJ = \
	VBoxDD2GC.gc \
	VBoxDD2R0.r0 \
	VBoxDDGC.gc \
	VBoxDDR0.r0 \
	VMMGC.gc \
	VMMR0.r0

# Do not strip anything of these files
VBOX_FBSD_NO_STRIP = \
	$(if $(VBOX_OSE),,LICENSE) \
	$(if $(VBOX_WITH_MAIN), \
	  components/VBoxXPCOMBase.xpt \
	  components/VirtualBox_XPCOM.xpt) \
	vboxdrv.tar.gz

# EFI firmware
ifdef VBOX_WITH_EFIFW_PACKING
  VBOX_FBSD_NO_STRIP += \
	VBoxEFI32.fd \
        VBoxEFI64.fd
endif

# Symlinks residing in bin/
VBOX_FBSD_SYMLINKS = \
	$(if $(VBOX_WITH_MAIN), \
		VBoxManage \
		VBoxSVC) \
	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL,)

# Qt4 GUI
ifdef VBOX_WITH_QTGUI
 include $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
 VBOX_FBSD_STRIP_BIN += \
 	VBoxKeyboard.so \
 	VirtualBox \
 	$(if $(VBOX_WITH_HARDENING),VirtualBox.so) \
	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so)
 VBOX_FBSD_SYMLINKS += \
 	VirtualBox
 VBOX_FBSD_NO_STRIP += \
	$(VBOX_LICENSE_FILES) \
 	$(if $(VBOX_WITH_QT4_SUN),$(notdir $(wildcard $(PATH_BIN)/lib*VBox*)),) \
	$(if $(VBOX_WITH_QT4_SUN),accessible/libqtaccessiblewidgets.so,) \
 	$(foreach f,$(VBOX_APPROVED_GUI_LANGUAGES),nls/VirtualBox_$(f).qm nls/qt_$(f).qm)
 VBOX_FBSD_DESKTOP_FILE = \
	virtualbox.desktop
 VBOX_FBSD_ICON_FILE = \
	VBox.png
endif

# Guest Additions
ifdef VBOX_WITH_ADDITIONS_PACKING
 VBOX_FBSD_NO_STRIP += \
 	additions/VBoxGuestAdditions.iso
endif

# Documentation
ifdef VBOX_WITH_DOCS_PACKING
 VBOX_FBSD_NO_STRIP += \
	VirtualBox.chm UserManual.pdf \
	$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),VirtualBox_$(f).chm UserManual_$(f).pdf)
 VBOX_FBSD_STRIP_BIN += \
	$(if $(VBOX_WITH_KCHMVIEWER),kchmviewer,)
endif

# VRDP
ifdef VBOX_WITH_VRDP
 VBOX_FBSD_STRIP_BIN += \
	VBoxVRDP.so \
	VRDPAuth.so
 VBOX_FBSD_NO_STRIP += \
	rdesktop-vrdp.tar.gz
 ifdef VBOX_WITH_VRDP_RDESKTOP
#  VBOX_FBSD_NO_STRIP += \
#	rdesktop-vrdp-keymaps
  VBOX_FBSD_STRIP_BIN += \
	rdesktop-vrdp
 endif
endif

# Headless
ifdef VBOX_WITH_HEADLESS
 VBOX_FBSD_STRIP_BIN += \
	VBoxHeadless \
	$(if $(VBOX_WITH_HARDENING),VBoxHeadless.so)
 VBOX_FBSD_SYMLINKS += \
	VBoxHeadless
endif

# BFE
ifdef VBOX_WITH_VBOXBFE
 VBOX_FBSD_STRIP_BIN += \
	VBoxBFE \
	$(if $(VBOX_WITH_HARDENING),VBoxBFE.so)
 VBOX_FBSD_SYMLINKS += \
	VBoxBFE
endif

# Webservices
ifdef VBOX_WITH_WEBSERVICES
 VBOX_FBSD_STRIP_BIN += \
	vboxwebsrv \
	webtest
 VBOX_FBSD_SYMLINKS += \
	vboxwebsrv
endif

#
# All the bin files that goes into the archives.
#
VBOX_FBSD_ARCH_FILES := $(VBOX_FBSD_STRIP_BIN) $(VBOX_FBSD_STRIP_OBJ) $(VBOX_FBSD_NO_STRIP)

# Cleanup of the files we copy/symlink from bin.
OTHER_CLEAN += $(addprefix $(VBOX_FBSD_INST_LIBVBOX_DIR)/,$(VBOX_FBSD_ARCH_FILES))

#
# The module source archive
#
$(PATH_BIN)/vboxdrv.tar.gz: \
		src
	$(call MSG_TOOL, export_modules,,$@)
	$(QUIET)$(PATH_BIN)/export_modules $@

#
# The generic installer.
# @todo r=aeichner: Create pkg_plist dynamically based on the available features
#
$(PATH_BIN)/$(VBOX_FBSD_PACKAGE_NAME): \
		$(VBOX_VERSION_STAMP) \
		$(VBOX_FBSD_INST_OUT_DIR)/pkg_plist \
		$(addprefix $(VBOX_FBSD_INST_LIBVBOX_DIR)/,$(VBOX_FBSD_ARCH_FILES)) \
		$(addprefix $(VBOX_FBSD_INST_BIN_DIR)/,$(VBOX_FBSD_SYMLINKS)) \
		$(if $(VBOX_OSE),,$(VBOX_BRAND_LICENSE_TXT)) \
		$(if $(VBOX_WITH_QTGUI),$(addprefix $(VBOX_FBSD_INST_SHAREAPP_DIR)/,$(VBOX_FBSD_DESKTOP_FILE)),) \
		$(if $(VBOX_WITH_QTGUI),$(addprefix $(VBOX_FBSD_INST_SHAREICON_DIR)/,$(VBOX_FBSD_ICON_FILE)),) \
		$(VBOX_PATH_FBSD_INST_SRC)/postinstall.sh \
		$(VBOX_PATH_FBSD_INST_SRC)/postdeinstall.sh
	$(call MSG_TOOL,pkg_create,,$@)
	$(QUIET)$(RM) -f $@
	$(QUIET)pkg_create \
		-I $(VBOX_PATH_FBSD_INST_SRC)/postinstall.sh \
		-K $(VBOX_PATH_FBSD_INST_SRC)/postdeinstall.sh \
		-c $(VBOX_PATH_FBSD_INST_SRC)/pkg-comment \
		-d $(VBOX_PATH_FBSD_INST_SRC)/pkg-descr \
		-f $(VBOX_FBSD_INST_OUT_DIR)/pkg_plist \
		-p /usr/local \
		-s $(VBOX_FBSD_INST_STAGE_DIR) \
		$@
	$(QUIET)$(RM) -Rf $(VBOX_FBSD_INST_STAGE_DIR)

$(addprefix $(VBOX_FBSD_INST_LIBVBOX_DIR)/,$(VBOX_FBSD_STRIP_BIN)): \
		$(VBOX_FBSD_INST_LIBVBOX_DIR)/% : $(PATH_BIN)/%
	$(call MSG_INST_FILE,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
	$(QUIET)$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@

# pattern rule for striping and copying the VBOX_FBSD_STRIP_OBJ files to install/lib/virtualbox
$(addprefix $(VBOX_FBSD_INST_LIBVBOX_DIR)/,$(VBOX_FBSD_STRIP_OBJ)): \
		$(VBOX_FBSD_INST_LIBVBOX_DIR)/% : $(PATH_BIN)/%
	$(call MSG_INST_FILE,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
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_FBSD_NO_STRIP into lib/virtualbox/
$(addprefix $(VBOX_FBSD_INST_LIBVBOX_DIR)/,$(VBOX_FBSD_NO_STRIP)): \
		$(VBOX_FBSD_INST_LIBVBOX_DIR)/% : $(PATH_BIN)/%
	$(call MSG_INST_FILE,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
	$(QUIET)$(RM) -f $@
	$(QUIET)$(INSTALL) -m 0644 $< $@

# pattern rule for symlinking the VBOX_FBSD_SYMLINKS into bin/
$(addprefix $(VBOX_FBSD_INST_BIN_DIR)/,$(VBOX_FBSD_SYMLINKS)): \
		$(VBOX_FBSD_INST_BIN_DIR)/% : $(PATH_BIN)/%
	$(call MSG_INST_SYM,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
	$(QUIET)$(RM) -f $@
	$(QUIET)$(LN_SYMLINK) ../lib/virtualbox/$(notdir $@) $@

# pattern rule for copying the VBOX_FBSD_DESKTOP_FILE into share/applications/
$(addprefix $(VBOX_FBSD_INST_SHAREAPP_DIR)/,$(VBOX_FBSD_DESKTOP_FILE)): \
		$(VBOX_FBSD_INST_SHAREAPP_DIR)/% : $(PATH_BIN)/%
	$(call MSG_INST_FILE,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
	$(QUIET)$(RM) -f $@
	$(QUIET)$(INSTALL) -m 0644 $< $@

# pattern rule for copying the VBOX_FBSD_ICON_FILE into share/pixmaps/
$(addprefix $(VBOX_FBSD_INST_SHAREICON_DIR)/,$(VBOX_FBSD_ICON_FILE)): \
		$(VBOX_FBSD_INST_SHAREICON_DIR)/% : $(PATH_BIN)/%
	$(call MSG_INST_FILE,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
	$(QUIET)$(RM) -f $@
	$(QUIET)$(INSTALL) -m 0644 $< $@

# Create pkg_plist
$(VBOX_FBSD_INST_OUT_DIR)/pkg_plist: \
		$(VBOX_PATH_FBSD_INST_SRC)/pkg_plist
	$(call MSG_INST_FILE,$<,$@)
	$(QUIET)$(INSTALL) -d $(dir $@)
	$(QUIET)$(SED) \
		-e "s;_VBOX_REM_32BIT_MODULE_;$(if $(eq $(KBUILD_TARGET_ARCH),x86),VBoxREM32.so,);g" \
		-e "s;_VBOX_REM_64BIT_MODULE_;$(if $(eq $(KBUILD_TARGET_ARCH),x86),VBoxREM64.so,);g" \
		--output $@ \
		$<

include $(KBUILD_PATH)/subfooter.kmk