VirtualBox

source: vbox/trunk/tools/bin/gen-slickedit-workspace.sh@ 84943

Last change on this file since 84943 was 84937, checked in by vboxsync, 5 years ago

gen-slickedit-workspace.sh: Don't use obsolete kBuild environment variables.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 56.3 KB
Line 
1# !kmk_ash
2# $Id: gen-slickedit-workspace.sh 84937 2020-06-25 09:37:15Z vboxsync $
3## @file
4# Script for generating a SlickEdit workspace.
5#
6
7#
8# Copyright (C) 2009-2020 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#
20# Some constants.
21#
22MY_CAT="kmk_cat"
23MY_CP="kmk_cp"
24MY_MKDIR="kmk_mkdir"
25MY_MV="kmk_mv"
26MY_SED="kmk_sed"
27MY_RM="kmk_rm"
28MY_SLEEP="kmk_sleep"
29MY_EXPR="kmk_expr"
30MY_SVN="svn"
31
32#MY_SORT="kmk_cat"
33MY_SORT="sort"
34
35#
36# Globals.
37#
38MY_PROJECT_FILES=""
39MY_OUT_DIRS="\
40out/${KBUILD_TARGET}.${KBUILD_TARGET_ARCH}/${KBUILD_TYPE} \
41out/${KBUILD_TARGET}.${KBUILD_TARGET_ARCH}/debug \
42out/${KBUILD_TARGET}.${KBUILD_TARGET_ARCH}/release \
43out/linux.amd64/debug \
44out/linux.x86/debug \
45out/win.amd64/debug \
46out/win.x86/debug \
47out/darwin.amd64/debug \
48out/darwin.x86/debug \
49out/haiku.amd64/debug \
50out/haiku.x86/debug \
51out/solaris.amd64/debug \
52out/solaris.x86/debug";
53
54
55#
56# Parameters w/ defaults.
57#
58MY_ROOT_DIR=".."
59MY_OUT_DIR="SlickEdit"
60MY_PRJ_PRF="VBox-"
61MY_WS_NAME="VirtualBox.vpw"
62MY_DBG=""
63MY_WINDOWS_HOST=""
64MY_OPT_MINIMAL=""
65MY_OPT_USE_WILDCARDS="yes"
66
67#MY_KBUILD_PATH="${KBUILD_PATH}"
68#test -z "${MY_KBUILD_PATH}" && MY_KBUILD_PATH="${PATH_KBUILD}"
69#MY_KBUILD=""
70
71
72##
73# Gets the absolute path to an existing directory.
74#
75# @param $1 The path.
76my_abs_dir()
77{
78 if test -n "${PWD}"; then
79 MY_ABS_DIR=`cd ${MY_ROOT_DIR}/${1} && echo ${PWD}`
80
81 else
82 # old cygwin shell has no PWD and need adjusting.
83 MY_ABS_DIR=`cd ${MY_ROOT_DIR}/${1} && pwd | ${MY_SED} -e 's,^/cygdrive/\(.\)/,\1:/,'`
84 fi
85 if test -z "${MY_ABS_DIR}"; then
86 MY_ABS_DIR="${1}"
87 fi
88}
89
90##
91# Gets the file name part of a path.
92#
93# @param $1 The path.
94my_get_name()
95{
96 SAVED_IFS=$IFS
97 IFS=":/ "
98 set $1
99 while test $# -gt 1 -a -n "${2}";
100 do
101 shift;
102 done
103
104 IFS=$SAVED_IFS
105 #echo "$1"
106 export MY_GET_NAME=$1
107}
108
109##
110# Generate file entry for the specified file if it was found to be of interest.
111#
112# @param $1 The output file name base.
113# @param $2 The file name.
114# @param $3 Optional folder override.
115my_file()
116{
117 # sort and filter by file type.
118 case "$2" in
119 # drop these.
120 *.kup|*~|*.pyc|*.exe|*.sys|*.dll|*.o|*.obj|*.lib|*.a|*.ko)
121 return 0
122 ;;
123
124 # by prefix or directory component.
125 tst*|*/testcase/*)
126 MY_FOLDER="$1-Testcases.lst"
127 ;;
128
129 # by extension.
130 *.c|*.cpp|*.m|*.mm|*.pl|*.py|*.as|*.c.h|*.cpp.h|*.java)
131 MY_FOLDER="$1-Sources.lst"
132 ;;
133
134 *.h|*.hpp|*.mm)
135 MY_FOLDER="$1-Headers.lst"
136 ;;
137
138 *.asm|*.s|*.S|*.inc|*.mac)
139 MY_FOLDER="$1-Assembly.lst"
140 ;;
141
142 *)
143 MY_FOLDER="$1-Others.lst"
144 ;;
145 esac
146 if test -n "$3";
147 then
148 MY_FOLDER="$1-$3.lst"
149 fi
150
151 ## @todo only files which are in subversion.
152# if ${MY_SVN} info "${2}" > /dev/null 2>&1; then
153 my_get_name "${2}"
154 echo ' <!-- sortkey: '"${MY_GET_NAME}"' --> <F N="'"${2}"'"/>' >> "${MY_FOLDER}"
155# fi
156}
157
158##
159# Generate file entry for the specified file if it was found to be of interest.
160#
161# @param $1 The output file name base.
162# @param $2 The wildcard spec.
163# @param $3 Optional folder override.
164my_wildcard()
165{
166 if test -n "$3"; then
167 MY_FOLDER="$1-$3.lst"
168 else
169 MY_FOLDER="$1-All.lst"
170 fi
171 EXCLUDES="*.log;*.kup;*~;*.bak;*.bak?;*.pyc;*.exe;*.sys;*.dll;*.o;*.obj;*.lib;*.a;*.ko;*.class;*.cvsignore;*.done;*.project;*.actionScriptProperties;*.scm-settings;*.svnpatch.rej;*.svn-base;.svn/*;*.gitignore;*.gitattributes;*.gitmodules;*.swagger-codegen-ignore;*.png;*.bmp;*.jpg"
172 echo ' <F N="'"${2}"'/*" Recurse="1" Excludes="'"${EXCLUDES}"'"/>' >> "${MY_FOLDER}"
173}
174
175##
176# Generate file entries for the specified sub-directory tree.
177#
178# @param $1 The output filename.
179# @param $2 The sub-directory.
180# @param $3 Optional folder override.
181my_sub_tree()
182{
183 if test -n "$MY_DBG"; then echo "dbg: my_sub_tree: ${2}"; fi
184
185 # Skip .svn directories.
186 case "$2" in
187 */.svn|*/.svn)
188 return 0
189 ;;
190 esac
191
192 # Process the files in the directory.
193 for f in $2/*;
194 do
195 if test -d "${f}";
196 then
197 my_sub_tree "${1}" "${f}" "${3}"
198 else
199 my_file "${1}" "${f}" "${3}"
200 fi
201 done
202 return 0;
203}
204
205
206##
207# Generate folders for the specified directories and files.
208#
209# @param $1 The output (base) file name.
210# @param $2+ The files and directories to traverse.
211my_generate_folder()
212{
213 MY_FILE="$1"
214 shift
215
216 # Zap existing file collections.
217 > "${MY_FILE}-All.lst"
218 > "${MY_FILE}-Sources.lst"
219 > "${MY_FILE}-Headers.lst"
220 > "${MY_FILE}-Assembly.lst"
221 > "${MY_FILE}-Testcases.lst"
222 > "${MY_FILE}-Others.lst"
223
224 # Traverse the directories and files.
225 while test $# -ge 1 -a -n "${1}";
226 do
227 for f in ${MY_ROOT_DIR}/$1;
228 do
229 if test -d "${f}";
230 then
231 if test -z "${MY_OPT_USE_WILDCARDS}";
232 then
233 my_sub_tree "${MY_FILE}" "${f}"
234 else
235 case "${f}" in
236 ${MY_ROOT_DIR}/include*)
237 #my_sub_tree "${MY_FILE}" "${f}" "Headers"
238 my_wildcard "${MY_FILE}" "${f}" "Headers"
239 ;;
240 *) my_wildcard "${MY_FILE}" "${f}"
241 ;;
242 esac
243 fi
244 else
245 my_file "${MY_FILE}" "${f}"
246 fi
247 done
248 shift
249 done
250
251 # Generate the folders.
252 if test -s "${MY_FILE}-All.lst";
253 then
254 ${MY_SORT} "${MY_FILE}-All.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
255 fi
256 if test -s "${MY_FILE}-Sources.lst";
257 then
258 echo ' <Folder Name="Sources" Filters="*.c;*.cpp;*.cpp.h;*.c.h;*.m;*.mm;*.pl;*.py;*.as">' >> "${MY_FILE}"
259 ${MY_SORT} "${MY_FILE}-Sources.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
260 echo ' </Folder>' >> "${MY_FILE}"
261 fi
262 if test -s "${MY_FILE}-Headers.lst";
263 then
264 if test -z "${MY_OPT_USE_WILDCARDS}";
265 then
266 echo ' <Folder Name="Headers" Filters="*.h;*.hpp">' >> "${MY_FILE}"
267 else
268 echo ' <Folder Name="Headers" Filters="">' >> "${MY_FILE}"
269 fi
270 ${MY_SORT} "${MY_FILE}-Headers.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
271 echo ' </Folder>' >> "${MY_FILE}"
272 fi
273 if test -s "${MY_FILE}-Assembly.lst";
274 then
275 echo ' <Folder Name="Assembly" Filters="*.asm;*.s;*.S;*.inc;*.mac">' >> "${MY_FILE}"
276 ${MY_SORT} "${MY_FILE}-Assembly.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
277 echo ' </Folder>' >> "${MY_FILE}"
278 fi
279 if test -s "${MY_FILE}-Testcases.lst";
280 then
281 echo ' <Folder Name="Testcases" Filters="tst*;">' >> "${MY_FILE}"
282 ${MY_SORT} "${MY_FILE}-Testcases.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
283 echo ' </Folder>' >> "${MY_FILE}"
284 fi
285 if test -s "${MY_FILE}-Others.lst";
286 then
287 echo ' <Folder Name="Others" Filters="">' >> "${MY_FILE}"
288 ${MY_SORT} "${MY_FILE}-Others.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
289 echo ' </Folder>' >> "${MY_FILE}"
290 fi
291
292 # Cleanup
293 ${MY_RM} "${MY_FILE}-All.lst" "${MY_FILE}-Sources.lst" "${MY_FILE}-Headers.lst" "${MY_FILE}-Assembly.lst" \
294 "${MY_FILE}-Testcases.lst" "${MY_FILE}-Others.lst"
295}
296
297##
298# Function generating a project build config.
299#
300# @param $1 The project file name.
301# @param $2 Build config name.
302# @param $3 Extra kBuild command line options, variant 1.
303# @param $4 Extra kBuild command line options, variant 2.
304# @param $4+ Include directories.
305# @param $N --end-includes
306my_generate_project_config()
307{
308 MY_FILE="${1}";
309 MY_CFG_NAME="${2}";
310 MY_KMK_EXTRAS1="${3}";
311 MY_KMK_EXTRAS2="${4}";
312 MY_KMK_EXTRAS3="${5}";
313 MY_KMK_EXTRAS4="${6}";
314 shift; shift; shift; shift; shift; shift;
315
316 echo ' <Config Name="'"${MY_CFG_NAME}"'" OutputFile="" CompilerConfigName="Latest Version">' >> "${MY_FILE}"
317 echo ' <Menu>' >> "${MY_FILE}"
318
319 echo ' <Target Name="Compile" MenuCaption="&amp;Compile" CaptureOutputWith="ProcessBuffer"' >> "${MY_FILE}"
320 echo ' SaveOption="SaveCurrent" RunFromDir="%p" ClearProcessBuffer="1">' >> "${MY_FILE}"
321 echo -n ' <Exec CmdLine="'"${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS1}"' -C %p %n.o' >> "${MY_FILE}"
322 if test -n "${MY_KMK_EXTRAS2}"; then
323 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS2} -C %p %n.o" >> "${MY_FILE}"
324 fi
325 if test -n "${MY_KMK_EXTRAS3}"; then
326 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS3} -C %p %n.o" >> "${MY_FILE}"
327 fi
328 if test -n "${MY_KMK_EXTRAS4}"; then
329 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS4} -C %p %n.o" >> "${MY_FILE}"
330 fi
331 echo '"/>' >> "${MY_FILE}"
332 echo ' </Target>' >> "${MY_FILE}"
333
334 echo ' <Target Name="Build" MenuCaption="&amp;Build"CaptureOutputWith="ProcessBuffer"' >> "${MY_FILE}"
335 echo ' SaveOption="SaveWorkspaceFiles" RunFromDir="%rw" ClearProcessBuffer="1">' >> "${MY_FILE}"
336 echo -n ' <Exec CmdLine="'"${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS1}"' -C %rw' >> "${MY_FILE}"
337 if test -n "${MY_KMK_EXTRAS2}"; then
338 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS2} -C %rw" >> "${MY_FILE}"
339 fi
340 if test -n "${MY_KMK_EXTRAS3}"; then
341 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS3} -C %rw" >> "${MY_FILE}"
342 fi
343 if test -n "${MY_KMK_EXTRAS4}"; then
344 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS4} -C %rw" >> "${MY_FILE}"
345 fi
346 echo '"/>' >> "${MY_FILE}"
347 echo ' </Target>' >> "${MY_FILE}"
348
349 echo ' <Target Name="Rebuild" MenuCaption="&amp;Rebuild" CaptureOutputWith="ProcessBuffer"' >> "${MY_FILE}"
350 echo ' SaveOption="SaveWorkspaceFiles" RunFromDir="%rw" ClearProcessBuffer="1">' >> "${MY_FILE}"
351 echo -n ' <Exec CmdLine="'"${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS1}"' -C %rw' >> "${MY_FILE}"
352 if test -n "${MY_KMK_EXTRAS2}"; then
353 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS2} -C %rw rebuild" >> "${MY_FILE}"
354 fi
355 if test -n "${MY_KMK_EXTRAS3}"; then
356 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS3} -C %rw rebuild" >> "${MY_FILE}"
357 fi
358 if test -n "${MY_KMK_EXTRAS4}"; then
359 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS4} -C %rw rebuild" >> "${MY_FILE}"
360 fi
361 echo '"/>' >> "${MY_FILE}"
362 echo ' </Target>' >> "${MY_FILE}"
363
364 #echo ' <Target Name="Debug" MenuCaption="&amp;Debug" SaveOption="SaveNone" RunFromDir="%rw">' >> "${MY_FILE}"
365 #echo ' <Exec/>' >> "${MY_FILE}"
366 #echo ' </Target>' >> "${MY_FILE}"
367 #echo ' <Target Name="Execute" MenuCaption="E&amp;xecute" SaveOption="SaveNone" RunFromDir="%rw">'>> "${MY_FILE}"
368 #echo ' <Exec/>' >> "${MY_FILE}"
369 #echo ' </Target>' >> "${MY_FILE}"
370 echo ' </Menu>' >> "${MY_FILE}"
371
372 #
373 # Include directories.
374 #
375 echo ' <Includes>' >> "${MY_FILE}"
376 while test $# -ge 1 -a "${1}" != "--end-includes";
377 do
378 for f in $1;
379 do
380 my_abs_dir ${f}
381 echo ' <Include Dir="'"${MY_ABS_DIR}/"'"/>' >> "${MY_FILE}"
382 done
383 shift
384 done
385 shift
386 echo ' </Includes>' >> "${MY_FILE}"
387 echo ' </Config>' >> "${MY_FILE}"
388}
389
390
391##
392# Function generating a project.
393#
394# @param $1 The project file name.
395# @param $2 The project working directory.
396# @param $3 Dummy separator.
397# @param $4+ Include directories.
398# @param $N --end-includes
399# @param $N+1 Directory sub-trees and files to include in the project.
400#
401my_generate_project()
402{
403 MY_FILE="${MY_PRJ_PRF}${1}.vpj";
404 echo "Generating ${MY_FILE}..."
405 MY_WRK_DIR="${2}"
406 shift
407 shift
408 shift
409
410 # Add it to the project list for workspace construction later on.
411 MY_PROJECT_FILES="${MY_PROJECT_FILES} ${MY_FILE}"
412
413
414 #
415 # Generate the head bits.
416 #
417 echo '<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">' > "${MY_FILE}"
418 echo '<Project' >> "${MY_FILE}"
419 echo ' Version="10.0"' >> "${MY_FILE}"
420 echo ' VendorName="SlickEdit"' >> "${MY_FILE}"
421 echo ' VCSProject="Subversion:"' >> "${MY_FILE}"
422# echo ' Customized="1"' >> "${MY_FILE}"
423# echo ' WorkingDir="."' >> "${MY_FILE}"
424 my_abs_dir "${MY_WRK_DIR}" >> "${MY_FILE}"
425 echo ' WorkingDir="'"${MY_ABS_DIR}"'"' >> "${MY_FILE}"
426 echo ' >' >> "${MY_FILE}"
427 my_generate_project_config "${MY_FILE}" "Default" "" "" "" "" $*
428 my_generate_project_config "${MY_FILE}" "Debug + hardening" "KBUILD_TYPE=debug VBOX_WITH_HARDENING=1" "" "" "" $*
429 my_generate_project_config "${MY_FILE}" "Release + hardening" "KBUILD_TYPE=release VBOX_WITH_HARDENING=1" "" "" "" $*
430 my_generate_project_config "${MY_FILE}" "Debug+Release + hardening" \
431 "KBUILD_TYPE=debug VBOX_WITH_HARDENING=1" \
432 "KBUILD_TYPE=release VBOX_WITH_HARDENING=1" \
433 "" "" $*
434 my_generate_project_config "${MY_FILE}" "Debug w/o hardening" "KBUILD_TYPE=debug VBOX_WITHOUT_HARDENING=1" "" "" $*
435 my_generate_project_config "${MY_FILE}" "Release w/o hardening" "KBUILD_TYPE=release VBOX_WITHOUT_HARDENING=1" "" "" $*
436 my_generate_project_config "${MY_FILE}" "Debug+Release w/o hardening" \
437 "KBUILD_TYPE=debug VBOX_WITHOUT_HARDENING=1" \
438 "KBUILD_TYPE=release VBOX_WITHOUT_HARDENING=1" \
439 "" "" $*
440 my_generate_project_config "${MY_FILE}" "Debug+Release with and without hardening" \
441 "KBUILD_TYPE=debug VBOX_WITH_HARDENING=1" \
442 "KBUILD_TYPE=release VBOX_WITH_HARDENING=1" \
443 "KBUILD_TYPE=debug VBOX_WITHOUT_HARDENING=1" \
444 "KBUILD_TYPE=release VBOX_WITHOUT_HARDENING=1" \
445 $*
446
447 while test $# -ge 1 -a "${1}" != "--end-includes";
448 do
449 shift;
450 done;
451 shift;
452
453 #
454 # Process directories+files and create folders.
455 #
456 echo ' <Files>' >> "${MY_FILE}"
457 my_generate_folder "${MY_FILE}" $*
458 echo ' </Files>' >> "${MY_FILE}"
459
460 #
461 # The tail.
462 #
463 echo '</Project>' >> "${MY_FILE}"
464
465 return 0
466}
467
468
469##
470# Generate the workspace
471#
472my_generate_workspace()
473{
474 MY_FILE="${MY_WS_NAME}"
475 echo "Generating ${MY_FILE}..."
476 echo '<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">' > "${MY_FILE}"
477 echo '<Workspace Version="10.0" VendorName="SlickEdit">' >> "${MY_FILE}"
478 echo ' <Projects>' >> "${MY_FILE}"
479 for i in ${MY_PROJECT_FILES};
480 do
481 echo ' <Project File="'"${i}"'" />' >> "${MY_FILE}"
482 done
483 echo ' </Projects>' >> "${MY_FILE}"
484 echo '</Workspace>' >> "${MY_FILE}"
485 return 0;
486}
487
488
489##
490# Generate stuff
491#
492my_generate_usercpp_h()
493{
494 #
495 # Probe the slickedit user config, picking the most recent version.
496 #
497 if test -z "${MY_SLICK_CONFIG}"; then
498 if test -d "${HOME}/Library/Application Support/SlickEdit"; then
499 MY_SLICKDIR_="${HOME}/Library/Application Support/SlickEdit"
500 MY_USERCPP_H="unxcpp.h"
501 MY_VSLICK_DB="vslick.sta" # was .stu earlier, 24 is using .sta.
502 elif test -d "${HOMEDRIVE}${HOMEPATH}/Documents/My SlickEdit Config"; then
503 MY_SLICKDIR_="${HOMEDRIVE}${HOMEPATH}/Documents/My SlickEdit Config"
504 MY_USERCPP_H="usercpp.h"
505 MY_VSLICK_DB="vslick.sta"
506 else
507 MY_SLICKDIR_="${HOME}/.slickedit"
508 MY_USERCPP_H="unxcpp.h"
509 MY_VSLICK_DB="vslick.stu"
510 fi
511 else
512 MY_SLICKDIR_="${MY_SLICK_CONFIG}"
513 if test -n "${MY_WINDOWS_HOST}"; then
514 MY_USERCPP_H="usercpp.h"
515 MY_VSLICK_DB="vslick.sta"
516 else
517 MY_USERCPP_H="unxcpp.h"
518 MY_VSLICK_DB="vslick.stu"
519 fi
520 # MacOS: Implement me!
521 fi
522
523 MY_VER_NUM="0"
524 MY_VER="0.0.0"
525 for subdir in "${MY_SLICKDIR_}/"*;
526 do
527 if test -f "${subdir}/${MY_USERCPP_H}" -o -f "${subdir}/${MY_VSLICK_DB}"; then
528 MY_CUR_VER_NUM=0
529 MY_CUR_VER=`echo "${subdir}" | ${MY_SED} -e 's,^.*/,,g'`
530
531 # Convert the dotted version number to an integer, checking that
532 # it is all numbers in the process.
533 set `echo "${MY_CUR_VER}" | ${MY_SED} 's/\./ /g' `
534 i=24010000 # == 70*70*70*70; max major version 89.
535 while test $# -gt 0;
536 do
537 if ! ${MY_EXPR} "$1" + 1 > /dev/null 2> /dev/null; then
538 MY_CUR_VER_NUM=0;
539 break
540 fi
541 if test "$i" -gt 0; then
542 MY_CUR_VER_NUM=$((${MY_CUR_VER_NUM} + $1 * $i))
543 i=$(($i / 70))
544 fi
545 shift
546 done
547
548 # More recent that what we have?
549 if test "${MY_CUR_VER_NUM}" -gt "${MY_VER_NUM}"; then
550 MY_VER_NUM="${MY_CUR_VER_NUM}"
551 MY_VER="${MY_CUR_VER}"
552 fi
553 fi
554 done
555
556 MY_SLICKDIR="${MY_SLICKDIR_}/${MY_VER}"
557 MY_USERCPP_H_FULL="${MY_SLICKDIR}/${MY_USERCPP_H}"
558 if test -d "${MY_SLICKDIR}"; then
559 echo "Found SlickEdit v${MY_VER} preprocessor file: ${MY_USERCPP_H_FULL}"
560 else
561 echo "Failed to locate SlickEdit preprocessor file. You need to manually merge ${MY_USERCPP_H}."
562 MY_USERCPP_H_FULL=""
563 fi
564
565 # Generate our
566 MY_FILE="${MY_USERCPP_H}"
567 ${MY_CAT} > ${MY_FILE} <<EOF
568#define IN_SLICKEDIT
569#define RT_C_DECLS_BEGIN
570#define RT_C_DECLS_END
571#define RT_NO_THROW
572#define RT_NOEXCEPT
573#define RT_OVERRIDE
574#define RT_THROW(type) throw(type)
575#define RT_GCC_EXTENSION
576#define RT_COMPILER_GROKS_64BIT_BITFIELDS
577#define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
578
579#define ATL_NO_VTABLE
580#define BEGIN_COM_MAP(a)
581#define COM_INTERFACE_ENTRY(a)
582#define COM_INTERFACE_ENTRY2(a,b)
583#define COM_INTERFACE_ENTRY3(a,b,c)
584#define COM_INTERFACE_ENTRY4(a,b,c,d)
585#define END_COM_MAP(a)
586
587#define COM_DECL_READONLY_ENUM_AND_COLLECTION(a)
588#define COMGETTER(n) n
589#define COMSETTER(n) n
590#define ComSafeArrayIn(t,a) t a[]
591#define ComSafeArrayOut(t,a) t * a[]
592#define DECLARE_CLASSFACTORY(a)
593#define DECLARE_CLASSFACTORY_SINGLETON(a)
594#define DECLARE_REGISTRY_RESOURCEID(a)
595#define DECLARE_NOT_AGGREGATABLE(a)
596#define DECLARE_PROTECT_FINAL_CONSTRUCT(a)
597#define DECLARE_EMPTY_CTOR_DTOR(a) a(); ~a();
598#define DEFINE_EMPTY_CTOR_DTOR(a) a::a() {} a::~a() {}
599#define NS_DECL_ISUPPORTS
600#define NS_IMETHOD virtual nsresult
601#define NS_IMETHOD_(type) virtual type
602#define NS_IMETHODIMP nsresult
603#define NS_IMETHODIMP_(type) type
604#define PARSERS_EXPORT
605EOF
606 if test -n "${MY_WINDOWS_HOST}"; then
607 ${MY_CAT} >> ${MY_FILE} <<EOF
608#define COM_STRUCT_OR_CLASS(I) struct I
609#define STDMETHOD(m) virtual HRESULT m
610#define STDMETHOD_(type,m) virtual type m
611#define STDMETHODIMP HRESULT
612#define STDMETHODIMP_(type) type
613EOF
614 else
615 ${MY_CAT} >> ${MY_FILE} <<EOF
616#define COM_STRUCT_OR_CLASS(I) class I
617#define STDMETHOD(m) virtual nsresult m
618#define STDMETHOD_(type,m) virtual type m
619#define STDMETHODIMP nsresult
620#define STDMETHODIMP_(type) type
621EOF
622 fi
623 ${MY_CAT} >> ${MY_FILE} <<EOF
624#define VBOX_SCRIPTABLE(a) public a
625#define VBOX_SCRIPTABLE_IMPL(a)
626#define VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(a)
627
628#define CTX_SUFF(var) var##R3
629#define CTXAllSUFF(var) var##R3
630#define CTXSUFF(var) var##HC
631#define OTHERCTXSUFF(var) var##GC
632#define CTXALLMID(first, last) first##R3##last
633#define CTXMID(first, last) first##HC##last
634#define OTHERCTXMID(first, last) first##GC##last
635#define CTXTYPE(GCType, R3Type, R0Type) R3Type
636#define RCTYPE(RCType, HCType) RCType
637#define GCTYPE(GCType, HCType) GCType
638#define RCPTRTYPE(RCType) RCType
639#define GCPTRTYPE(GCType) GCType
640#define HCPTRTYPE(HCType) HCType
641#define R3R0PTRTYPE(HCType) HCType
642#define R0PTRTYPE(R3Type) R3Type
643#define R3PTRTYPE(R0Type) R0Type
644#define RT_SRC_POS __FILE__, __LINE__, __PRETTY_FUNCTION__
645#define RT_SRC_POS_DECL const char *pszFile, unsigned iLine, const char *pszFunction
646#define RT_SRC_POS_ARGS pszFile, iLine, pszFunction
647#define RTCALL
648#define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)
649#define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)
650#define DECLINLINE(type) inline type
651#define DECL_FORCE_INLINE(type) inline type
652#define DECL_INVALID(type) type
653
654#define PDMDEVINSINT_DECLARED 1
655#define VBOX_WITH_HGCM 1
656#define VBOXCALL
657
658#define PGM_ALL_CB_DECL(type) type
659#define PGM_ALL_CB2_DECL(type) type
660#define PGM_CTX(a,b) b
661#define PGM_CTX3(a,b,c) c
662#define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name)
663#define PGM_GST_NAME_REAL(name) PGM_CTX3(name)
664#define PGM_GST_NAME_PROT(name) PGM_CTX3(pgm,GstProt,name)
665#define PGM_GST_NAME_32BIT(name) PGM_CTX3(pgm,Gst32Bit,name)
666#define PGM_GST_NAME_PAE(name) PGM_CTX3(pgm,GstPAE,name)
667#define PGM_GST_NAME_AMD64(name) PGM_CTX3(pgm,GstAMD64,name)
668#define PGM_GST_DECL(type, name) type PGM_GST_NAME(name)
669#define PGM_SHW_NAME(name) PGM_GST_NAME_AMD64(name)
670#define PGM_SHW_NAME_32BIT(name) PGM_CTX3(pgm,Shw32Bit,name)
671#define PGM_SHW_NAME_PAE(name) PGM_CTX3(pgm,ShwPAE,name)
672#define PGM_SHW_NAME_AMD64(name) PGM_CTX3(pgm,ShwAMD64,name)
673#define PGM_SHW_NAME_NESTED(name) PGM_CTX3(pgm,ShwNested,name)
674#define PGM_SHW_NAME_EPT(name) PGM_CTX3(pgm,ShwEPT,name)
675#define PGM_SHW_DECL(type, name) type PGM_SHW_NAME(name)
676#define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64(name)
677#define PGM_BTH_NAME_32BIT_REAL(name) PGM_CTX3(pgm,Bth,name)
678#define PGM_BTH_NAME_32BIT_PROT(name) PGM_CTX3(pgm,Bth,name)
679#define PGM_BTH_NAME_32BIT_32BIT(name) PGM_CTX3(pgm,Bth,name)
680#define PGM_BTH_NAME_PAE_REAL(name) PGM_CTX3(pgm,Bth,name)
681#define PGM_BTH_NAME_PAE_PROT(name) PGM_CTX3(pgm,Bth,name)
682#define PGM_BTH_NAME_PAE_32BIT(name) PGM_CTX3(pgm,Bth,name)
683#define PGM_BTH_NAME_PAE_PAE(name) PGM_CTX3(pgm,Bth,name)
684#define PGM_BTH_NAME_AMD64_PROT(name) PGM_CTX3(pgm,Bth,name)
685#define PGM_BTH_NAME_AMD64_AMD64(name) PGM_CTX3(pgm,Bth,name)
686#define PGM_BTH_NAME_NESTED_REAL(name) PGM_CTX3(pgm,Bth,name)
687#define PGM_BTH_NAME_NESTED_PROT(name) PGM_CTX3(pgm,Bth,name)
688#define PGM_BTH_NAME_NESTED_32BIT(name) PGM_CTX3(pgm,Bth,name)
689#define PGM_BTH_NAME_NESTED_PAE(name) PGM_CTX3(pgm,Bth,name)
690#define PGM_BTH_NAME_NESTED_AMD64(name) PGM_CTX3(pgm,Bth,name)
691#define PGM_BTH_NAME_EPT_REAL(name) PGM_CTX3(pgm,Bth,name)
692#define PGM_BTH_NAME_EPT_PROT(name) PGM_CTX3(pgm,Bth,name)
693#define PGM_BTH_NAME_EPT_32BIT(name) PGM_CTX3(pgm,Bth,name)
694#define PGM_BTH_NAME_EPT_PAE(name) PGM_CTX3(pgm,Bth,name)
695#define PGM_BTH_NAME_EPT_AMD64(name) PGM_CTX3(pgm,Bth,name)
696#define PGM_BTH_DECL(type, name) type PGM_BTH_NAME(name)
697
698#define FNIEMOP_STUB(a_Name) VBOXSTRICTRC a_Name(PIEMCPU pIemCpu) { return VERR_NOT_IMPLEMENTED; }
699#define FNIEMOP_DEF(a_Name) VBOXSTRICTRC a_Name(PIEMCPU pIemCpu)
700#define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0)
701#define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0, a_Type1 a_Name1)
702#define FNIEMOPRM_DEF(a_Name) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, uint8_t bBm)
703#define IEM_CIMPL_DEF_0(a_Name) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu)
704#define IEM_CIMPL_DEF_1(a_Name, a_Type0, a_Name0) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, , a_Type0 a_Name0)
705#define IEM_CIMPL_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, , a_Type0 a_Name0, a_Type1 a_Name1)
706#define IEM_CIMPL_DEF_3(a_Name, a_Type0, a_Name0, a_Type1, a_Name1, a_Type2, a_Name2) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, , a_Type0 a_Name0, a_Type1 a_Name1, , a_Type2 a_Name2)
707#define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) a_RetType a_Name a_ArgList
708#define IEM_MC_LOCAL(a_Type, a_Name) a_Type a_Name
709#define IEM_MC_ARG(a_Type, a_Name, a_iArg) a_Type a_Name
710#define IEM_MC_ARG_CONST(a_Type, a_Name, a_Value, a_iArg) a_Type const a_Name = a_Value
711#define IEM_STATIC
712
713#define RTASN1_IMPL_GEN_SEQ_OF_TYPEDEFS_AND_PROTOS(a_SeqOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) typedef struct a_SeqOfType { RTASN1SEQUENCECORE SeqCore; RTASN1ALLOCATION Allocation; uint32_t cItems; RT_CONCAT(P,a_ItemType) paItems; } a_SeqOfType; typedef a_SeqOfType *P##a_SeqOfType, const *PC##a_SeqOfType; int a_ImplExtNm##_DecodeAsn1(struct RTASN1CURSOR *pCursor, uint32_t fFlags, P##a_SeqOfType pThis, const char *pszErrorTag); int a_ImplExtNm##_Compare(PC##a_SeqOfType pLeft, PC##a_SeqOfType pRight)
714#define RTASN1_IMPL_GEN_SET_OF_TYPEDEFS_AND_PROTOS(a_SetOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) typedef struct a_SetOfType { RTASN1SETCORE SetCore; RTASN1ALLOCATION Allocation; uint32_t cItems; RT_CONCAT(P,a_ItemType) paItems; } a_SetOfType; typedef a_SetOfType *P##a_SetOfType, const *PC##a_SetOfType; int a_ImplExtNm##_DecodeAsn1(struct RTASN1CURSOR *pCursor, uint32_t fFlags, P##a_SetOfType pThis, const char *pszErrorTag); int a_ImplExtNm##_Compare(PC##a_SetOfType pLeft, PC##a_SetOfType pRight)
715#define RTASN1TYPE_STANDARD_PROTOTYPES_NO_GET_CORE(a_TypeNm, a_DeclMacro, a_ImplExtNm) int a_ImplExtNm##_Init(P##a_TypeNm pThis, PCRTASN1ALLOCATORVTABLE pAllocator); int a_ImplExtNm##_Clone(P##a_TypeNm pThis, PC##a_TypeNm) pSrc, PCRTASN1ALLOCATORVTABLE pAllocator); void a_ImplExtNm##_Delete(P##a_TypeNm pThis); int a_ImplExtNm##_Enum(P##a_TypeNm pThis, PFNRTASN1ENUMCALLBACK pfnCallback, uint32_t uDepth, void *pvUser); int a_ImplExtNm##_Compare(PC##a_TypeNm) pLeft, PC##a_TypeNm pRight); int a_ImplExtNm##_DecodeAsn1(PRTASN1CURSOR pCursor, uint32_t fFlags, P##a_TypeNm pThis, const char *pszErrorTag); int a_ImplExtNm##_CheckSanity(PC##a_TypeNm pThis, uint32_t fFlags, PRTERRINFO pErrInfo, const char *pszErrorTag)
716#define RTASN1TYPE_STANDARD_PROTOTYPES(a_TypeNm, a_DeclMacro, a_ImplExtNm, a_Asn1CoreNm) inline PRTASN1CORE a_ImplExtNm##_GetAsn1Core(PC##a_TypeNm pThis) { return (PRTASN1CORE)&pThis->a_Asn1CoreNm; } inline bool a_ImplExtNm##_IsPresent(PC##a_TypeNm pThis) { return pThis && RTASN1CORE_IS_PRESENT(&pThis->a_Asn1CoreNm); } RTASN1TYPE_STANDARD_PROTOTYPES_NO_GET_CORE(a_TypeNm, a_DeclMacro, a_ImplExtNm)
717
718#define BS3_DECL(type) type
719#define BS3_DECL_CALLBACK(type) type
720#define TMPL_NM(name) name##_mmm
721#define TMPL_FAR_NM(name) name##_mmm_far
722#define BS3_CMN_NM(name) name
723#define BS3_CMN_FAR_NM(name) name
724#define BS3_CMN_FN_NM(name) name
725#define BS3_DATA_NM(name) name
726#define BS3_FAR
727#define BS3_FAR_CODE
728#define BS3_FAR_DATA
729#define BS3_NEAR
730#define BS3_NEAR_CODE
731#define BS3_CMN_PROTO_STUB(a_RetType, a_Name, a_Params) a_RetType a_Name a_Params
732#define BS3_CMN_PROTO_NOSB(a_RetType, a_Name, a_Params) a_RetType a_Name a_Params
733#define BS3_CMN_DEF( a_RetType, a_Name, a_Params) a_RetType a_Name a_Params
734#define BS3_MODE_PROTO_STUB(a_RetType, a_Name, a_Params) \
735 a_RetType a_Name##_mmm a_Params; \
736 a_RetType a_Name##_mmm_far a_Params; \
737 a_RetType a_Name##_rm a_Params; \
738 a_RetType a_Name##_pe16 a_Params; \
739 a_RetType a_Name##_pe16_32 a_Params; \
740 a_RetType a_Name##_pe16_v86 a_Params; \
741 a_RetType a_Name##_pe32 a_Params; \
742 a_RetType a_Name##_pe32_16 a_Params; \
743 a_RetType a_Name##_pev86 a_Params; \
744 a_RetType a_Name##_pp16 a_Params; \
745 a_RetType a_Name##_pp16_32 a_Params; \
746 a_RetType a_Name##_pp16_v86 a_Params; \
747 a_RetType a_Name##_pp32 a_Params; \
748 a_RetType a_Name##_pp32_16 a_Params; \
749 a_RetType a_Name##_ppv86 a_Params; \
750 a_RetType a_Name##_pae16 a_Params; \
751 a_RetType a_Name##_pae16_32 a_Params; \
752 a_RetType a_Name##_pae16_v86 a_Params; \
753 a_RetType a_Name##_pae32 a_Params; \
754 a_RetType a_Name##_pae32_16 a_Params; \
755 a_RetType a_Name##_paev86 a_Params; \
756 a_RetType a_Name##_lm16 a_Params; \
757 a_RetType a_Name##_lm32 a_Params; \
758 a_RetType a_Name##_lm64 a_Params; \
759 a_RetType a_Name##_rm_far a_Params; \
760 a_RetType a_Name##_pe16_far a_Params; \
761 a_RetType a_Name##_pe16_v86_far a_Params; \
762 a_RetType a_Name##_pe32_16_far a_Params; \
763 a_RetType a_Name##_pev86_far a_Params; \
764 a_RetType a_Name##_pp16_far a_Params; \
765 a_RetType a_Name##_pp16_v86_far a_Params; \
766 a_RetType a_Name##_pp32_16_far a_Params; \
767 a_RetType a_Name##_ppv86_far a_Params; \
768 a_RetType a_Name##_pae16_far a_Params; \
769 a_RetType a_Name##_pae16_v86_far a_Params; \
770 a_RetType a_Name##_pae32_16_far a_Params; \
771 a_RetType a_Name##_paev86_far a_Params; \
772 a_RetType a_Name##_lm16_far a_Params
773#define BS3_MODE_PROTO_NOSB(a_RetType, a_Name, a_Params) \
774 a_RetType a_Name##_mmm a_Params; \
775 a_RetType a_Name##_mmm_far a_Params; \
776 a_RetType a_Name##_rm a_Params; \
777 a_RetType a_Name##_pe16 a_Params; \
778 a_RetType a_Name##_pe16_32 a_Params; \
779 a_RetType a_Name##_pe16_v86 a_Params; \
780 a_RetType a_Name##_pe32 a_Params; \
781 a_RetType a_Name##_pe32_16 a_Params; \
782 a_RetType a_Name##_pev86 a_Params; \
783 a_RetType a_Name##_pp16 a_Params; \
784 a_RetType a_Name##_pp16_32 a_Params; \
785 a_RetType a_Name##_pp16_v86 a_Params; \
786 a_RetType a_Name##_pp32 a_Params; \
787 a_RetType a_Name##_pp32_16 a_Params; \
788 a_RetType a_Name##_ppv86 a_Params; \
789 a_RetType a_Name##_pae16 a_Params; \
790 a_RetType a_Name##_pae16_32 a_Params; \
791 a_RetType a_Name##_pae16_v86 a_Params; \
792 a_RetType a_Name##_pae32 a_Params; \
793 a_RetType a_Name##_pae32_16 a_Params; \
794 a_RetType a_Name##_paev86 a_Params; \
795 a_RetType a_Name##_lm16 a_Params; \
796 a_RetType a_Name##_lm32 a_Params; \
797 a_RetType a_Name##_lm64 a_Params; \
798 a_RetType a_Name##_rm_far a_Params; \
799 a_RetType a_Name##_pe16_far a_Params; \
800 a_RetType a_Name##_pe16_v86_far a_Params; \
801 a_RetType a_Name##_pe32_16_far a_Params; \
802 a_RetType a_Name##_pev86_far a_Params; \
803 a_RetType a_Name##_pp16_far a_Params; \
804 a_RetType a_Name##_pp16_v86_far a_Params; \
805 a_RetType a_Name##_pp32_16_far a_Params; \
806 a_RetType a_Name##_ppv86_far a_Params; \
807 a_RetType a_Name##_pae16_far a_Params; \
808 a_RetType a_Name##_pae16_v86_far a_Params; \
809 a_RetType a_Name##_pae32_16_far a_Params; \
810 a_RetType a_Name##_paev86_far a_Params; \
811 a_RetType a_Name##_lm16_far a_Params
812#define BS3_MODE_EXPAND_EXTERN_DATA16(a_VarType, a_VarName, a_Suffix) \
813 extern a_VarType a_VarName##_rm a_Suffix; \
814 extern a_VarType a_VarName##_pe16 a_Suffix; \
815 extern a_VarType a_VarName##_pe16_32 a_Suffix; \
816 extern a_VarType a_VarName##_pe16_v86 a_Suffix; \
817 extern a_VarType a_VarName##_pe32 a_Suffix; \
818 extern a_VarType a_VarName##_pe32_16 a_Suffix; \
819 extern a_VarType a_VarName##_pev86 a_Suffix; \
820 extern a_VarType a_VarName##_pp16 a_Suffix; \
821 extern a_VarType a_VarName##_pp16_32 a_Suffix; \
822 extern a_VarType a_VarName##_pp16_v86 a_Suffix; \
823 extern a_VarType a_VarName##_pp32 a_Suffix; \
824 extern a_VarType a_VarName##_pp32_16 a_Suffix; \
825 extern a_VarType a_VarName##_ppv86 a_Suffix; \
826 extern a_VarType a_VarName##_pae16 a_Suffix; \
827 extern a_VarType a_VarName##_pae16_32 a_Suffix; \
828 extern a_VarType a_VarName##_pae16_v86 a_Suffix; \
829 extern a_VarType a_VarName##_pae32 a_Suffix; \
830 extern a_VarType a_VarName##_pae32_16 a_Suffix; \
831 extern a_VarType a_VarName##_paev86 a_Suffix; \
832 extern a_VarType a_VarName##_lm16 a_Suffix; \
833 extern a_VarType a_VarName##_lm32 a_Suffix; \
834 extern a_VarType a_VarName##_lm64 a_Suffix
835
836EOF
837
838 MY_HDR_FILES=` echo ${MY_ROOT_DIR}/include/VBox/*.h ${MY_ROOT_DIR}/include/VBox/vmm/*.h \
839 | ${MY_SED} -e 's,${MY_ROOT_DIR}/include/VBox/err.h,,' `
840 MY_HDR_FILES="${MY_HDR_FILES} ${MY_ROOT_DIR}/include/iprt/cdefs.h"
841 ${MY_SED} \
842 -e '/__cdecl/d' \
843 -e '/^ *# *define.*DECL/!d' \
844 -e '/DECLS/d' \
845 -e '/DECLARE_CLS_/d' \
846 -e '/_SRC_POS_DECL/d' \
847 -e '/declspec/d' \
848 -e '/__attribute__/d' \
849 -e 's/# */#/g' \
850 -e 's/ */ /g' \
851 -e '/ DECLEXPORT_CLASS/d' \
852 -e 's/ *VBOXCALL//' \
853 -e 's/ *RTCALL//' \
854 -e '/ DECLASM(type) type/d' \
855 -e '/define *DECL..CALLBACKMEMBER(type[^)]*) *RT/d' \
856 -e '/define *DECLINLINE(type)/d' \
857 -e '/define *DECL_FORCE_INLINE(type)/d' \
858 -e '/ *DECL_INVALID(/d' \
859 \
860 -e 's/(type) DECLHIDDEN(type)/(type) type/' \
861 -e 's/(type) DECLEXPORT(type)/(type) type/' \
862 -e 's/(type) DECLIMPORT(type)/(type) type/' \
863 -e 's/(a_Type) DECLHIDDEN(a_Type)/(a_Type) a_Type/' \
864 -e 's/(a_Type) DECLEXPORT(a_Type)/(a_Type) a_Type/' \
865 -e 's/(a_Type) DECLIMPORT(a_Type)/(a_Type) a_Type/' \
866 \
867 --append "${MY_FILE}" \
868 ${MY_HDR_FILES}
869
870 ${MY_CAT} "${MY_FILE}" \
871 | ${MY_SED} -e 's/_/\x1F/g' -e 's/(/\x1E/g' -e 's/[[:space:]][[:space:]]*/\x1C/g' \
872 | ${MY_SED} -e 's/\x1F/_/g' -e 's/\x1E/(/g' -e 's/\x1C/ /g' \
873 | ${MY_SORT} \
874 | ${MY_SED} -e '/#define/s/$/ \/\/ vbox/' --output "${MY_FILE}.2"
875
876 # Eliminate duplicates.
877 > "${MY_FILE}.3"
878 exec < "${MY_FILE}.2"
879 MY_PREV_DEFINE=""
880 while read MY_LINE;
881 do
882 MY_DEFINE=`echo "${MY_LINE}" | ${MY_SED} -e 's/^#define \([^ ()]*\).*$/\1/' `
883 if test "${MY_DEFINE}" != "${MY_PREV_DEFINE}"; then
884 MY_PREV_DEFINE=${MY_DEFINE}
885 echo "${MY_LINE}" >> "${MY_FILE}.3"
886 fi
887 done
888
889 # Append non-vbox bits from the current user config.
890 if test -n "${MY_USERCPP_H_FULL}" -a -f "${MY_USERCPP_H_FULL}"; then
891 ${MY_SED} -e '/ \/\/ vbox$/d' -e '/^[[:space:]]*$/d' --append "${MY_FILE}.3" "${MY_USERCPP_H_FULL}"
892 fi
893
894 # Finalize the file (sort + blank lines).
895 ${MY_CAT} "${MY_FILE}.3" \
896 | ${MY_SED} -e 's/$/\n/' --output "${MY_FILE}"
897 ${MY_RM} -f "${MY_FILE}.2" "${MY_FILE}.3"
898
899 # Install it.
900 if test -n "${MY_USERCPP_H_FULL}" -a -d "${MY_SLICKDIR}"; then
901 if test -f "${MY_USERCPP_H_FULL}"; then
902 ${MY_MV} -vf "${MY_USERCPP_H_FULL}" "${MY_USERCPP_H_FULL}.bak"
903 ${MY_CP} "${MY_FILE}" "${MY_USERCPP_H_FULL}"
904 echo "Updated the SlickEdit preprocessor file. (Previous version renamed to .bak.)"
905 else
906 ${MY_CP} "${MY_FILE}" "${MY_USERCPP_H_FULL}"
907 echo "Created the SlickEdit preprocessor file."
908 fi
909 fi
910}
911
912###### end of functions ####
913
914
915#
916# Parse arguments.
917#
918while test $# -ge 1;
919do
920 ARG=$1
921 shift
922 case "$ARG" in
923
924 --rootdir)
925 if test $# -eq 0; then
926 echo "error: missing --rootdir argument." 1>&2
927 exit 1;
928 fi
929 MY_ROOT_DIR="$1"
930 shift
931 ;;
932
933 --outdir)
934 if test $# -eq 0; then
935 echo "error: missing --outdir argument." 1>&2
936 exit 1;
937 fi
938 MY_OUT_DIR="$1"
939 shift
940 ;;
941
942 --project-base)
943 if test $# -eq 0; then
944 echo "error: missing --project-base argument." 1>&2
945 exit 1;
946 fi
947 MY_PRJ_PRF="$1"
948 shift
949 ;;
950
951 --workspace)
952 if test $# -eq 0; then
953 echo "error: missing --workspace argument." 1>&2
954 exit 1;
955 fi
956 MY_WS_NAME="$1"
957 shift
958 ;;
959
960 --windows-host)
961 MY_WINDOWS_HOST=1
962 ;;
963
964 --minimal)
965 MY_OPT_MINIMAL=1
966 ;;
967
968 --slickedit-config)
969 MY_SLICK_CONFIG="$1"
970 shift
971 ;;
972
973 # usage
974 --h*|-h*|-?|--?)
975 echo "usage: $0 [--rootdir <rootdir>] [--outdir <outdir>] [--project-base <prefix>] [--workspace <name>] [--minimal] [--slickedit-config <DIR>]"
976 echo ""
977 echo "If --outdir is specified, you must specify a --rootdir relative to it as well."
978 exit 1;
979 ;;
980
981 # default
982 *)
983 echo "error: Invalid parameter '$ARG'" 1>&2
984 exit 1;
985
986 esac
987done
988
989
990#
991# From now on everything *MUST* succeed.
992#
993set -e
994
995
996#
997# Make sure the output directory exists, is valid and clean.
998#
999${MY_RM} -f \
1000 "${MY_OUT_DIR}/${MY_PRJ_PRF}"*.vpj \
1001 "${MY_OUT_DIR}/${MY_WS_NAME}" \
1002 "${MY_OUT_DIR}/`echo ${MY_WS_NAME} | ${MY_SED} -e 's/\.vpw$/.vtg/'`"
1003${MY_MKDIR} -p "${MY_OUT_DIR}"
1004cd "${MY_OUT_DIR}"
1005
1006
1007#
1008# Determine the invocation to conjure up kmk.
1009#
1010my_abs_dir "tools"
1011if test -n "${MY_WINDOWS_HOST}"; then
1012 MY_KMK_INVOCATION="${MY_ABS_DIR}/win.x86/bin/rexx.exe ${MY_ABS_DIR}/envSub.cmd kmk.exe"
1013else
1014 MY_KMK_INVOCATION="/usr/bin/env LANG=C ${MY_ABS_DIR}/env.sh --quiet --no-wine kmk"
1015fi
1016
1017
1018#
1019# Generate the projects and workspace.
1020#
1021# Note! The configs aren't optimal yet, lots of adjustment wrt headers left to be done.
1022#
1023
1024# src/VBox/Runtime
1025my_generate_project "IPRT" "src/VBox/Runtime" --begin-incs "include" "src/VBox/Runtime/include" --end-includes "include/iprt" "src/VBox/Runtime"
1026
1027# src/VBox/VMM
1028my_generate_project "VMM" "src/VBox/VMM" --begin-incs "include" "src/VBox/VMM" --end-includes "src/VBox/VMM" \
1029 "include/VBox/vmm/cfgm.h" \
1030 "include/VBox/vmm/cpum.*" \
1031 "include/VBox/vmm/dbgf.h" \
1032 "include/VBox/vmm/em.h" \
1033 "include/VBox/vmm/gim.h" \
1034 "include/VBox/vmm/apic.h" \
1035 "include/VBox/vmm/gmm.*" \
1036 "include/VBox/vmm/gvm.*" \
1037 "include/VBox/vmm/hm*.*" \
1038 "include/VBox/vmm/iom.h" \
1039 "include/VBox/vmm/mm.h" \
1040 "include/VBox/vmm/patm.*" \
1041 "include/VBox/vmm/pdm*.h" \
1042 "include/VBox/vmm/pgm.*" \
1043 "include/VBox/vmm/selm.*" \
1044 "include/VBox/vmm/ssm.h" \
1045 "include/VBox/vmm/stam.*" \
1046 "include/VBox/vmm/tm.h" \
1047 "include/VBox/vmm/trpm.*" \
1048 "include/VBox/vmm/vm.*" \
1049 "include/VBox/vmm/vmm.*"
1050
1051# src/VBox/Additions
1052my_generate_project "Add-darwin" "src/VBox/Additions/darwin" --begin-incs "include" "src/VBox/Additions/darwin" --end-includes "src/VBox/Additions/darwin"
1053my_generate_project "Add-freebsd" "src/VBox/Additions/freebsd" --begin-incs "include" "src/VBox/Additions/freebsd" --end-includes "src/VBox/Additions/freebsd"
1054my_generate_project "Add-haiku" "src/VBox/Additions/haiku" --begin-incs "include" "src/VBox/Additions/haiku" --end-includes "src/VBox/Additions/haiku"
1055my_generate_project "Add-linux" "src/VBox/Additions/linux" --begin-incs "include" "src/VBox/Additions/linux" --end-includes "src/VBox/Additions/linux"
1056my_generate_project "Add-os2" "src/VBox/Additions/os2" --begin-incs "include" "src/VBox/Additions/os2" --end-includes "src/VBox/Additions/os2"
1057my_generate_project "Add-solaris" "src/VBox/Additions/solaris" --begin-incs "include" "src/VBox/Additions/solaris" --end-includes "src/VBox/Additions/solaris"
1058my_generate_project "Add-win" "src/VBox/Additions/WINNT" --begin-incs "include" "src/VBox/Additions/WINNT" --end-includes "src/VBox/Additions/WINNT"
1059if test -z "$MY_OPT_MINIMAL"; then
1060 my_generate_project "Add-x11" "src/VBox/Additions/x11" --begin-incs "include" "src/VBox/Additions/x11" --end-includes "src/VBox/Additions/x11"
1061fi
1062my_generate_project "Add-Control" "src/VBox/Additions/common/VBoxControl" --begin-incs "include" "src/VBox/Additions/common/VBoxControl" --end-includes "src/VBox/Additions/common/VBoxControl"
1063my_generate_project "Add-GuestDrv" "src/VBox/Additions/common/VBoxGuest" --begin-incs "include" "src/VBox/Additions/common/VBoxGuest" --end-includes "src/VBox/Additions/common/VBoxGuest" "include/VBox/VBoxGuest*.*"
1064my_generate_project "Add-Lib" "src/VBox/Additions/common/VBoxGuest/lib" --begin-incs "include" "src/VBox/Additions/common/VBoxGuest/lib" --end-includes "src/VBox/Additions/common/VBoxGuest/lib" "include/VBox/VBoxGuest/lib/*.*"
1065my_generate_project "Add-Service" "src/VBox/Additions/common/VBoxService" --begin-incs "include" "src/VBox/Additions/common/VBoxService" --end-includes "src/VBox/Additions/common/VBoxService"
1066my_generate_project "Add-VBoxVideo" "src/VBox/Additions/common/VBoxVideo" --begin-incs "include" "src/VBox/Additions/common/VBoxVideo" --end-includes "src/VBox/Additions/common/VBoxVideo"
1067if test -z "$MY_OPT_MINIMAL"; then
1068 my_generate_project "Add-pam" "src/VBox/Additions/common/pam" --begin-incs "include" "src/VBox/Additions/common/pam" --end-includes "src/VBox/Additions/common/pam"
1069 my_generate_project "Add-cmn-test" "src/VBox/Additions/common/testcase" --begin-incs "include" "src/VBox/Additions/common/testcase" --end-includes "src/VBox/Additions/common/testcase"
1070 my_generate_project "Add-CredProv" "src/VBox/Additions/WINNT/VBoxCredProv" --begin-incs "include" "src/VBox/Additions/WINNT/VBoxCredProv" --end-includes "src/VBox/Additions/WINNT/VBoxCredProv"
1071 my_generate_project "Add-GINA" "src/VBox/Additions/WINNT/VBoxGINA" --begin-incs "include" "src/VBox/Additions/WINNT/VBoxGINA" --end-includes "src/VBox/Additions/WINNT/VBoxGINA"
1072fi
1073
1074# src/VBox/Debugger
1075my_generate_project "Debugger" "src/VBox/Debugger" --begin-incs "include" "src/VBox/Debugger" --end-includes "src/VBox/Debugger" "include/VBox/dbggui.h" "include/VBox/dbg.h"
1076
1077# src/VBox/Devices
1078my_generate_project "Devices" "src/VBox/Devices" --begin-incs "include" "src/VBox/Devices" --end-includes "src/VBox/Devices" "include/VBox/pci.h" "include/VBox/pdm*.h"
1079## @todo split this up.
1080
1081# src/VBox/Disassembler
1082my_generate_project "DIS" "src/VBox/Disassembler" --begin-incs "include" "src/VBox/Disassembler" --end-includes "src/VBox/Disassembler" "include/VBox/dis*.h"
1083
1084# src/VBox/Frontends
1085if test -z "$MY_OPT_MINIMAL"; then
1086 my_generate_project "FE-VBoxBalloonCtrl" "src/VBox/Frontends/VBoxBalloonCtrl" --begin-incs "include" "src/VBox/Frontends/VBoxBalloonCtrl" --end-includes "src/VBox/Frontends/VBoxBalloonCtrl"
1087fi
1088my_generate_project "FE-VBoxManage" "src/VBox/Frontends/VBoxManage" --begin-incs "include" "src/VBox/Frontends/VBoxManage" --end-includes "src/VBox/Frontends/VBoxManage"
1089my_generate_project "FE-VBoxHeadless" "src/VBox/Frontends/VBoxHeadless" --begin-incs "include" "src/VBox/Frontends/VBoxHeadless" --end-includes "src/VBox/Frontends/VBoxHeadless"
1090my_generate_project "FE-VBoxSDL" "src/VBox/Frontends/VBoxSDL" --begin-incs "include" "src/VBox/Frontends/VBoxSDL" --end-includes "src/VBox/Frontends/VBoxSDL"
1091my_generate_project "FE-VBoxShell" "src/VBox/Frontends/VBoxShell" --begin-incs "include" "src/VBox/Frontends/VBoxShell" --end-includes "src/VBox/Frontends/VBoxShell"
1092# noise - my_generate_project "FE-VBoxBFE" "src/VBox/Frontends/VBoxBFE" --begin-incs "include" "src/VBox/Frontends/VBoxBFE" --end-includes "src/VBox/Frontends/VBoxBFE"
1093FE_VBOX_WRAPPERS=""
1094for d in ${MY_OUT_DIRS};
1095do
1096 if test -d "${MY_ROOT_DIR}/${d}/obj/VirtualBox/include"; then
1097 FE_VBOX_WRAPPERS="${d}/obj/VirtualBox/include"
1098 break
1099 fi
1100done
1101if test -n "${FE_VBOX_WRAPPERS}"; then
1102 my_generate_project "FE-VirtualBox" "src/VBox/Frontends/VirtualBox" --begin-incs "include" "${FE_VBOX_WRAPPERS}" --end-includes "src/VBox/Frontends/VirtualBox" "${FE_VBOX_WRAPPERS}/COMWrappers.cpp" "${FE_VBOX_WRAPPERS}/COMWrappers.h"
1103else
1104 my_generate_project "FE-VirtualBox" "src/VBox/Frontends/VirtualBox" --begin-incs "include" --end-includes "src/VBox/Frontends/VirtualBox"
1105fi
1106
1107# src/VBox/GuestHost
1108my_generate_project "HGSMI-GH" "src/VBox/GuestHost/HGSMI" --begin-incs "include" --end-includes "src/VBox/GuestHost/HGSMI"
1109if test -z "$MY_OPT_MINIMAL"; then
1110 my_generate_project "DnD-GH" "src/VBox/GuestHost/DragAndDrop" --begin-incs "include" --end-includes "src/VBox/GuestHost/DragAndDrop"
1111fi
1112my_generate_project "ShClip-GH" "src/VBox/GuestHost/SharedClipboard" --begin-incs "include" --end-includes "src/VBox/GuestHost/SharedClipboard"
1113
1114# src/VBox/HostDrivers
1115my_generate_project "SUP" "src/VBox/HostDrivers/Support" --begin-incs "include" "src/VBox/HostDrivers/Support" --end-includes "src/VBox/HostDrivers/Support" "include/VBox/sup.h" "include/VBox/sup.mac"
1116my_generate_project "VBoxNetAdp" "src/VBox/HostDrivers/VBoxNetAdp" --begin-incs "include" "src/VBox/HostDrivers/VBoxNetAdp" --end-includes "src/VBox/HostDrivers/VBoxNetAdp" "include/VBox/intnet.h"
1117my_generate_project "VBoxNetFlt" "src/VBox/HostDrivers/VBoxNetFlt" --begin-incs "include" "src/VBox/HostDrivers/VBoxNetFlt" --end-includes "src/VBox/HostDrivers/VBoxNetFlt" "include/VBox/intnet.h"
1118my_generate_project "VBoxUSB" "src/VBox/HostDrivers/VBoxUSB" --begin-incs "include" "src/VBox/HostDrivers/VBoxUSB" --end-includes "src/VBox/HostDrivers/VBoxUSB" "include/VBox/usblib*.h" "include/VBox/usbfilter.h"
1119my_generate_project "AdpCtl" "src/VBox/HostDrivers/adpctl" --begin-incs "include" --end-includes "src/VBox/HostDrivers/adpctl"
1120
1121# src/VBox/HostServices
1122my_generate_project "GuestCntl" "src/VBox/HostServices/GuestControl" --begin-incs "include" "src/VBox/HostServices/GuestControl" --end-includes "src/VBox/HostServices/GuestControl"
1123my_generate_project "DragAndDrop" "src/VBox/HostServices/DragAndDrop" --begin-incs "include" "src/VBox/HostServices/DragAndDrop" --end-includes "src/VBox/HostServices/DragAndDrop"
1124my_generate_project "GuestProps" "src/VBox/HostServices/GuestProperties" --begin-incs "include" "src/VBox/HostServices/GuestProperties" --end-includes "src/VBox/HostServices/GuestProperties"
1125my_generate_project "ShClip-HS" "src/VBox/HostServices/SharedClipboard" --begin-incs "include" "src/VBox/HostServices/SharedClipboard" --end-includes "src/VBox/HostServices/SharedClipboard"
1126my_generate_project "SharedFolders" "src/VBox/HostServices/SharedFolders" --begin-incs "include" "src/VBox/HostServices/SharedFolders" --end-includes "src/VBox/HostServices/SharedFolders" "include/VBox/shflsvc.h"
1127
1128# src/VBox/ImageMounter
1129my_generate_project "ImageMounter" "src/VBox/ImageMounter" --begin-incs "include" "src/VBox/ImageMounter" --end-includes "src/VBox/ImageMounter"
1130
1131# src/VBox/Installer
1132my_generate_project "Installers" "src/VBox/Installer" --begin-incs "include" --end-includes "src/VBox/Installer"
1133
1134# src/VBox/Main
1135my_generate_project "Main" "src/VBox/Main" --begin-incs "include" "src/VBox/Main/include" --end-includes "src/VBox/Main" "include/VBox/com" "include/VBox/settings.h"
1136## @todo seperate webservices and Main. pick the right headers. added generated headers.
1137
1138# src/VBox/Network
1139my_generate_project "Net-DHCP" "src/VBox/NetworkServices/Dhcpd" --begin-incs "include" "src/VBox/NetworkServices/NetLib" --end-includes "src/VBox/NetworkServices/Dhcpd"
1140my_generate_project "Net-NAT" "src/VBox/NetworkServices/NAT" --begin-incs "include" "src/VBox/NetworkServices/NAT" --end-includes "src/VBox/NetworkServices/NAT" "src/VBox/Devices/Network/slirp"
1141my_generate_project "Net-NetLib" "src/VBox/NetworkServices/NetLib" --begin-incs "include" "src/VBox/NetworkServices/NetLib" --end-includes "src/VBox/NetworkServices/NetLib"
1142
1143# src/VBox/RDP
1144my_generate_project "RDP-Client" "src/VBox/RDP/client-1.8.4" --begin-incs "include" "src/VBox/RDP/client-1.8.4" --end-includes "src/VBox/RDP/client-1.8.4"
1145my_generate_project "RDP-Server" "src/VBox/RDP/server" --begin-incs "include" "src/VBox/RDP/server" --end-includes "src/VBox/RDP/server"
1146my_generate_project "RDP-WebClient" "src/VBox/RDP/webclient" --begin-incs "include" "src/VBox/RDP/webclient" --end-includes "src/VBox/RDP/webclient"
1147my_generate_project "RDP-Misc" "src/VBox/RDP" --begin-incs "include" --end-includes "src/VBox/RDP/auth" "src/VBox/RDP/tscpasswd" "src/VBox/RDP/x11server"
1148
1149# src/VBox/Storage
1150my_generate_project "Storage" "src/VBox/Storage" --begin-incs "include" "src/VBox/Storage" --end-includes "src/VBox/Storage"
1151
1152# src/VBox/ValidationKit
1153my_generate_project "ValidationKit" "src/VBox/ValidationKit" --begin-incs "include" --end-includes "src/VBox/ValidationKit"
1154
1155# src/VBox/ExtPacks
1156my_generate_project "ExtPacks" "src/VBox/ExtPacks" --begin-incs "include" --end-includes "src/VBox/ExtPacks"
1157
1158# src/bldprogs
1159my_generate_project "bldprogs" "src/bldprogs" --begin-incs "include" --end-includes "src/bldprogs"
1160
1161# A few things from src/lib
1162my_generate_project "zlib" "src/libs/zlib-1.2.11" --begin-incs "include" --end-includes "src/libs/zlib-1.2.11/*.c" "src/libs/zlib-1.2.11/*.h"
1163my_generate_project "liblzf" "src/libs/liblzf-3.4" --begin-incs "include" --end-includes "src/libs/liblzf-3.4"
1164my_generate_project "libpng" "src/libs/libpng-1.6.36" --begin-incs "include" --end-includes "src/libs/libpng-1.6.36/*.c" "src/libs/libpng-1.6.36/*.h"
1165my_generate_project "openssl" "src/libs/openssl-1.1.1g" --begin-incs "include" "src/libs/openssl-1.1.1g/crypto" --end-includes "src/libs/openssl-1.1.1g"
1166my_generate_project "curl" "src/libs/curl-7.64.0" --begin-incs "include" "src/libs/curl-7.64.0/include" --end-includes "src/libs/curl-7.64.0"
1167
1168# webtools
1169my_generate_project "webtools" "webtools" --begin-incs "include" "webtools/tinderbox/server/Tinderbox3" --end-includes "webtools"
1170
1171# include/VBox
1172my_generate_project "VBoxHeaders" "include" --begin-incs "include" --end-includes "include/VBox"
1173
1174# Misc
1175my_generate_project "misc" "." --begin-incs "include" --end-includes \
1176 "configure" \
1177 "configure.vbs" \
1178 "Config.kmk" \
1179 "Makefile.kmk" \
1180 "src/Makefile.kmk" \
1181 "src/VBox/Makefile.kmk"
1182
1183
1184# out/x.y/z/bin/sdk/bindings/xpcom
1185XPCOM_INCS="src/libs/xpcom18a4"
1186for d in \
1187 "out/${KBUILD_TARGET}.${KBUILD_TARGET_ARCH}/${KBUILD_TYPE}/dist/sdk/bindings/xpcom" \
1188 "out/${KBUILD_TARGET}.${KBUILD_TARGET_ARCH}/${KBUILD_TYPE}/bin/sdk/bindings/xpcom" \
1189 "out/linux.amd64/debug/bin/sdk/bindings/xpcom" \
1190 "out/linux.x86/debug/bin/sdk/bindings/xpcom" \
1191 "out/darwin.amd64/debug/dist/sdk/bindings/xpcom" \
1192 "out/darwin.x86/debug/bin/dist/bindings/xpcom" \
1193 "out/haiku.amd64/debug/bin/sdk/bindings/xpcom" \
1194 "out/haiku.x86/debug/bin/sdk/bindings/xpcom" \
1195 "out/solaris.amd64/debug/bin/sdk/bindings/xpcom" \
1196 "out/solaris.x86/debug/bin/sdk/bindings/xpcom";
1197do
1198 if test -d "${MY_ROOT_DIR}/${d}"; then
1199 my_generate_project "SDK-xpcom" "${d}" --begin-incs "include" "${d}/include" --end-includes "${d}"
1200 XPCOM_INCS="${d}/include"
1201 break
1202 fi
1203done
1204
1205# lib/xpcom
1206my_generate_project "xpcom" "src/libs/xpcom18a4" --begin-incs "include" "${XPCOM_INCS}" --end-includes "src/libs/xpcom18a4"
1207
1208my_generate_workspace
1209
1210
1211#
1212# Update the history file if present.
1213#
1214MY_FILE="${MY_WS_NAME}histu"
1215if test -f "${MY_FILE}"; then
1216 echo "Updating ${MY_FILE}..."
1217 ${MY_MV} -f "${MY_FILE}" "${MY_FILE}.old"
1218 ${MY_SED} -n \
1219 -e '/PROJECT_CACHE/d' \
1220 -e '/\[TreeExpansion2\]/d' \
1221 -e '/^\[/p' \
1222 -e '/: /p' \
1223 -e '/^CurrentProject/p' \
1224 "${MY_FILE}.old" > "${MY_FILE}"
1225fi
1226
1227
1228#
1229# Generate and update the usercpp.h/unxcpp.h file.
1230#
1231my_generate_usercpp_h
1232
1233
1234echo "done"
Note: See TracBrowser for help on using the repository browser.

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